idnits 2.17.1 draft-pantos-http-live-streaming-14.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- -- The document has an IETF Trust Provisions (28 Dec 2009) Section 6.c(ii) Publication Limitation clause. If this document is intended for submission to the IESG for publication, this constitutes an error. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 14, 2014) is 3475 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Informational R. Pantos, Ed. 3 Internet-Draft W. May 4 Intended status: Informational Apple Inc. 5 Expires: April 17, 2015 October 14, 2014 7 HTTP Live Streaming 8 draft-pantos-http-live-streaming-14 10 Abstract 12 This document describes a protocol for transferring unbounded streams 13 of multimedia data. It specifies the data format of the files and 14 the actions to be taken by the server (sender) and the clients 15 (receivers) of the streams. It describes version 7 of this protocol. 17 Status of This Memo 19 This Internet-Draft is submitted in full conformance with the 20 provisions of BCP 78 and BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF). Note that other groups may also distribute 24 working documents as Internet-Drafts. The list of current Internet- 25 Drafts is at http://datatracker.ietf.org/drafts/current/. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 This Internet-Draft will expire on April 17, 2015. 34 Copyright Notice 36 Copyright (c) 2014 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents 41 (http://trustee.ietf.org/license-info) in effect on the date of 42 publication of this document. Please review these documents 43 carefully, as they describe your rights and restrictions with respect 44 to this document. 46 This document may not be modified, and derivative works of it may not 47 be created, and it may not be published except as an Internet-Draft. 49 This Informational Internet Draft is submitted as an RFC Editor 50 Contribution and/or non-IETF Document (not as a Contribution, IETF 51 Contribution, nor IETF Document) in accordance with BCP 78 and BCP 52 79. 54 Table of Contents 56 1. Introduction to HTTP Live Streaming . . . . . . . . . . . . . 3 57 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4 58 3. Media Segments . . . . . . . . . . . . . . . . . . . . . . . 5 59 4. Playlists . . . . . . . . . . . . . . . . . . . . . . . . . . 7 60 4.1. Definition of a Playlist . . . . . . . . . . . . . . . . 7 61 4.2. Attribute Lists . . . . . . . . . . . . . . . . . . . . . 8 62 4.3. Playlist Tags . . . . . . . . . . . . . . . . . . . . . . 9 63 4.3.1. Basic Tags . . . . . . . . . . . . . . . . . . . . . 9 64 4.3.1.1. EXTM3U . . . . . . . . . . . . . . . . . . . . . 9 65 4.3.1.2. EXT-X-VERSION . . . . . . . . . . . . . . . . . . 9 66 4.3.2. Media Segment Tags . . . . . . . . . . . . . . . . . 10 67 4.3.2.1. EXTINF . . . . . . . . . . . . . . . . . . . . . 10 68 4.3.2.2. EXT-X-BYTERANGE . . . . . . . . . . . . . . . . . 11 69 4.3.2.3. EXT-X-DISCONTINUITY . . . . . . . . . . . . . . . 11 70 4.3.2.4. EXT-X-KEY . . . . . . . . . . . . . . . . . . . . 12 71 4.3.2.5. EXT-X-MAP . . . . . . . . . . . . . . . . . . . . 13 72 4.3.2.6. EXT-X-PROGRAM-DATE-TIME . . . . . . . . . . . . . 14 73 4.3.3. Media Playlist Tags . . . . . . . . . . . . . . . . . 15 74 4.3.3.1. EXT-X-TARGETDURATION . . . . . . . . . . . . . . 15 75 4.3.3.2. EXT-X-MEDIA-SEQUENCE . . . . . . . . . . . . . . 15 76 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE . . . . . . . . . . 16 77 4.3.3.4. EXT-X-ENDLIST . . . . . . . . . . . . . . . . . . 16 78 4.3.3.5. EXT-X-PLAYLIST-TYPE . . . . . . . . . . . . . . . 16 79 4.3.3.6. EXT-X-I-FRAMES-ONLY . . . . . . . . . . . . . . . 17 80 4.3.4. Master Playlist Tags . . . . . . . . . . . . . . . . 17 81 4.3.4.1. EXT-X-MEDIA . . . . . . . . . . . . . . . . . . . 18 82 4.3.4.1.1. Rendition Groups . . . . . . . . . . . . . . 20 83 4.3.4.2. EXT-X-STREAM-INF . . . . . . . . . . . . . . . . 21 84 4.3.4.2.1. Alternative Renditions . . . . . . . . . . . 24 85 4.3.4.3. EXT-X-I-FRAME-STREAM-INF . . . . . . . . . . . . 24 86 4.3.4.4. EXT-X-SESSION-DATA . . . . . . . . . . . . . . . 25 87 4.3.5. Media or Master Playlist Tags . . . . . . . . . . . . 26 88 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS . . . . . . . . . . . 26 89 4.3.5.2. EXT-X-START . . . . . . . . . . . . . . . . . . . 26 90 5. Key files . . . . . . . . . . . . . . . . . . . . . . . . . . 27 91 5.1. Structure of Key files . . . . . . . . . . . . . . . . . 27 92 5.2. IV for [AES_128] . . . . . . . . . . . . . . . . . . . . 27 93 6. Client/Server Responsibilities . . . . . . . . . . . . . . . 28 94 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 28 95 6.2. Server Responsibilities . . . . . . . . . . . . . . . . . 28 96 6.2.1. General Server Responsibilities . . . . . . . . . . . 28 97 6.2.2. Live Playlists . . . . . . . . . . . . . . . . . . . 30 98 6.2.3. Encrypting Media Segments . . . . . . . . . . . . . . 31 99 6.2.4. Providing Variant Streams . . . . . . . . . . . . . . 32 100 6.3. Client Responsibilities . . . . . . . . . . . . . . . . . 33 101 6.3.1. General Client Responsibilities . . . . . . . . . . . 33 102 6.3.2. Loading the Media Playlist file . . . . . . . . . . . 34 103 6.3.3. Playing the Media Playlist file . . . . . . . . . . . 34 104 6.3.4. Reloading the Media Playlist file . . . . . . . . . . 35 105 6.3.5. Determining the next segment to load . . . . . . . . 36 106 6.3.6. Decrypting encrypted Media Segments . . . . . . . . . 36 107 7. Protocol version compatibility . . . . . . . . . . . . . . . 37 108 8. Playlist Examples . . . . . . . . . . . . . . . . . . . . . . 39 109 8.1. Simple Media Playlist . . . . . . . . . . . . . . . . . . 39 110 8.2. Live Media Playlist, using HTTPS . . . . . . . . . . . . 39 111 8.3. Playlist with encrypted Media Segments . . . . . . . . . 39 112 8.4. Master Playlist . . . . . . . . . . . . . . . . . . . . . 40 113 8.5. Master Playlist with I-Frames . . . . . . . . . . . . . . 40 114 8.6. Master Playlist with Alternative audio . . . . . . . . . 41 115 8.7. Master Playlist with Alternative video . . . . . . . . . 41 116 8.8. Session Data in a Master Playlist . . . . . . . . . . . . 42 117 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 43 118 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 119 11. Security Considerations . . . . . . . . . . . . . . . . . . . 44 120 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 121 12.1. Normative References . . . . . . . . . . . . . . . . . . 44 122 12.2. Informative References . . . . . . . . . . . . . . . . . 46 123 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 47 125 1. Introduction to HTTP Live Streaming 127 HTTP Live Streaming provides a reliable, cost-effective means of 128 delivering continuous and long-form video over the Internet. It 129 allows a receiver to adapt the bit rate of the media to the current 130 network conditions in order to maintain uninterrupted playback at the 131 best possible quality. It supports interstitial content boundaries. 132 It provides a flexible framework for media encryption. It can 133 efficiently offer multiple renditions of the same content, such as 134 audio translations. It offers compatibility with large-scale HTTP 135 caching infrastructure to support delivery to large audiences. 137 Since its first draft publication in 2009, HTTP Live Streaming has 138 been implemented and deployed by a wide array of content producers, 139 tools vendors, distributors, and device manufacturers. 141 The purpose of this document is to facilitate interoperability 142 between HTTP Live Streaming implementations by describing the media 143 transmission protocol. Using this protocol, a client can receive a 144 continuous stream of media from a server for concurrent presentation. 146 This document describes version 7 of the protocol. 148 2. Overview 150 A multimedia presentation is specified by a Uniform Resource 151 Identifier (URI) [RFC3986] to a Playlist. 153 A Playlist is either a Media Playlist or a Master Playlist. Both are 154 text files containing URIs and descriptive tags. 156 A Media Playlist contains a list of Media Segments, which when played 157 sequentially will play the multimedia presentation. 159 Here is an example of a Media Playlist: 161 #EXTM3U 162 #EXT-X-TARGETDURATION:10 164 #EXTINF:9.009, 165 http://media.example.com/first.ts 166 #EXTINF:9.009, 167 http://media.example.com/second.ts 168 #EXTINF:3.003, 169 http://media.example.com/third.ts 171 The first line is the format identifier tag #EXTM3U. The line 172 containing #EXT-X-TARGETDURATION says that all Media Segments will be 173 10 seconds long or less. Then three Media Segments are declared. 174 The first and second are 9.009 seconds long; the third is 3.003 175 seconds. 177 To play this Playlist, the client first downloads it and then 178 downloads and plays each Media Segment declared within it. The 179 client reloads the Playlist as described in this document to discover 180 any added segments. Data is usually carried over HTTP [RFC7230], but 181 in general a URI can specify any protocol that can reliably transfer 182 the specified resource on demand. 184 A more complex presentation can be described by a Master Playlist. A 185 Master Playlist provides a set of Variant Streams, each of which 186 describes a different version of the same content. 188 A Variant Stream includes a Media Playlist that specifies media 189 encoded at a particular bit rate, in a particular format, and at a 190 particular resolution for media containing video. 192 A Variant Stream can also specify a set of Renditions. Renditions 193 are alternate versions of the content, such as audio produced in 194 different languages or video recorded from different camera angles. 196 Players can switch between the different Variant Streams and 197 Renditions to adapt to network conditions and user preferences. 199 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 200 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 201 document are to be interpreted as described in RFC 2119 [RFC2119]. 203 3. Media Segments 205 A Media Playlist contains a series of Media Segments which make up 206 the overall presentation. A Media Segment is specified by a URI and 207 optionally a byte range. 209 The duration of each Media Segment is indicated in the Media Playlist 210 by its EXTINF tag (Section 4.3.2.1). 212 Each segment in a Media Playlist has a unique integer Media Sequence 213 Number. The Media Sequence Number of the first segment in the 214 playlist is either 0, or declared in the Playlist (Section 4.3.3.2). 215 The Media Sequence Number of every other segment is equal to the 216 Media Sequence Number of the segment that precedes it plus one. 218 Each Media Segment MUST be formatted as an MPEG-2 Transport Stream 219 [ISO_13818], an MPEG audio elementary stream [ISO_11172], or a WebVTT 220 [WebVTT] file. Transport of other media file formats is not defined. 222 Some media formats require that a parser be initialized with a common 223 sequence of bytes before a Media Segment can be parsed. This format- 224 specific sequence is called the Media Initialization Section. The 225 Media Initialization Section of an MPEG-2 Transport Stream segment is 226 the Program Association Table (PAT) followed by the Program Map 227 Table (PMT). The Media Initialization Section of a WebVTT segment is 228 the WebVTT header. An audio elementary stream has no Media 229 Initialization Section. 231 Transport Stream segments MUST contain a single MPEG-2 Program; 232 playback of Multi-Program Transport Streams is not defined. Each 233 Transport Stream segment SHOULD contain a PAT and a PMT at the start 234 of the segment - or have a Media Initialization Section declared in 235 the Media Playlist (Section 4.3.2.5). Transport Stream packets read 236 before a corresponding PAT/PMT can be discarded. 238 A Media Segment that contains video SHOULD have at least one key 239 frame and enough information to completely initialize a video 240 decoder. 242 Each Media Segment MUST be the continuation of the encoded media at 243 the end of the segment with the previous Media Sequence Number, where 244 values in a continuous series such as timestamps and Continuity 245 Counters continue uninterrupted. The only exceptions are the first 246 Media Segment ever to appear in a Media Playlist, and Media Segments 247 which are explicitly signaled as discontinuities (Section 4.3.2.3). 248 Unmarked media discontinuities can trigger playback errors. 250 Each Elementary Audio Stream segment MUST signal the timestamp of its 251 first sample with an ID3 PRIV tag [ID3] at the beginning of the 252 segment. The ID3 PRIV owner identifier MUST be 253 "com.apple.streaming.transportStreamTimestamp". The ID3 payload MUST 254 be a 33-bit MPEG-2 Program Elementary Stream timestamp expressed as a 255 big-endian eight-octet number, with the upper 31 bits set to zero. 256 An Elementary Audio Stream segment without such an ID3 tag can 257 trigger playback errors. 259 Subtitle segments are formatted as WebVTT [WebVTT] files. Each 260 subtitle segment MUST contain all subtitle cues that are intended to 261 be displayed during the period indicated by the segment EXTINF 262 duration. The start time offset and end time offset of each cue MUST 263 indicate the total display time for that cue, even if that time range 264 extends beyond the EXTINF duration. A WebVTT segment MAY contain no 265 cues; this indicates that no subtitles are to be displayed during 266 that period. 268 Each subtitle segment MUST either start with a WebVTT header or have 269 a Media Initialization Section declared in the Media Playlist 270 (Section 4.3.2.5). 272 Within each WebVTT header there MUST be an X-TIMESTAMP-MAP metadata 273 header. This header synchronizes the cue timestamps in the WebVTT 274 file with the MPEG-2 (PES) timestamps in other Renditions of the 275 Variant Stream. Its format is: 277 X-TIMESTAMP-MAP=LOCAL:,MPEGTS: 278 e.g. X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 280 The cue timestamp in the LOCAL attribute MAY fall outside the range 281 of time covered by the segment. 283 A subtitle segment not meeting these requirements can be displayed 284 inconsistently, not display at all, or cause other playback errors. 286 4. Playlists 288 This section describes the Playlist files used by HTTP Live 289 Streaming. In this section, "MUST" and "MUST NOT" specify the rules 290 for the syntax and structure of legal Playlist files. Playlists that 291 violate these rules are invalid; clients MUST fail to parse them. 292 See Section 6.3.2. 294 In this section, tags are specified using a BNF-style syntax. 296 Each Playlist file MUST be identifiable by either the path component 297 of its URI or by HTTP Content-Type. In the first case, the path MUST 298 end with either .m3u8 or .m3u (for compatibility). In the second, 299 the HTTP Content-type MUST be "application/vnd.apple.mpegurl" or 300 "audio/mpegurl" (for compatibility). Clients SHOULD refuse to parse 301 Playlists that are not so identified. 303 4.1. Definition of a Playlist 305 Playlist files MUST be encoded in UTF-8 [RFC3629]. They MUST NOT 306 contain any byte order mark (BOM); Clients SHOULD refuse to parse 307 Playlists which contain a BOM or do not parse as UTF-8. Note that 308 US-ASCII [US_ASCII] is a proper subset of UTF-8. 310 Lines in a Playlist file are terminated by either a single line feed 311 character or a carriage return character followed by an line feed 312 character. Each line is a URI, blank, or starts with the character 313 '#'. Blank lines are ignored. White space MUST NOT be present, 314 except for elements in which it is explicitly specified. 316 Lines that start with the character '#' are either comments or tags. 317 Tags begin with #EXT. They are case-sensitive. All other lines that 318 begin with '#' are comments and SHOULD be ignored. 320 A URI line identifies a Media Segment or a Playlist file (see 321 Section 4.3.4.2). Each Media Segment is specified by an URI and the 322 tags that apply to it. 324 A Playlist is a Media Playlist if all URI lines in the Playlist 325 identify Media Segments. A Playlist is a Master Playlist if all URI 326 lines in the Playlist identify Media Playlists. A Playlist MUST be 327 either a Media Playlist or a Master Playlist; all other Playlists are 328 invalid. 330 A URI in a Playlist, whether it is a URI line or part of a tag, MAY 331 be relative. Any relative URI is considered to be relative to the 332 URI of the Playlist that contains it. 334 The duration of a Media Playlist file is the sum of the durations of 335 the Media Segments within it. 337 The segment bit rate of a Media Segment is the size of the Media 338 Segment divided by its EXTINF duration (Section 4.3.2.1). Note that 339 this includes container overhead. 341 The peak bit rate of a Media Playlist is the largest segment bit rate 342 of all segments in the Media Playlist. 344 The average segment bit rate of a Media Playlist is the sum of the 345 sizes (in bits) of every Media Segment in the Media Playlist, divided 346 by the Media Playlist duration. Note that this includes container 347 overhead, but not HTTP or other overhead imposed by the delivery 348 system. 350 4.2. Attribute Lists 352 Certain tags have values which are Attribute Lists. An Attribute 353 List is a comma-separated list of attribute/value pairs with no 354 whitespace. 356 An attribute/value pair has the following syntax: 358 AttributeName=AttributeValue 360 An AttributeName is an unquoted string containing characters from the 361 set [A..Z], [0..9] and '-'. 363 An AttributeValue is one of the following: 365 o decimal-integer: an unquoted string of characters from the set 366 [0..9] expressing an integer in base-10 arithmetic in the range 367 from 0 to 2^64-1. 369 o hexadecimal-sequence: an unquoted string of characters from the 370 set [0..9] and [A..F] that is prefixed with 0x or 0X. 372 o decimal-floating-point: an unquoted string of characters from the 373 set [0..9] and '.' which expresses a non-negative floating-point 374 number in decimal positional notation. 376 o signed-decimal-floating-point: an unquoted string of characters 377 from the set [0..9], '-' and '.' which expresses a signed 378 floating-point number in decimal positional notation. 380 o quoted-string: a string of characters within a pair of double- 381 quotes (0x22). All uses of quoted-strings REQUIRE that the 382 following characters be escaped: line feed (0xA), carriage return 383 (0xD), and double quote (0x22). Escaping rules vary by attribute 384 type; for instance, URI attributes use percent-encoding. Quoted- 385 strings SHOULD be constructed so that byte-wise comparison is 386 sufficient to test two quoted-strings for equality (which implies 387 case-sensitive comparison). 389 o enumerated-string: an unquoted character string from a set which 390 is explicitly defined by the Attribute. An enumerated-string will 391 never contain double-quotes ("), commas (,), or whitespace. 393 o decimal-resolution: two decimal-integers separated by the "x" 394 character. The first integer is a horizontal pixel dimension 395 (width); the second is a vertical pixel dimension (height). 397 The type of the AttributeValue for a given AttributeName is specified 398 by the Attribute definition. 400 A given AttributeName MUST NOT appear more than once in a given 401 Attribute List. Clients SHOULD refuse to play such Playlists. 403 4.3. Playlist Tags 405 Playlist tags specify either global parameters of the Playlist, or 406 information about the Media Segments or Media Playlists that appear 407 after them. 409 4.3.1. Basic Tags 411 These tags are allowed in both Media Playlists and Master Playlists. 413 4.3.1.1. EXTM3U 415 The EXTM3U tag indicates that the file is an Extended M3U [M3U] 416 Playlist file. It MUST be the first line of every Media Playlist and 417 every Master Playlist. Its format is: 419 #EXTM3U 421 4.3.1.2. EXT-X-VERSION 423 The EXT-X-VERSION tag indicates the compatibility version of the 424 Playlist file, its associated media, and its server. 426 The EXT-X-VERSION tag applies to the entire Playlist file. Its 427 format is: 429 #EXT-X-VERSION: 431 where n is an integer indicating the protocol compatibility version 432 number. 434 It MUST appear in all Playlists containing tags or attributes that 435 are not compatible with protocol version 1 to support 436 interoperability with older clients. Section 7 specifies the minimum 437 value of the compatibility version number for any given Playlist 438 file. 440 A Playlist file MUST NOT contain more than one EXT-X-VERSION tag. If 441 a client encounters a Playlist with multiple EXT-X-VERSION tags, it 442 SHOULD fail to parse it. 444 4.3.2. Media Segment Tags 446 Each Media Segment is specified by a series of Media Segment tags 447 followed by a URI. Some Media Segment tags apply to just the next 448 segment; others apply to all subsequent segments until another 449 instance of the same tag. 451 A Media Segment tag MUST NOT appear in a Master Playlist. Clients 452 SHOULD fail to parse Playlists that contain both Media Segment Tags 453 and Master Playlist tags (Section 4.3.4). 455 4.3.2.1. EXTINF 457 The EXTINF tag specifies the duration of a Media Segment. It applies 458 only to the next Media Segment. This tag is REQUIRED for each Media 459 Segment. Its format is: 461 #EXTINF:, 463 where duration is a decimal-integer or decimal-floating-point number 464 (as described in Section 4.2) that specifies the duration of the 465 Media Segment in seconds. Durations that are reported as integers 466 SHOULD be rounded to the nearest integer. Durations MUST be integers 467 if the compatibility version number is less than 3 to support older 468 clients. Durations SHOULD be floating-point if the compatibility 469 version number is 3 or greater. The remainder of the line following 470 the comma is an optional human-readable informative title of the 471 Media Segment. 473 4.3.2.2. EXT-X-BYTERANGE 475 The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range 476 of the resource identified by its URI. It applies only to the next 477 URI line that follows it in the Playlist. Its format is: 479 #EXT-X-BYTERANGE:<n>[@<o>] 481 where n is a decimal-integer indicating the length of the sub-range 482 in bytes. If present, o is a decimal-integer indicating the start of 483 the sub-range, as a byte offset from the beginning of the resource. 484 If o is not present, the sub-range begins at the next byte following 485 the sub-range of the previous Media Segment. 487 If o is not present, a previous Media Segment MUST appear in the 488 Playlist file and MUST be a sub-range of the same media resource, or 489 the Media Segment is undefined and parsing the Playlist MUST fail. 491 A Media Segment without an EXT-X-BYTERANGE tag consists of the entire 492 resource identified by its URI. 494 Use of the EXT-X-BYTERANGE tag REQUIRES a compatibility version 495 number of 4 or greater. 497 4.3.2.3. EXT-X-DISCONTINUITY 499 The EXT-X-DISCONTINUITY tag indicates a discontinuity between the 500 Media Segment that follows it and the one that preceded it. 502 Its format is: 504 #EXT-X-DISCONTINUITY 506 The EXT-X-DISCONTINUITY tag MUST be present if there is a change in 507 any of the following characteristics: 509 o file format 511 o number, type and identifiers of tracks 513 o timestamp sequence 515 The EXT-X-DISCONTINUITY tag SHOULD be present if there is a change in 516 any of the following characteristics: 518 o encoding parameters 520 o encoding sequence 521 See Section 3, Section 6.2.1, and Section 6.3.3 for more information 522 about the EXT-X-DISCONTINUITY tag. 524 4.3.2.4. EXT-X-KEY 526 Media Segments MAY be encrypted. The EXT-X-KEY tag specifies how to 527 decrypt them. It applies to every Media Segment that appears between 528 it and the next EXT-X-KEY tag in the Playlist file with the same 529 KEYFORMAT attribute (or the end of the Playlist file). Two or more 530 EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the 531 same Media Segment if they ultimately produce the same decryption 532 key. The format is: 534 #EXT-X-KEY:<attribute-list> 536 The following attributes are defined: 538 METHOD 540 The value is an enumerated-string that specifies the encryption 541 method. This attribute is REQUIRED. 543 The methods defined are: NONE, AES-128, and SAMPLE-AES. 545 An encryption method of NONE means that Media Segments are not 546 encrypted. If the encryption method is NONE, other attributes MUST 547 NOT be present. 549 An encryption method of AES-128 signals that Media Segments are 550 completely encrypted using the Advanced Encryption Standard [AES_128] 551 with a 128-bit key, Cipher Block Chaining, and PKCS7 padding 552 [RFC5652]. CBC is restarted on each segment boundary, using either 553 the IV attribute value or the Media Sequence Number as the IV; see 554 Section 5.2. The URI attribute is REQUIRED for this METHOD. 556 An encryption method of SAMPLE-AES means that the Media Segments 557 contain media samples, such as audio or video, that are encrypted 558 using the Advanced Encryption Standard [AES_128]. How these media 559 streams are encrypted and encapsulated in a segment depends on the 560 media encoding and the media format of the segment. The encryption 561 format for H.264 [H_264], AAC [ISO_14496] and AC-3 [AC_3] media 562 streams is described by [SampleEnc]. The IV attribute MAY be 563 present; see Section 5.2. 565 URI 567 The value is a quoted-string containing a URI that specifies how to 568 obtain the key. This attribute is REQUIRED unless the METHOD is 569 NONE. 571 IV 573 The value is a hexadecimal-sequence that specifies a 128-bit unsigned 574 integer Initialization Vector to be used with the key. Use of the IV 575 attribute REQUIRES a compatibility version number of 2 or greater. 576 See Section 5.2 for when the IV attribute is used. 578 KEYFORMAT 580 The value is a quoted-string that specifies how the key is 581 represented in the resource identified by the URI; see Section 5 for 582 more detail. This attribute is OPTIONAL; its absence indicates an 583 implicit value of "identity". Use of the KEYFORMAT attribute 584 REQUIRES a compatibility version number of 5 or greater. 586 KEYFORMATVERSIONS 588 The value is a quoted-string containing one or more positive integers 589 separated by the "/" character (for example, "1/3"). If more than 590 one version of a particular KEYFORMAT is defined, this attribute can 591 be used to indicate which version(s) this instance complies with. 592 This attribute is OPTIONAL; if it is not present, its value is 593 considered to be "1". Use of the KEYFORMATVERSIONS attribute 594 REQUIRES a compatibility version number of 5 or greater. 596 If the Media Playlist file does not contain an EXT-X-KEY tag then 597 Media Segments are not encrypted. 599 See Section 5 for the format of the key file, and Section 5.2, 600 Section 6.2.3 and Section 6.3.6 for additional information on Media 601 Segment encryption. 603 4.3.2.5. EXT-X-MAP 605 The EXT-X-MAP tag specifies how to obtain the Media Initialization 606 Section (Section 3) required to parse the applicable Media Segments. 607 It applies to every Media Segment that appears after it in the 608 Playlist until the next EXT-X-MAP tag or until the end of the 609 playlist. 611 Its format is: 613 #EXT-X-MAP:<attribute-list> 615 The following attributes are defined: 617 URI 619 The value is a quoted-string containing a URI that identifies a 620 resource that contains the Media Initialization Section. This 621 attribute is REQUIRED. 623 BYTERANGE 625 The value is a quoted-string specifying a byte range into the 626 resource identified by the URI attribute. This range SHOULD contain 627 only the Media Initialization Section. The format of the byte range 628 is described in Section 4.3.2.2. This attribute is OPTIONAL; if it 629 is not present, the byte range is the entire resource indicated by 630 the URI. 632 An EXT-X-MAP tag SHOULD be supplied for Media Segments in Playlists 633 with the EXT-X-I-FRAMES-ONLY tag when the first Media Segment (i.e., 634 I-frame) in the Playlist (or the first segment following an EXT- 635 X-DISCONTINUITY tag) does not immediately follow the Media 636 Initialization Section at the beginning of its resource. 638 Use of the EXT-X-MAP tag in a Media Playlist that does not contain 639 the EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility version number 640 of 6 or greater; otherwise, a compatibility version number of 5 or 641 greater is REQUIRED. 643 4.3.2.6. EXT-X-PROGRAM-DATE-TIME 645 The EXT-X-PROGRAM-DATE-TIME tag associates the first sample of a 646 Media Segment with an absolute date and/or time. It applies only to 647 the next Media Segment. 649 The date/time representation is ISO/IEC 8601:2004 [ISO_8601] and 650 SHOULD indicate a time zone and fractional parts of seconds: 652 #EXT-X-PROGRAM-DATE-TIME:<YYYY-MM-DDThh:mm:ssZ> 654 For example: 656 #EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031+08:00 658 EXT-X-PROGRAM-DATE-TIME tags SHOULD provide millisecond accuracy. 660 See Section 6.2.1 and Section 6.3.3 for more information on the EXT- 661 X-PROGRAM-DATE-TIME tag. 663 4.3.3. Media Playlist Tags 665 Media Playlist tags describe global parameters of the Media Playlist. 666 There MUST NOT be more than one Media Playlist tag of each type in 667 any Media Playlist. 669 A Media Playlist Tag MUST NOT appear in a Master Playlist 671 4.3.3.1. EXT-X-TARGETDURATION 673 The EXT-X-TARGETDURATION tag specifies the maximum Media Segment 674 duration. The EXTINF duration of each Media Segment in the Playlist 675 file, when rounded to the nearest integer, MUST be less than or equal 676 to the target duration; longer segments can trigger playback stalls 677 or other errors. It applies to the entire Playlist file. Its format 678 is: 680 #EXT-X-TARGETDURATION:<s> 682 where s is a decimal-integer indicating the target duration in 683 seconds. The EXT-X-TARGETDURATION tag is REQUIRED. 685 4.3.3.2. EXT-X-MEDIA-SEQUENCE 687 The EXT-X-MEDIA-SEQUENCE tag indicates the Media Sequence Number of 688 the first Media Segment that appears in a Playlist file. Its format 689 is: 691 #EXT-X-MEDIA-SEQUENCE:<number> 693 where number is a decimal-integer. 695 If the Media Playlist file does not contain an EXT-X-MEDIA-SEQUENCE 696 tag then the Media Sequence Number of the first Media Segment in the 697 playlist SHALL be considered to be 0. A client MUST NOT assume that 698 segments with the same Media Sequence Number in different Media 699 Playlists contain matching content - see Section 6.3.2. 701 A URI for a Media Segment is not required to contain its Media 702 Sequence Number. 704 See Section 6.2.1 and Section 6.3.5 for more information on setting 705 the EXT-X-MEDIA-SEQUENCE tag. 707 The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media 708 Segment in the Playlist. 710 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE 712 The EXT-X-DISCONTINUITY-SEQUENCE tag allows synchronization between 713 different Renditions of the same Variant Stream or different Variant 714 Streams that have EXT-X-DISCONTINUITY tags in their Media Playlists. 716 Its format is: 718 #EXT-X-DISCONTINUITY-SEQUENCE:<number> 720 where number is a decimal-integer. 722 If the Media Playlist does not contain an EXT-X-DISCONTINUITY- 723 SEQUENCE tag, then the Discontinuity Sequence Number of the first 724 Media Segment in the Playlist SHALL be considered to be 0. 726 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first 727 Media Segment in the Playlist. 729 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT- 730 X-DISCONTINUITY tag. 732 See Section 6.2.1 and Section 6.2.2 for more information about 733 setting the value of the EXT-X-DISCONTINUITY-SEQUENCE tag. 735 4.3.3.4. EXT-X-ENDLIST 737 The EXT-X-ENDLIST tag indicates that no more Media Segments will be 738 added to the Media Playlist file. It MAY occur anywhere in the Media 739 Playlist file. Its format is: 741 #EXT-X-ENDLIST 743 4.3.3.5. EXT-X-PLAYLIST-TYPE 745 The EXT-X-PLAYLIST-TYPE tag provides mutability information about the 746 Media Playlist file. It applies to the entire Media Playlist file. 747 It is OPTIONAL. Its format is: 749 #EXT-X-PLAYLIST-TYPE:<EVENT|VOD> 751 Section 6.2.1 defines the implications of the EXT-X-PLAYLIST-TYPE 752 tag. 754 If the EXT-X-PLAYLIST-TYPE value is EVENT, Media Segments can only be 755 added to the end of the Media Playlist. If the EXT-X-PLAYLIST-TYPE 756 value is VOD, the Media Playlist cannot change. 758 If the EXT-X-PLAYLIST-TYPE tag is omitted from a Media Playlist, the 759 Playlist can be updated according to the rules in Section 6.2.1 with 760 no additional restrictions. For example, a live Playlist 761 (Section 6.2.2) MAY be updated to remove Media Segments in the order 762 that they appeared. 764 4.3.3.6. EXT-X-I-FRAMES-ONLY 766 The EXT-X-I-FRAMES-ONLY tag indicates that each Media Segment in the 767 Playlist describes a single I-frame. I-frames (or Intra frames) are 768 encoded video frames whose encoding does not depend on any other 769 frame. 771 The EXT-X-I-FRAMES-ONLY tag applies to the entire Playlist. Its 772 format is: 774 #EXT-X-I-FRAMES-ONLY 776 In a Playlist with the EXT-X-I-FRAMES-ONLY tag, the Media Segment 777 duration (EXTINF tag value) is the time between the presentation time 778 of the I-frame in the Media Segment and the presentation time of the 779 next I-frame in the Playlist, or the end of the presentation if it is 780 the last I-frame in the Playlist. 782 Media resources containing I-frame segments MUST begin with either a 783 Media Initialization Section (Section 3) or be accompanied by an EXT- 784 X-MAP tag indicating the Media Initialization Section so that clients 785 can load and decode I-frame segments in any order. The byte range of 786 an I-frame segment with an EXT-X-BYTERANGE tag applied to it 787 (Section 4.3.2.2) MUST NOT include its Media Initialization Section; 788 clients can assume that the Media Initialization Section is defined 789 by EXT-X-MAP tag, or is located from the start of the resource to the 790 offset of the first I-frame segment in that resource. 792 Use of the EXT-X-I-FRAMES-ONLY REQUIRES a compatibility version 793 number of 4 or greater. 795 4.3.4. Master Playlist Tags 797 Master Playlist tags define the Variant Streams, Renditions, and 798 other global parameters of the presentation. 800 Master Playlist Tags MUST NOT appear in a Media Playlist; clients 801 SHOULD fail to parse any Playlist that contains both a Master 802 Playlist tag and either a Media Playlist tag or a Media Segment tag. 804 4.3.4.1. EXT-X-MEDIA 806 The EXT-X-MEDIA tag is used to relate Media Playlists that contain 807 alternative Renditions (Section 4.3.4.2.1) of the same content. For 808 example, three EXT-X-MEDIA tags can be used to identify audio-only 809 Media Playlists that contain English, French and Spanish Renditions 810 of the same presentation. Or two EXT-X-MEDIA tags can be used to 811 identify video-only Media Playlists that show two different camera 812 angles. 814 Its format is: 816 #EXT-X-MEDIA:<attribute-list> 818 The following attributes are defined: 820 TYPE 822 The value is an enumerated-string; valid strings are AUDIO, VIDEO, 823 SUBTITLES and CLOSED-CAPTIONS. If the value is AUDIO, the Playlist 824 described by the tag MUST contain audio media. If the value is 825 VIDEO, the Playlist MUST contain video media. If the value is 826 SUBTITLES, the Playlist MUST contain subtitle media. If the value is 827 CLOSED-CAPTIONS, the Media Segments for the video Renditions can 828 include closed captions. Specifying a Playlist that does not contain 829 the appropriate media type can lead to client playback errors. This 830 attribute is REQUIRED. 832 URI 834 The value is a quoted-string containing a URI that identifies the 835 Playlist file. This attribute is OPTIONAL; see Section 4.3.4.2.1. 836 If the TYPE is CLOSED-CAPTIONS, the URI attribute MUST NOT be 837 present. 839 GROUP-ID 841 The value is a quoted-string which specifies the group to which the 842 Rendition belongs. See Section 4.3.4.1.1. This attribute is 843 REQUIRED. 845 LANGUAGE 847 The value is a quoted-string containing one of the standard Tags for 848 Identifying Languages [RFC5646], which identifies the primary 849 language used in the Rendition. This attribute is OPTIONAL. 851 ASSOC-LANGUAGE 853 The value is a quoted-string containing a language tag [RFC5646] that 854 identifies a language that is associated with the Rendition. An 855 associated language is often used in a different role than the 856 language specified by the LANGUAGE attribute (e.g. written vs. 857 spoken, or as a fallback dialect). This attribute is OPTIONAL. 859 NAME 861 The value is a quoted-string containing a human-readable description 862 of the Rendition. If the LANGUAGE attribute is present then this 863 description SHOULD be in that language. This attribute is REQUIRED. 865 DEFAULT 867 The value is an enumerated-string; valid strings are YES and NO. If 868 the value is YES, then the client SHOULD play this Rendition of the 869 content in the absence of information from the user indicating a 870 different choice. This attribute is OPTIONAL. Its absence indicates 871 an implicit value of NO. 873 AUTOSELECT 875 The value is an enumerated-string; valid strings are YES and NO. 876 This attribute is OPTIONAL. Its absence indicates an implicit value 877 of NO. If the value is YES, then the client MAY choose to play this 878 Rendition in the absence of explicit user preference because it 879 matches the current playback environment, such as chosen system 880 language. 882 If the AUTOSELECT attribute is present, its value MUST be YES if the 883 value of the DEFAULT attribute is YES. 885 FORCED 887 The value is an enumerated-string; valid strings are YES and NO. 888 This attribute is OPTIONAL. Its absence indicates an implicit value 889 of NO. The FORCED attribute MUST NOT be present unless the TYPE is 890 SUBTITLES. 892 A value of YES indicates that the Rendition contains content which is 893 considered essential to play. When selecting a FORCED Rendition, a 894 client SHOULD choose the one that best matches the current playback 895 environment (e.g. language). 897 A value of NO indicates that the Rendition contains content which is 898 intended to be played in response to explicit user request. 900 INSTREAM-ID 902 The value is a quoted-string that specifies a Rendition within the 903 segments in the Media Playlist. This attribute is REQUIRED if the 904 TYPE attribute is CLOSED-CAPTIONS, in which case it MUST have one of 905 the values: "CC1", "CC2", "CC3", "CC4", or "SERVICEn" where n MUST be 906 an integer between 1 and 63 (e.g."SERVICE3" or "SERVICE42"). 908 The values "CC1", "CC2", "CC3", and "CC4" identify a Line 21 Data 909 Services channel [CEA608]. The "SERVICE" values identify a Digital 910 Television Closed Captioning [CEA708] service block number. 912 For all other TYPE values, the INSTREAM-ID MUST NOT be specified. 914 CHARACTERISTICS 916 The value is a quoted-string containing one or more Uniform Type 917 Identifiers [UTI] separated by comma (,) characters. This attribute 918 is OPTIONAL. Each UTI indicates an individual characteristic of the 919 Rendition. 921 A SUBTITLES Rendition MAY include the following characteristics: 922 "public.accessibility.transcribes-spoken-dialog"; 923 "public.accessibility.describes-music-and-sound"; "public.easy-to- 924 read" (which indicates that the subtitles have been edited for ease 925 of reading). 927 An AUDIO Rendition MAY include the following characteristics: 928 "public.accessibility.describes-video". 930 The CHARACTERISTICS attribute MAY include private UTIs. 932 4.3.4.1.1. Rendition Groups 934 A set of EXT-X-MEDIA tags with the same GROUP-ID value and the same 935 TYPE value forms a group of Renditions. Each member of the group 936 MUST be an alternative rendition of the same content; otherwise 937 playback errors can occur. 939 All EXT-X-MEDIA tags in a Playlist MUST meet the following 940 constraints: 942 o All EXT-X-MEDIA tags in the same group MUST have different NAME 943 attributes. 945 o A group MUST NOT have more than one member with a DEFAULT 946 attribute of YES. 948 o All members of a group whose AUTOSELECT attribute has a value of 949 YES MUST have LANGUAGE [RFC5646] attributes with unique values. 951 A Playlist MAY contain multiple groups of the same TYPE in order to 952 provide multiple encodings of that media type. If it does so, each 953 group of the same TYPE MUST have the same set of members, and each 954 corresponding member MUST have identical attributes with the 955 exception of the URI attribute. 957 Each member in a group of Renditions MAY have a different sample 958 format. However, any EXT-X-STREAM-INF (Section 4.3.4.2) tag or EXT- 959 X-I-FRAME-STREAM-INF (Section 4.3.4.3) tag which references that 960 group MUST have a CODECS attribute that lists every sample format 961 present in any Rendition in the group, or client playback failures 962 can occur. 964 4.3.4.2. EXT-X-STREAM-INF 966 The EXT-X-STREAM-INF tag specifies a Variant Stream, which is a set 967 of Renditions which can be combined to play the presentation. The 968 attributes of the tag provide information about the Variant Stream. 970 The EXT-X-STREAM-INF tag identifies the next URI line in the Playlist 971 as a Rendition of the Variant Stream. 973 Its format is: 975 #EXT-X-STREAM-INF:<attribute-list> 976 <URI> 978 The following attributes are defined: 980 BANDWIDTH 982 The value is a decimal-integer of bits per second. It represents the 983 peak segment bit rate of the Variant Stream. 985 If all the Media Segments in a Variant Stream have already been 986 created, the BANDWIDTH value MUST be the largest sum of peak segment 987 bit rates that is produced by any playable combination of Renditions. 988 (For a Variant Stream with a single Media Playlist, this is just the 989 peak segment bit rate of that Media Playlist.) An inaccurate value 990 can cause playback stalls or prevent clients from playing the 991 variant. 993 If the Master Playlist is to be made available before all Media 994 Segments in the presentation have been encoded, the BANDWIDTH value 995 SHOULD be the BANDWIDTH value of a representative period of similar 996 content, encoded using the same settings. 998 Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. 1000 AVERAGE-BANDWIDTH 1002 The value is a decimal-integer of bits per second. It represents the 1003 average segment bit rate of the Variant Stream. 1005 If all the Media Segments in a Variant Stream have already been 1006 created, the AVERAGE-BANDWIDTH value MUST be the largest sum of 1007 average segment bit rates that is produced by any playable 1008 combination of Renditions. (For a Variant Stream with a single Media 1009 Playlist, this is just the average segment bit rate of that Media 1010 Playlist.) An inaccurate value can cause playback stalls or prevent 1011 clients from playing the variant. 1013 If the Master Playlist is to be made available before all Media 1014 Segments in the presentation have been encoded, the AVERAGE-BANDWIDTH 1015 value SHOULD be the AVERAGE-BANDWIDTH value of a representative 1016 period of similar content, encoded using the same settings. 1018 The AVERAGE-BANDWIDTH attribute is OPTIONAL. 1020 CODECS 1022 The value is a quoted-string containing a comma-separated list of 1023 formats, where each format specifies a media sample type that is 1024 present in one or more Renditions specified by the Variant Stream. 1025 Valid format identifiers are those in the ISO Base Media File Format 1026 Name Space defined by The 'Codecs' and 'Profiles' Parameters for 1027 "Bucket" Media Types [RFC6381]. 1029 Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. 1031 RESOLUTION 1033 The value is a decimal-resolution describing the optimal pixel 1034 resolution at which to display all the video in the Variant Stream. 1036 The RESOLUTION attribute is OPTIONAL but is recommended if the 1037 Variant Stream includes video. 1039 AUDIO 1041 The value is a quoted-string. It MUST match the value of the GROUP- 1042 ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist 1043 whose TYPE attribute is AUDIO. It indicates the set of audio 1044 Renditions that MAY be used when playing the presentation. See 1045 Section 4.3.4.2.1. 1047 The AUDIO attribute is OPTIONAL. 1049 VIDEO 1051 The value is a quoted-string. It MUST match the value of the GROUP- 1052 ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist 1053 whose TYPE attribute is VIDEO. It indicates the set of video 1054 Renditions that MAY be used when playing the presentation. See 1055 Section 4.3.4.2.1. 1057 The VIDEO attribute is OPTIONAL. 1059 SUBTITLES 1061 The value is a quoted-string. It MUST match the value of the GROUP- 1062 ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist 1063 whose TYPE attribute is SUBTITLES. It indicates the set of subtitle 1064 Renditions that MAY be used when playing the presentation. See 1065 Section 4.3.4.2.1. 1067 The SUBTITLES attribute is OPTIONAL. 1069 CLOSED-CAPTIONS 1071 The value can be either a quoted-string or an enumerated-string with 1072 the value NONE. If the value is a quoted-string, it MUST match the 1073 value of the GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in 1074 the Playlist whose TYPE attribute is CLOSED-CAPTIONS, and indicates 1075 the set of closed-caption Renditions that MAY be used when playlist 1076 the presentation. See Section 4.3.4.2.1. 1078 If the value is the enumerated-string value NONE, all EXT-X-STREAM- 1079 INF tags MUST have this attribute with a value of NONE, indicating 1080 that there are no closed captions in any Variant Stream in the Master 1081 Playlist. Having closed captions in one Variant Stream but not 1082 another can trigger playback inconsistencies. 1084 The CLOSED-CAPTIONS attribute is OPTIONAL. 1086 4.3.4.2.1. Alternative Renditions 1088 When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, SUBTITLES, or 1089 CLOSED-CAPTIONS attribute, it indicates that alternative Renditions 1090 of the content are available for playback of that Variant Stream. 1092 When defining alternative Renditions, the following constraints MUST 1093 be met to prevent client playback errors: 1095 o All playable combinations of Renditions associated with an EXT-X- 1096 STREAM-INF tag MUST have an aggregate bandwidth less than or equal 1097 to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. 1099 o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a 1100 VIDEO attribute, then every alternative video Rendition MUST have 1101 an optimal display resolution matching the value of the RESOLUTION 1102 attribute. 1104 o Every alternative Rendition associated with an EXT-X-STREAM-INF 1105 tag MUST meet the constraints for a Variant Stream described in 1106 Section 6.2.4. 1108 The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media 1109 type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. 1110 If the media type is VIDEO or AUDIO, a missing URI attribute 1111 indicates that the media data for this Rendition is included in the 1112 Media playlist of any EXT-X-STREAM-INF tag referencing this MEDIA 1113 tag. If the media type is AUDIO and the URI attribute is missing, 1114 clients MAY assume that the audio data for this Rendition is present 1115 in every video Rendition specified by the EXT-X-STREAM-INF tag. 1117 The URI attribute of the EXT-X-MEDIA tag MUST NOT be included if the 1118 media type is CLOSED-CAPTIONS. 1120 4.3.4.3. EXT-X-I-FRAME-STREAM-INF 1122 The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file 1123 containing the I-frames of a multimedia presentation. It stands 1124 alone, in that it does not apply to a particular URI in the Master 1125 Playlist. Its format is: 1127 #EXT-X-I-FRAME-STREAM-INF:<attribute-list> 1129 All attributes defined for the EXT-X-STREAM-INF tag (Section 4.3.4.2) 1130 are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the 1131 AUDIO, SUBTITLES and CLOSED-CAPTIONS attributes. In addition, the 1132 following attribute is defined: 1134 URI 1136 The value is a quoted-string containing a URI that identifies the 1137 I-frame Playlist file. 1139 Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute 1140 and a URI attribute. 1142 The provisions in Section 4.3.4.2.1 also apply to EXT-X-I-FRAME- 1143 STREAM-INF tags with a VIDEO attribute. 1145 A Master Playlist that specifies alternative VIDEO Renditions and 1146 I-frame Playlists SHOULD include an alternative I-frame VIDEO 1147 Rendition for each regular VIDEO Rendition, with the same NAME and 1148 LANGUAGE attributes. 1150 4.3.4.4. EXT-X-SESSION-DATA 1152 The EXT-X-SESSION-DATA tag allows arbitrary session data to be 1153 carried in a Master Playlist. 1155 Its format is: 1157 #EXT-X-SESSION-DATA:<attribute list> 1159 The following attributes are defined: 1161 DATA-ID 1163 The value of DATA-ID is a quoted-string which identifies that data 1164 value. The DATA-ID SHOULD conform to a reverse DNS naming 1165 convention, such as "com.example.movie.title". This attribute is 1166 REQUIRED. 1168 VALUE 1170 VALUE is a quoted-string. It contains the data identified by DATA- 1171 ID. If the LANGUAGE is specified, VALUE SHOULD contain a human- 1172 readable string written in the specified language. 1174 URI 1176 The value is a quoted-string containing a URI. The resource 1177 identified by the URI MUST be formatted as JSON [RFC7159]; otherwise, 1178 clients may fail to interpret the resource. 1180 LANGUAGE 1182 The value is a quoted-string containing a language tag [RFC5646] that 1183 identifies the language of the VALUE. This attribute is OPTIONAL. 1185 Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI 1186 attribute, but not both. 1188 A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same 1189 DATA-ID attribute. A Playlist MUST NOT contain more than one EXT-X- 1190 SESSION-DATA tag with the same DATA-ID attribute and the same 1191 LANGUAGE attribute. 1193 4.3.5. Media or Master Playlist Tags 1195 The tags in this section can appear in either Master Playlists or 1196 Media Playlists. If one of these tags appears in a Master Playlist, 1197 it SHOULD NOT appear in any Media Playlist referenced by that Master 1198 Playlist. A tag that appears in both MUST have the same value; 1199 otherwise, clients SHOULD ignore the value in the Media Playlist(s). 1201 These tags MUST NOT appear more than once in a Playlist. 1203 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS 1205 The EXT-X-INDEPENDENT-SEGMENTS tag indicates that all media samples 1206 in a Media Segment can be decoded without information from other 1207 segments. It applies to every Media Segment in the Playlist. 1209 Its format is: 1211 #EXT-X-INDEPENDENT-SEGMENTS 1213 If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master Playlist, 1214 it applies to every Media Segment in every Media Playlist in the 1215 Master Playlist. 1217 4.3.5.2. EXT-X-START 1219 The EXT-X-START tag indicates a preferred point at which to start 1220 playing a Playlist. By default, clients SHOULD start playback at 1221 this point when beginning a playback session. This tag is OPTIONAL. 1223 Its format is: 1225 #EXT-X-START:<attribute list> 1227 The following attributes are defined: 1229 TIME-OFFSET 1231 The value of TIME-OFFSET is a signed-decimal-floating-point number of 1232 seconds. A positive number indicates a time offset from the 1233 beginning of the Playlist. A negative number indicates a negative 1234 time offset from the end of the last Media Segment in the Playlist. 1235 This attribute is REQUIRED. 1237 The absolute value of TIME-OFFSET SHOULD NOT be larger than the 1238 Playlist duration. If the absolute value of TIME-OFFSET exceeds the 1239 duration of the Playlist, it indicates either the end of the Playlist 1240 (if positive) or the beginning of the Playlist (if negative). 1242 If the Playlist does not contain the EXT-X-ENDLIST tag, the TIME- 1243 OFFSET SHOULD NOT be within three target durations of the end of the 1244 Playlist file. 1246 PRECISE 1248 The value is an enumerated-string; valid strings are YES and NO. If 1249 the value is YES, clients SHOULD start playback at the Media Segment 1250 containing the TIME-OFFSET, but SHOULD NOT render media samples in 1251 that segment whose presentation times are prior to the TIME-OFFSET. 1252 If the value is NO, clients SHOULD attempt to render every media 1253 sample in that segment. This attribute is OPTIONAL. If it is 1254 missing, its value should be treated as NO. 1256 5. Key files 1258 5.1. Structure of Key files 1260 An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key 1261 file contains a cipher key that can decrypt Media Segments in the 1262 Playlist. 1264 [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an EXT- 1265 X-KEY tag is "identity", the Key file is a single packed array of 16 1266 octets in binary format. 1268 5.2. IV for [AES_128] 1270 [AES_128] REQUIRES the same 16-octet Initialization Vector (IV) to be 1271 supplied when encrypting and decrypting. Varying this IV increases 1272 the strength of the cipher. 1274 An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" 1275 specifies an Initialization Vector that can be used when decrypting 1276 Media Segments encrypted with that Key file. It is formatted as a 1277 128-bit unsigned integer. 1279 An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an 1280 IV attribute indicates that the Media Sequence Number is to be used 1281 as the IV when decrypting a Media Segment, by putting its big-endian 1282 binary representation into a 16-octet (128-bit) buffer and padding 1283 (on the left) with zeros. 1285 6. Client/Server Responsibilities 1287 6.1. Introduction 1289 This section describes how the server generates the Playlist and 1290 Media Segments and how the client should download them for playback. 1292 6.2. Server Responsibilities 1294 6.2.1. General Server Responsibilities 1296 The production of the source media is outside the scope of this 1297 document, which simply presumes a source of continuous encoded media 1298 containing the presentation. 1300 The server MUST divide the source media into individual Media 1301 Segments whose duration is less than or equal to a constant target 1302 duration. Segments that are longer than the planned target duration 1303 can trigger playback stalls and other errors. 1305 The server SHOULD attempt to divide the source media at points that 1306 support effective decode of individual Media Segments, e.g. on packet 1307 and key frame boundaries. 1309 The server MUST create a URI for every Media Segment that enables its 1310 clients to obtain the segment data. If a server supports partial 1311 loading of resources (e.g. via HTTP Range requests), it MAY specify 1312 segments as sub-ranges of larger resources using the EXT-X-BYTERANGE 1313 tag. 1315 Any Media Segment that is specified in a Playlist loaded by a client 1316 MUST be completely available at that time, or playback errors can 1317 occur. 1319 HTTP servers SHOULD transfer text files - such as Playlists and 1320 WebVTT segments - using the "gzip" Content-Encoding if the client 1321 indicates that it is prepared to accept it. 1323 The server must create a Media Playlist file (Section 4) that 1324 contains a URI for each Media Segment that the server wishes to make 1325 available, in the order in which they are to be played. 1327 The value of the EXT-X-VERSION tag (Section 4.3.1.2) SHOULD NOT be 1328 greater than what is required for the tags and attributes in the 1329 Playlist - see Section 7. 1331 Changes to the Playlist file MUST be made atomically from the point 1332 of view of the clients, or playback errors MAY occur. 1334 The server MUST NOT change the Media Playlist file, except to: 1336 Append lines to it (Section 6.2.1). 1338 Remove Media Segment URIs from the Playlist in the order that they 1339 appear, along with any tags that apply only to those segments 1340 (Section 6.2.2). 1342 Increment the value of the EXT-X-MEDIA-SEQUENCE or EXT-X- 1343 DISCONTINUITY-SEQUENCE tags (Section 6.2.2). 1345 Add an EXT-X-ENDLIST tag to the Playlist (Section 6.2.1). 1347 Furthermore, the Playlist file MAY contain an EXT-X-PLAYLIST-TYPE tag 1348 with a value of either EVENT or VOD. If the tag is present and has a 1349 value of EVENT, the server MUST NOT change or delete any part of the 1350 Playlist file (although it MAY append lines to it). If the tag is 1351 present and has a value of VOD, the Playlist file MUST NOT change. 1353 The value of the EXT-X-TARGETDURATION tag in the Media Playlist MUST 1354 NOT change. A typical target duration is 10 seconds. 1356 Unexpected Playlist changes MAY trigger playback errors or 1357 inconsistent client behavior. 1359 Each Media Segment in a Media Playlist has an integer Discontinuity 1360 Sequence Number. The Discontinuity Sequence Number can be used in 1361 addition to the timestamps within the media to synchronize Media 1362 Segments across different Renditions. 1364 A segment's Discontinuity Sequence Number is the value of the EXT-X- 1365 DISCONTINUITY-SEQUENCE tag (or zero if none) plus the number of EXT- 1366 X-DISCONTINUITY tags in the Playlist preceding the URI line of the 1367 segment. 1369 The server MAY associate an absolute date and time with a Media 1370 Segment by applying an EXT-X-PROGRAM-DATE-TIME tag to it. This 1371 defines an informative mapping of the (wall-clock) date and time 1372 specified by the tag to the first media timestamp in the segment, 1373 which may be used as a basis for seeking, for display, or for other 1374 purposes. If a server provides this mapping, it SHOULD apply an EXT- 1375 X-PROGRAM-DATE-TIME tag to every segment that has an EXT- 1376 X-DISCONTINUITY tag applied to it. 1378 If the Media Playlist contains the final Media Segment of the 1379 presentation then the Playlist file MUST contain the EXT-X-ENDLIST 1380 tag; this allows clients to minimize unproductive Playlist reloads. 1382 If a Media Playlist does not contain the EXT-X-ENDLIST tag, the 1383 server MUST make a new version of the Playlist file available that 1384 contains at least one new Media Segment. It MUST be made available 1385 relative to the time that the previous version of the Playlist file 1386 was made available: no earlier than one-half the target duration 1387 after that time, and no later than 1.5 times the target duration 1388 after that time. This allows clients to utilize the network 1389 efficiently. 1391 If the server wishes to remove an entire presentation, it SHOULD 1392 provide a clear indication to clients that the Playlist file is no 1393 longer available (e.g. with an HTTP 404 or 410 response). It MUST 1394 ensure that all Media Segments in the Playlist file remain available 1395 to clients for at least the duration of the Playlist file at the time 1396 of removal to prevent interruption of in-progress playback. 1398 6.2.2. Live Playlists 1400 The server MAY limit the availability of Media Segments by removing 1401 Media Segments from the Playlist file (Section 6.2.1). If Media 1402 Segments are to be removed, the Playlist file MUST contain an EXT-X- 1403 MEDIA-SEQUENCE tag. Its value MUST be incremented by 1 for every 1404 Media Segment that is removed from the Playlist file; it MUST NOT 1405 decrease or wrap. Clients can malfunction if each Media Segment does 1406 not have a consistent, unique Media Sequence Number. 1408 Media Segments MUST be removed from the Playlist file in the order 1409 that they appear in the Playlist; otherwise, client playback can 1410 malfunction. 1412 The server MUST NOT remove a Media Segment from a Playlist file 1413 without an EXT-X-ENDLIST tag if that would produce a Playlist whose 1414 duration is less than three times the target duration. Doing so can 1415 trigger playback stalls. 1417 When the server removes a Media Segment URI from the Playlist, the 1418 corresponding Media Segment MUST remain available to clients for a 1419 period of time equal to the duration of the segment plus the duration 1420 of the longest Playlist file distributed by the server containing 1421 that segment. Removing a Media Segment earlier than that can 1422 interrupt in-progress playback. 1424 If the server wishes to remove segments from a Media Playlist 1425 containing an EXT-X-DISCONTINUITY tag, the playlist MUST contain an 1426 EXT-X-DISCONTINUITY-SEQUENCE tag. Without the EXT-X-DISCONTINUITY- 1427 SEQUENCE tag, it can be impossible for a client to locate 1428 corresponding segments between Renditions. 1430 If the server removes an EXT-X-DISCONTINUITY tag from the Media 1431 Playlist, it MUST increment the value of the EXT-X-DISCONTINUITY- 1432 SEQUENCE tag so that the Discontinuity Sequence Numbers of the 1433 segments still in the playlist remain unchanged. The value of the 1434 EXT-X-DISCONTINUITY-SEQUENCE tag MUST NOT decrease or wrap. Clients 1435 can malfunction if each Media Segment does not have a consistent 1436 Discontinuity Sequence Number. 1438 If a server plans to remove a Media Segment after it is delivered to 1439 clients over HTTP, it SHOULD ensure that the HTTP response contains 1440 an Expires header that reflects the planned time-to-live. 1442 A Live Playlist MUST NOT contain the EXT-X-PLAYLIST-TYPE tag, as no 1443 value of that tag allows Media Segments to be removed. 1445 6.2.3. Encrypting Media Segments 1447 Media Segments MAY be encrypted. Every encrypted Media Segment MUST 1448 have an EXT-X-KEY tag (Section 4.3.2.4) applied to it with a URI that 1449 the client can use to obtain a Key file (Section 5) containing the 1450 decryption key. A Media Segment MAY have multiple EXT-X-KEY tags, 1451 each with a different KEYFORMAT attribute value. 1453 The server MAY set the HTTP Expires header in the key response to 1454 indicate that the key can be cached. 1456 If an encrypted Media Segment is followed by one or more unencrypted 1457 Media Segments in the Playlist, the unencrypted Media Segments MUST 1458 have an EXT-X-KEY tag whose METHOD is NONE applied to them. 1459 Otherwise, the client will misinterpret those segments as encrypted. 1461 If the encryption METHOD is AES-128 and the Playlist does not contain 1462 the EXT-X-I-FRAMES-ONLY tag, AES encryption as described in 1463 Section 4.3.2.4 SHALL be applied to individual Media Segments. 1465 If the encryption METHOD is AES-128 and the Playlist contains an EXT- 1466 X-I-FRAMES-ONLY tag, the entire resource MUST be encrypted using 1467 AES-128 CBC with PKCS7 padding [RFC5652]. Encryption MAY be 1468 restarted on 16-byte block boundaries, unless the first block 1469 contains an I-frame. The IV used for encryption MUST be either the 1470 Media Sequence Number of the Media Segment or the value of the IV 1471 attribute of the EXT-X-KEY tag, as described in Section 5.2. These 1472 constraints allow a client to load and decrypt individual I-frames 1473 specified as sub-ranges of regular encrypted Media Segments, and 1474 their Media Initialization Sections. 1476 If the encryption METHOD is SAMPLE-AES, media samples MAY be 1477 encrypted prior to encapsulation in a Media Segment. The encryption 1478 format for H.264, AAC and AC-3 media streams is described by 1479 [SampleEnc]. 1481 The server MUST NOT remove an EXT-X-KEY tag from the Playlist file if 1482 it applies to any Media Segment in the Playlist file, or clients who 1483 subsequently load that Playlist will be unable to decrypt those Media 1484 Segments. 1486 6.2.4. Providing Variant Streams 1488 A server MAY offer multiple Media Playlist files to provide different 1489 encodings of the same presentation. If it does so it SHOULD provide 1490 a Master Playlist file that lists each Variant Stream to allow 1491 clients to switch between encodings dynamically. 1493 Master Playlists describe regular Variant Streams with EXT-X-STREAM- 1494 INF tags and I-frame Variant Streams with EXT-X-I-FRAME-STREAM-INF 1495 tags. 1497 If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains 1498 the CODECS attribute, the attribute value MUST include every media 1499 format [RFC6381] present in any Media Segment in any of the 1500 Renditions specified by the Variant Stream. 1502 The server MUST meet the following constraints when producing Variant 1503 Streams in order to allow clients to switch between them seamlessly: 1505 Each Variant Stream MUST present the same content. 1507 Matching content in Variant Streams MUST have matching timestamps. 1508 This allows clients to synchronize the media. 1510 Matching content in Variant Streams MUST have matching 1511 Discontinuity Sequence Numbers - see Section 4.3.3.3. 1513 Each Media Playlist in each Variant Stream MUST have the same 1514 target duration. The only exception is that SUBTITLES Renditions 1515 with an EXT-X-PLAYLIST-TYPE of VOD MAY have longer target 1516 durations. 1518 Content that appears in a Media Playlist of one Variant Stream but 1519 not in another MUST appear either at the beginning or at the end 1520 of the Media Playlist file and MUST NOT be longer than the target 1521 duration. 1523 If any Media Playlist in a Master Playlist contains an EXT-X- 1524 PROGRAM-DATE-TIME tag, then all Media Playlists in that Master 1525 Playlist MUST contain EXT-X-PROGRAM-DATE-TIME tags with consistent 1526 mappings of date and time to media timestamps. 1528 In addition, for broadest compatibility, Variant Streams SHOULD 1529 contain the same encoded audio bitstream. This allows clients to 1530 switch between Variant Streams without audible glitching. 1532 The rules for Variant Streams also apply to alternative Renditions - 1533 see Section 4.3.4.2.1. 1535 6.3. Client Responsibilities 1537 6.3.1. General Client Responsibilities 1539 How the client obtains the URI to the Playlist file is outside the 1540 scope of this document; it is presumed to have done so. 1542 The client obtains the Playlist file from the URI. If the Playlist 1543 file so obtained is a Master Playlist, the client can select a 1544 Variant Stream to load from the Master Playlist. 1546 Clients MUST ensure that loaded Playlists comply with Section 4 and 1547 that the EXT-X-VERSION tag, if present, specifies a protocol version 1548 supported by the client; if either check fails, the client MUST NOT 1549 attempt to use the Playlist, or unintended behavior could occur. 1551 To support forward compatibility, when parsing Playlists, Clients 1552 MUST: 1554 o ignore any unrecognized tags. 1556 o ignore any Attribute/value pair with an unrecognized 1557 AttributeName. 1559 o ignore any tag containing an attribute/value pair of type 1560 enumerated-string whose AttributeName is recognized but whose 1561 AttributeValue is not recognized, unless the definition of the 1562 attribute says otherwise. 1564 This document does not specify the treatment of Variant Streams by 1565 clients. 1567 6.3.2. Loading the Media Playlist file 1569 Every time a Media Playlist is loaded or reloaded from a Playlist 1570 URI, the client MUST determine the next Media Segment to load, as 1571 described in Section 6.3.5, if it intends to play the presentation 1572 normally (i.e., in playlist order at the nominal playback rate). 1574 If the Media Playlist contains the EXT-X-MEDIA-SEQUENCE tag, the 1575 client SHOULD assume that each Media Segment in it will become 1576 unavailable at the time that the Playlist file was loaded plus the 1577 duration of the Playlist file. 1579 A client MAY use the segment Media Sequence Number to track the 1580 location of a Media Segment within a Playlist when the Playlist is 1581 reloaded. 1583 A client MUST NOT assume that segments with the same Media Sequence 1584 Number in different Variant Streams or Renditions have the same 1585 position in the presentation; Playlists MAY have independent Media 1586 Sequence Numbers. Instead, a client MUST use the relative position 1587 of each segment on the Playlist timeline and its Discontinuity 1588 Sequence Number to locate corresponding segments. 1590 A client MUST load the Media Playlist file of every Rendition 1591 selected for playback in order to locate the media specific to that 1592 Rendition. But it SHOULD NOT load the Playlist file of any other 1593 Rendition to prevent unnecessary load on the server. 1595 For some Variant Streams, it is possible to select Renditions such 1596 that the Media Playlist to which the EXT-X-STREAM-INF tag is applied 1597 contains none of the media selected for playback. In that case, the 1598 client SHOULD NOT load that Media Playlist file. 1600 6.3.3. Playing the Media Playlist file 1602 The client SHALL choose which Media Segment to play first from the 1603 Media Playlist when playback starts. If the EXT-X-ENDLIST tag is not 1604 present and the client intends to play the media normally, the client 1605 SHOULD NOT choose a segment which starts less than three target 1606 durations from the end of the Playlist file. Doing so can trigger 1607 playback stalls. 1609 Normal playback can be achieved by playing the Media Segments in the 1610 order that they appear in the Playlist. The client MAY present the 1611 available media in any way it wishes, including normal playback, 1612 random access, and trick modes. 1614 The encoding parameters for samples in a Media Segment and across 1615 multiple Media Segments in a Media Playlist SHOULD remain consistent. 1616 However, clients SHOULD deal with encoding changes as they are 1617 encountered, for example by scaling video content to accommodate a 1618 resolution change. If the Variant Stream includes a RESOLUTION 1619 attribute, clients SHOULD display all video within a rectangle with 1620 the same proportions as that resolution. 1622 Clients SHOULD be prepared to handle multiple tracks of a particular 1623 type (e.g. audio or video). A client with no other preference SHOULD 1624 choose the track with the lowest numerical track identifier that it 1625 can play. 1627 Clients SHOULD ignore private streams inside Transport Streams that 1628 they do not recognize to support cross-device addressability. 1630 The client MUST be prepared to reset its parser(s) and decoder(s) 1631 before playing a Media Segment that has an EXT-X-DISCONTINUITY tag 1632 applied to it, otherwise playback errors can occur. 1634 The client SHOULD attempt to load Media Segments in advance of when 1635 they will be required for uninterrupted playback to compensate for 1636 temporary variations in latency and throughput. 1638 The client MAY use the value of the EXT-X-PROGRAM-DATE-TIME tag to 1639 display the program origination time to the user. If the value 1640 includes time zone information, the client SHALL take it into 1641 account; if it does not the client MAY assume the time to be local. 1643 The client MUST NOT depend upon the correctness or the consistency of 1644 the value of the EXT-X-PROGRAM-DATE-TIME tag; its value is 1645 informative. 1647 6.3.4. Reloading the Media Playlist file 1649 The client MUST periodically reload a Media Playlist file to learn 1650 what media is currently available, unless it contains an EXT-X- 1651 PLAYLIST-TYPE tag with a value of VOD, or a value of EVENT and the 1652 EXT-X-ENDLIST tag is also present. 1654 However the client MUST NOT attempt to reload the Playlist file more 1655 frequently than specified by this section, in order to limit the 1656 collective load on the server. 1658 When a client loads a Playlist file for the first time or reloads a 1659 Playlist file and finds that it has changed since the last time it 1660 was loaded, the client MUST wait for at least the target duration 1661 before attempting to reload the Playlist file again, measured from 1662 the last time the client began loading the Playlist file. 1664 If the client reloads a Playlist file and finds that it has not 1665 changed then it MUST wait for a period of one-half the target 1666 duration before retrying. 1668 After reloading a Media Playlist, the client SHOULD verify that each 1669 Media Segment in it has the same URI (and byte range, if specified) 1670 as the Media Segment with the same Media Sequence Number in the 1671 previous Media Playlist. It SHOULD halt playback if it does not, as 1672 this normally indicates a server error. 1674 In order to reduce server load, the client SHOULD NOT reload the 1675 Playlist files of Variant Streams or alternate Renditions that are 1676 not currently being played. If it decides to switch playback to a 1677 different Variant Stream, it SHOULD stop reloading the Playlist of 1678 the old Variant Stream and begin loading the Playlist of the new 1679 Variant Stream. It can use the EXTINF durations and the constraints 1680 in Section 6.2.4 to determine the approximate location of 1681 corresponding media. Once media from the new Variant Stream has been 1682 loaded, the timestamps in the Media Segments can be used to 1683 synchronize the old and new timelines precisely. 1685 A client MUST NOT attempt to use the Media Sequence Number to 1686 synchronize between streams - see Section 6.3.2. 1688 6.3.5. Determining the next segment to load 1690 The client MUST examine the Media Playlist file every time it is 1691 loaded or reloaded to determine the next Media Segment to load, as 1692 the set of available media MAY have changed. 1694 The first segment to load is generally the segment that the client 1695 has chosen to play first - see Section 6.3.3. 1697 In order to play the presentation normally, the next Media Segment to 1698 load is the one with the lowest Media Sequence Number that is greater 1699 than the Media Sequence Number of the last Media Segment loaded. 1701 6.3.6. Decrypting encrypted Media Segments 1703 If a Media Playlist file contains an EXT-X-KEY tag that specifies a 1704 Key file URI, the client can obtain that Key file and use the key 1705 inside it to decrypt all Media Segments to which that EXT-X-KEY tag 1706 applies. 1708 A client MUST ignore any EXT-X-KEY tag with an unsupported or 1709 unrecognized KEYFORMAT attribute, to allow for cross-device 1710 addressibility. If the Playlist contains a Media Segment to which 1711 only EXT-X-KEY tags with unrecognized or unsupported KEYFORMAT 1712 attributes are applied, playback SHOULD fail. 1714 A client MUST NOT not attempt to decrypt any segments whose EXT-X-KEY 1715 tag has a METHOD attribute that it does not recognize. 1717 If the encryption METHOD is AES-128, AES-128 CBC decryption SHALL be 1718 applied to individual Media Segments, whose encryption format is 1719 described in Section 4.3.2.4. 1721 If the encryption METHOD is AES-128 and the Media Segment is part of 1722 an I-frame playlist (Section 4.3.3.6) and it has an EXT-X-BYTERANGE 1723 tag applied to it, special care needs to be taken in loading and 1724 decrypting the segment, because the resource identified by the URI is 1725 encrypted in 16-byte blocks from the start of the resource (offset 1726 0). The decrypted I-frame can be recovered by first widening its 1727 byte range, as specified by the EXT-X-BYTERANGE tag, so that it 1728 starts and ends on 16-byte boundaries. Next, the byte range is 1729 widened further to include the previous 16-byte block. That byte 1730 range is then loaded and decrypted with AES-128 CBC using an 1731 arbitrary IV. The decrypted I-frame can then be read out from the 1732 range specified by the EXT-X-BYTERANGE tag and the remainder 1733 discarded. 1735 If the encryption METHOD is SAMPLE-AES, AES-128 decryption SHALL be 1736 applied to encrypted media samples within the Media Segment. The 1737 format for encrypted H.264, AAC and AC-3 media streams is described 1738 by [SampleEnc]. 1740 An EXT-X-KEY tag with a METHOD of NONE indicates that the Media 1741 Segments it applies to are not encrypted. 1743 7. Protocol version compatibility 1745 Protocol compatibility is specified by the EXT-X-VERSION tag. A 1746 Playlist that contains tags or attributes that are not compatible 1747 with protocol version 1 MUST include an EXT-X-VERSION tag. The value 1748 of the EXT-X-VERSION tag MUST be a protocol version that defines all 1749 tags and attributes in the Playlist; otherwise, client behavior is 1750 not defined. 1752 A client MUST NOT attempt playback if it does not support the 1753 protocol version specified by the EXT-X-VERSION tag, or unintended 1754 behavior could occur. 1756 A Media Playlist REQUIRES protocol version 2 or higher if it 1757 contains: 1759 o The IV attribute of the EXT-X-KEY tag. 1761 A Media Playlist REQUIRES protocol version 3 or higher if it 1762 contains: 1764 o Floating-point EXTINF duration values. 1766 A Media Playlist REQUIRES protocol version 4 or higher if it 1767 contains: 1769 o The EXT-X-BYTERANGE tag. 1771 o The EXT-X-I-FRAMES-ONLY tag. 1773 A Media Playlist REQUIRES protocol version 5 or higher if it 1774 contains: 1776 o The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY 1777 tag. 1779 o The EXT-X-MAP tag. 1781 A Media Playlist REQUIRES protocol version 6 or higher if it 1782 contains: 1784 o The EXT-X-MAP tag in a Media playlist that does not contain EXT- 1785 X-I-FRAMES-ONLY. 1787 A Media Playlist REQUIRES protocol version 7 or higher if it 1788 contains: 1790 o "SERVICE" values for the INSTREAM-ID attribute for the EXT-X-MEDIA 1791 tag. 1793 The EXT-X-MEDIA tag and the AUDIO, VIDEO and SUBTITLES attributes of 1794 the EXT-X-STREAM-INF tag are backward compatible to protocol version 1795 1, but playback on older clients may not be desirable. A server MAY 1796 consider indicating protocol version 4 in the Master Playlist but is 1797 not required to do so. 1799 The PROGRAM-ID attribute of the EXT-X-STREAM-INF and the EXT-X-I- 1800 FRAME-STREAM-INF tags was removed in protocol version 6. 1802 The EXT-X-ALLOW-CACHE tag was removed in protocol version 7. 1804 8. Playlist Examples 1806 8.1. Simple Media Playlist 1808 #EXTM3U 1809 #EXT-X-TARGETDURATION:10 1810 #EXTINF:9.009, 1811 http://media.example.com/first.ts 1812 #EXTINF:9.009, 1813 http://media.example.com/second.ts 1814 #EXTINF:3.003, 1815 http://media.example.com/third.ts 1816 #EXT-X-ENDLIST 1818 8.2. Live Media Playlist, using HTTPS 1820 #EXTM3U 1821 #EXT-X-VERSION:3 1822 #EXT-X-TARGETDURATION:8 1823 #EXT-X-MEDIA-SEQUENCE:2680 1825 #EXTINF:7.975, 1826 https://priv.example.com/fileSequence2680.ts 1827 #EXTINF:7.941, 1828 https://priv.example.com/fileSequence2681.ts 1829 #EXTINF:7.975, 1830 https://priv.example.com/fileSequence2682.ts 1832 8.3. Playlist with encrypted Media Segments 1833 #EXTM3U 1834 #EXT-X-VERSION:3 1835 #EXT-X-MEDIA-SEQUENCE:7794 1836 #EXT-X-TARGETDURATION:15 1838 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" 1840 #EXTINF:2.833, 1841 http://media.example.com/fileSequence52-A.ts 1842 #EXTINF:15.0, 1843 http://media.example.com/fileSequence52-B.ts 1844 #EXTINF:13.333, 1845 http://media.example.com/fileSequence52-C.ts 1847 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" 1849 #EXTINF:15.0, 1850 http://media.example.com/fileSequence53-A.ts 1852 8.4. Master Playlist 1854 #EXTM3U 1855 #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000 1856 http://example.com/low.m3u8 1857 #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000 1858 http://example.com/mid.m3u8 1859 #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000 1860 http://example.com/hi.m3u8 1861 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 1862 http://example.com/audio-only.m3u8 1864 8.5. Master Playlist with I-Frames 1866 #EXTM3U 1867 #EXT-X-STREAM-INF:BANDWIDTH=1280000 1868 low/audio-video.m3u8 1869 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=86000,URI="low/iframe.m3u8" 1870 #EXT-X-STREAM-INF:BANDWIDTH=2560000 1871 mid/audio-video.m3u8 1872 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=150000,URI="mid/iframe.m3u8" 1873 #EXT-X-STREAM-INF:BANDWIDTH=7680000 1874 hi/audio-video.m3u8 1875 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=550000,URI="hi/iframe.m3u8" 1876 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 1877 audio-only.m3u8 1879 8.6. Master Playlist with Alternative audio 1881 In this example, the CODECS attributes have been condensed for space. 1882 A '\' is used to indicate that the tag continues on the following 1883 line with whitespace removed: 1885 #EXTM3U 1886 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \ 1887 DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \ 1888 URI="main/english-audio.m3u8" 1889 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \ 1890 DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \ 1891 URI="main/german-audio.m3u8" 1892 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", \ 1893 DEFAULT=NO,AUTOSELECT=NO,LANGUAGE="en", \ 1894 URI="commentary/audio-only.m3u8" 1895 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac" 1896 low/video-only.m3u8 1897 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac" 1898 mid/video-only.m3u8 1899 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac" 1900 hi/video-only.m3u8 1901 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac" 1902 main/english-audio.m3u8 1904 8.7. Master Playlist with Alternative video 1906 In this example, the CODECS attributes have been condensed for space. 1907 A '\' is used to indicate that the tag continues on the following 1908 line with whitespace removed: 1910 #EXTM3U 1911 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main", \ 1912 DEFAULT=YES,URI="low/main/audio-video.m3u8" 1913 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield", \ 1914 DEFAULT=NO,URI="low/centerfield/audio-video.m3u8" 1915 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Dugout", \ 1916 DEFAULT=NO,URI="low/dugout/audio-video.m3u8" 1918 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",VIDEO="low" 1919 low/main/audio-video.m3u8 1921 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Main", \ 1922 DEFAULT=YES,URI="mid/main/audio-video.m3u8" 1923 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Centerfield", \ 1924 DEFAULT=NO,URI="mid/centerfield/audio-video.m3u8" 1925 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Dugout", \ 1926 DEFAULT=NO,URI="mid/dugout/audio-video.m3u8" 1928 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",VIDEO="mid" 1929 mid/main/audio-video.m3u8 1931 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Main", \ 1932 DEFAULT=YES,URI="hi/main/audio-video.m3u8" 1933 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Centerfield", \ 1934 DEFAULT=NO,URI="hi/centerfield/audio-video.m3u8" 1935 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Dugout", \ 1936 DEFAULT=NO,URI="hi/dugout/audio-video.m3u8" 1938 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",VIDEO="hi" 1939 hi/main/audio-video.m3u8 1941 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 1942 main/audio-only.m3u8 1944 8.8. Session Data in a Master Playlist 1946 In this example, only the EXT-X-SESSION-DATA is shown: 1948 #EXT-X-SESSION-DATA:DATA-ID="com.example.lyrics",URI="lyrics.json" 1950 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="en", \ 1951 VALUE="This is an example" 1952 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="sp", \ 1953 VALUE="Este es un ejemplo" 1955 9. Contributors 1957 Significant contributions to the design of this protocol were made by 1958 Jim Batson, David Biderman, Bill May, Roger Pantos, Alan Tseng, and 1959 Eryk Vershen. 1961 10. IANA Considerations 1963 This memo requests that the following MIME type [RFC2046] be 1964 registered with the IANA: 1966 Type name: "application" 1968 Subtype name: "vnd.apple.mpegurl" 1970 Required parameters: (none) 1972 Optional parameters: (none) 1974 Encoding considerations: encoded as text. See Section 4 for more 1975 information. 1977 Security considerations: See Section 11. 1979 Compression: this media type does not employ compression. 1981 Interoperability considerations: There are no byte-ordering issues, 1982 since files are 7- or 8-bit text. Applications could encounter 1983 unrecognized tags, which SHOULD be ignored. 1985 Published specification: see Section 4. 1987 Applications that use this media type: Multimedia applications such 1988 as the iPhone media player in iOS 3.0 and later and QuickTime Player 1989 in Mac OS X version 10.6 and later. 1991 Additional information: files begin with the magic number #EXTM3U. 1992 Filenames normally end with .m3u8 or .m3u (see Section 4). No 1993 Macintosh file type codes have been registered. 1995 Person & email address to contact for further information: David 1996 Singer, singer AT apple.com. 1998 Intended usage: LIMITED USE 2000 Restrictions on usage: (none) 2002 Author: Roger Pantos 2003 Change Controller: David Singer 2005 11. Security Considerations 2007 Since the protocol generally uses HTTP to transfer data, most of the 2008 same security considerations apply. See section 15 of HTTP 2009 [RFC7230]. 2011 Media file parsers are typically subject to "fuzzing" attacks. 2012 Implementors SHOULD pay particular attention to code that will parse 2013 data received from a server and ensure that all possible inputs are 2014 handled correctly. 2016 Playlist files contain URIs, which clients will use to make network 2017 requests of arbitrary entities. Clients SHOULD range-check responses 2018 to prevent buffer overflows. See also the Security Considerations 2019 section of Uniform Resource Identifier (URI): Generic Syntax 2020 [RFC3986]. 2022 Clients SHOULD limit each playback session to a reasonable number of 2023 concurrent downloads (e.g. 4) to avoid contributing to denial-of- 2024 service attacks. 2026 HTTP requests often include session state ("cookies"), which may 2027 contain private user data. Implementations MUST follow cookie 2028 restriction and expiry rules specified by HTTP State Management 2029 Mechanism [RFC6265] to protect themselves from attack. See also the 2030 Security Considerations section of that document, and Use of HTTP 2031 State Management [RFC2964]. 2033 Encryption keys are specified by URI. The delivery of these keys 2034 SHOULD be secured by a mechanism such as HTTP Over TLS [RFC2818] 2035 (formerly SSL) in conjunction with a secure realm or a session token. 2037 12. References 2039 12.1. Normative References 2041 [AC_3] Advanced Television Systems Committee, "ATSC Standard: 2042 A/52:2010: Digital Audio Compression (AC-3) (E-AC-3) 2043 Standard", November 2010, 2044 <http://www.atsc.org/cms/standards/a_52-2010.pdf>. 2046 [AES_128] U.S. Department of Commerce/National Institute of 2047 Standards and Technology, "Advanced Encryption Standard 2048 (AES), FIPS PUB 197", November 2001, 2049 <http://csrc.nist.gov/publications/fips/fips197/ 2050 fips-197.pdf>. 2052 [CEA608] Consumer Electronics Association, "CEA-608-E: Line 21 Data 2053 Services", April 2008, <http://www.ce.org/Standards/ 2054 Standard-Listings/R4-3-Television-Data-Systems- 2055 Subcommittee/Line-21-Data-Service.aspx>. 2057 [CEA708] Consumer Electronics Association, "CEA-708-E (ANSI): 2058 Digital Television (DTV) Closed Captioning", August 2013, 2059 <http://www.ce.org/Standards/Standard-Listings/ 2060 R4-3-Television-Data-Systems-Subcommittee/CEA-708-D.aspx>. 2062 [H_264] International Telecommunications Union, "Advanced video 2063 coding for generic audiovisual services", January 2012, 2064 <http://www.itu.int/rec/T-REC-H.264>. 2066 [ISO_11172] 2067 International Organization for Standardization, "ISO/IEC 2068 International Standard 11172-1; Coding of moving pictures 2069 and associated audio for digital storage media -- Part 1: 2070 Systems", 1993, 2071 <http://www.iso.org/iso/catalogue_detail?csnumber=19180>. 2073 [ISO_13818] 2074 International Organization for Standardization, "ISO/IEC 2075 International Standard 13818; Generic coding of moving 2076 pictures and associated audio information", October 2007, 2077 <http://www.iso.org/iso/catalogue_detail?csnumber=44169>. 2079 [ISO_14496] 2080 International Organization for Standardization, "ISO/IEC 2081 14496-3:2009 Information technology -- Coding of audio- 2082 visual objects -- Part 3: Audio", 2009, 2083 <http://www.iso.org/iso/catalogue_detail?csnumber=53943>. 2085 [ISO_8601] 2086 International Organization for Standardization, "ISO/IEC 2087 International Standard 8601:2004; Data elements and 2088 interchange formats -- Information interchange -- 2089 Representation of dates and times", December 2004, 2090 <http://www.iso.org/iso/catalogue_detail?csnumber=40874>. 2092 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2093 Extensions (MIME) Part Two: Media Types", RFC 2046, 2094 November 1996. 2096 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2097 Requirement Levels", BCP 14, RFC 2119, March 1997. 2099 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 2101 [RFC2964] Moore, K. and N. Freed, "Use of HTTP State Management", 2102 BCP 44, RFC 2964, October 2000. 2104 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2105 10646", STD 63, RFC 3629, November 2003. 2107 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2108 Resource Identifier (URI): Generic Syntax", STD 66, RFC 2109 3986, January 2005. 2111 [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying 2112 Languages", BCP 47, RFC 5646, September 2009. 2114 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 2115 RFC 5652, September 2009. 2117 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2118 April 2011. 2120 [RFC6381] Gellens, R., Singer, D., and P. Frojdh, "The 'Codecs' and 2121 'Profiles' Parameters for "Bucket" Media Types", RFC 6381, 2122 August 2011. 2124 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 2125 Interchange Format", RFC 7159, March 2014. 2127 [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol 2128 (HTTP/1.1): Message Syntax and Routing", RFC 7230, June 2129 2014. 2131 [US_ASCII] 2132 American National Standards Institute, "ANSI X3.4-1986, 2133 Information Systems -- Coded Character Sets 7-Bit American 2134 National Standard Code for Information Interchange (7-Bit 2135 ASCII)", December 1986. 2137 [WebVTT] World Wide Web Consortium (W3C), "WebVTT: The Web Video 2138 Text Tracks Format", July 2013, 2139 <http://dev.w3.org/html5/webvtt/>. 2141 12.2. Informative References 2143 [ID3] ID3.org, "The ID3 audio file data tagging format", 2144 <http://www.id3.org/Developer_Information>. 2146 [M3U] Nullsoft, Inc., "The M3U Playlist format, originally 2147 invented for the Winamp media player", 2148 <http://wikipedia.org/wiki/M3U>. 2150 [SampleEnc] 2151 Apple Inc., "MPEG-2 Stream Encryption Format for HTTP Live 2152 Streaming", 2153 <https://developer.apple.com/library/ios/documentation/ 2154 AudioVideo/Conceptual/HLS_Sample_Encryption/>. 2156 [UTI] Apple Inc., "Uniform Type Identifier", <http://developer.a 2157 pple.com/library/ios/#documentation/general/conceptual/ 2158 DevPedia-CocoaCore/UniformTypeIdentifier.html>. 2160 Authors' Addresses 2162 Roger Pantos (editor) 2163 Apple Inc. 2164 Cupertino, California 2165 United States 2167 Email: http-live-streaming-review@group.apple.com 2169 William May, Jr. 2170 Apple Inc. 2171 Cupertino, California 2172 United States 2174 Email: http-live-streaming-review@group.apple.com