idnits 2.17.1 draft-pantos-http-live-streaming-23.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(i) Publication Limitation clause. 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 (May 22, 2017) is 2531 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 Apple Inc. 4 Intended status: Informational W. May 5 Expires: November 23, 2017 Major League Baseball Advanced Media 6 May 22, 2017 8 HTTP Live Streaming 9 draft-pantos-http-live-streaming-23 11 Abstract 13 This document describes a protocol for transferring unbounded streams 14 of multimedia data. It specifies the data format of the files and 15 the actions to be taken by the server (sender) and the clients 16 (receivers) of the streams. It describes version 7 of this protocol. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at http://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on November 23, 2017. 35 Copyright Notice 37 Copyright (c) 2017 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (http://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. 47 This Informational Internet Draft is submitted as an RFC Editor 48 Contribution and/or non-IETF Document (not as a Contribution, IETF 49 Contribution, nor IETF Document) in accordance with BCP 78 and BCP 50 79. 52 This document may not be modified, and derivative works of it may not 53 be created, except to format it for publication as an RFC or to 54 translate it into languages other than English. 56 Table of Contents 58 1. Introduction to HTTP Live Streaming . . . . . . . . . . . . . 4 59 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4 60 3. Media Segments . . . . . . . . . . . . . . . . . . . . . . . 6 61 3.1. Supported Media Segment Formats . . . . . . . . . . . . . 6 62 3.2. MPEG-2 Transport Streams . . . . . . . . . . . . . . . . 7 63 3.3. Fragmented MPEG-4 . . . . . . . . . . . . . . . . . . . . 7 64 3.4. Packed Audio . . . . . . . . . . . . . . . . . . . . . . 8 65 3.5. WebVTT . . . . . . . . . . . . . . . . . . . . . . . . . 8 66 4. Playlists . . . . . . . . . . . . . . . . . . . . . . . . . . 9 67 4.1. Definition of a Playlist . . . . . . . . . . . . . . . . 9 68 4.2. Attribute Lists . . . . . . . . . . . . . . . . . . . . . 10 69 4.3. Playlist Tags . . . . . . . . . . . . . . . . . . . . . . 12 70 4.3.1. Basic Tags . . . . . . . . . . . . . . . . . . . . . 12 71 4.3.1.1. EXTM3U . . . . . . . . . . . . . . . . . . . . . 12 72 4.3.1.2. EXT-X-VERSION . . . . . . . . . . . . . . . . . . 12 73 4.3.2. Media Segment Tags . . . . . . . . . . . . . . . . . 13 74 4.3.2.1. EXTINF . . . . . . . . . . . . . . . . . . . . . 13 75 4.3.2.2. EXT-X-BYTERANGE . . . . . . . . . . . . . . . . . 13 76 4.3.2.3. EXT-X-DISCONTINUITY . . . . . . . . . . . . . . . 14 77 4.3.2.4. EXT-X-KEY . . . . . . . . . . . . . . . . . . . . 14 78 4.3.2.5. EXT-X-MAP . . . . . . . . . . . . . . . . . . . . 16 79 4.3.2.6. EXT-X-PROGRAM-DATE-TIME . . . . . . . . . . . . . 17 80 4.3.2.7. EXT-X-DATERANGE . . . . . . . . . . . . . . . . . 17 81 4.3.2.7.1. Mapping SCTE-35 into EXT-X-DATERANGE . . . . 19 82 4.3.3. Media Playlist Tags . . . . . . . . . . . . . . . . . 21 83 4.3.3.1. EXT-X-TARGETDURATION . . . . . . . . . . . . . . 21 84 4.3.3.2. EXT-X-MEDIA-SEQUENCE . . . . . . . . . . . . . . 22 85 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE . . . . . . . . . . 22 86 4.3.3.4. EXT-X-ENDLIST . . . . . . . . . . . . . . . . . . 23 87 4.3.3.5. EXT-X-PLAYLIST-TYPE . . . . . . . . . . . . . . . 23 88 4.3.3.6. EXT-X-I-FRAMES-ONLY . . . . . . . . . . . . . . . 23 89 4.3.4. Master Playlist Tags . . . . . . . . . . . . . . . . 24 90 4.3.4.1. EXT-X-MEDIA . . . . . . . . . . . . . . . . . . . 24 91 4.3.4.1.1. Rendition Groups . . . . . . . . . . . . . . 27 92 4.3.4.2. EXT-X-STREAM-INF . . . . . . . . . . . . . . . . 28 93 4.3.4.2.1. Alternative Renditions . . . . . . . . . . . 31 94 4.3.4.3. EXT-X-I-FRAME-STREAM-INF . . . . . . . . . . . . 32 95 4.3.4.4. EXT-X-SESSION-DATA . . . . . . . . . . . . . . . 33 96 4.3.4.5. EXT-X-SESSION-KEY . . . . . . . . . . . . . . . . 34 97 4.3.5. Media or Master Playlist Tags . . . . . . . . . . . . 34 98 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS . . . . . . . . . . . 34 99 4.3.5.2. EXT-X-START . . . . . . . . . . . . . . . . . . . 35 100 5. Key files . . . . . . . . . . . . . . . . . . . . . . . . . . 36 101 5.1. Structure of Key files . . . . . . . . . . . . . . . . . 36 102 5.2. IV for [AES_128] . . . . . . . . . . . . . . . . . . . . 36 103 6. Client/Server Responsibilities . . . . . . . . . . . . . . . 36 104 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 36 105 6.2. Server Responsibilities . . . . . . . . . . . . . . . . . 36 106 6.2.1. General Server Responsibilities . . . . . . . . . . . 36 107 6.2.2. Live Playlists . . . . . . . . . . . . . . . . . . . 39 108 6.2.3. Encrypting Media Segments . . . . . . . . . . . . . . 40 109 6.2.4. Providing Variant Streams . . . . . . . . . . . . . . 41 110 6.3. Client Responsibilities . . . . . . . . . . . . . . . . . 42 111 6.3.1. General Client Responsibilities . . . . . . . . . . . 42 112 6.3.2. Loading the Media Playlist file . . . . . . . . . . . 43 113 6.3.3. Playing the Media Playlist file . . . . . . . . . . . 44 114 6.3.4. Reloading the Media Playlist file . . . . . . . . . . 45 115 6.3.5. Determining the next segment to load . . . . . . . . 46 116 6.3.6. Decrypting encrypted Media Segments . . . . . . . . . 46 117 7. Protocol version compatibility . . . . . . . . . . . . . . . 47 118 8. Playlist Examples . . . . . . . . . . . . . . . . . . . . . . 48 119 8.1. Simple Media Playlist . . . . . . . . . . . . . . . . . . 48 120 8.2. Live Media Playlist, using HTTPS . . . . . . . . . . . . 48 121 8.3. Playlist with encrypted Media Segments . . . . . . . . . 49 122 8.4. Master Playlist . . . . . . . . . . . . . . . . . . . . . 49 123 8.5. Master Playlist with I-Frames . . . . . . . . . . . . . . 50 124 8.6. Master Playlist with Alternative audio . . . . . . . . . 50 125 8.7. Master Playlist with Alternative video . . . . . . . . . 50 126 8.8. Session Data in a Master Playlist . . . . . . . . . . . . 51 127 8.9. CHARACTERISTICS attribute containing multiple 128 characteristics . . . . . . . . . . . . . . . . . . . . . 52 129 8.10. EXT-X-DATERANGE carrying SCTE-35 tags . . . . . . . . . . 52 130 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 52 131 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 52 132 11. Security Considerations . . . . . . . . . . . . . . . . . . . 53 133 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 54 134 12.1. Normative References . . . . . . . . . . . . . . . . . . 54 135 12.2. Informative References . . . . . . . . . . . . . . . . . 57 136 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 58 138 1. Introduction to HTTP Live Streaming 140 HTTP Live Streaming provides a reliable, cost-effective means of 141 delivering continuous and long-form video over the Internet. It 142 allows a receiver to adapt the bit rate of the media to the current 143 network conditions in order to maintain uninterrupted playback at the 144 best possible quality. It supports interstitial content boundaries. 145 It provides a flexible framework for media encryption. It can 146 efficiently offer multiple renditions of the same content, such as 147 audio translations. It offers compatibility with large-scale HTTP 148 caching infrastructure to support delivery to large audiences. 150 Since its first draft publication in 2009, HTTP Live Streaming has 151 been implemented and deployed by a wide array of content producers, 152 tools vendors, distributors, and device manufacturers. In the 153 subsequent eight years the protocol has been refined by extensive 154 review and discussion with a variety of media streaming implementors. 156 The purpose of this document is to facilitate interoperability 157 between HTTP Live Streaming implementations by describing the media 158 transmission protocol. Using this protocol, a client can receive a 159 continuous stream of media from a server for concurrent presentation. 161 This document describes version 7 of the protocol. 163 2. Overview 165 A multimedia presentation is specified by a Uniform Resource 166 Identifier (URI) [RFC3986] to a Playlist. 168 A Playlist is either a Media Playlist or a Master Playlist. Both are 169 UTF-8 text files containing URIs and descriptive tags. 171 A Media Playlist contains a list of Media Segments, which when played 172 sequentially will play the multimedia presentation. 174 Here is an example of a Media Playlist: 176 #EXTM3U 177 #EXT-X-TARGETDURATION:10 179 #EXTINF:9.009, 180 http://media.example.com/first.ts 181 #EXTINF:9.009, 182 http://media.example.com/second.ts 183 #EXTINF:3.003, 184 http://media.example.com/third.ts 186 The first line is the format identifier tag #EXTM3U. The line 187 containing #EXT-X-TARGETDURATION says that all Media Segments will be 188 10 seconds long or less. Then three Media Segments are declared. 189 The first and second are 9.009 seconds long; the third is 3.003 190 seconds. 192 To play this Playlist, the client first downloads it and then 193 downloads and plays each Media Segment declared within it. The 194 client reloads the Playlist as described in this document to discover 195 any added segments. Data SHOULD be carried over HTTP [RFC7230], but 196 in general a URI can specify any protocol that can reliably transfer 197 the specified resource on demand. 199 A more complex presentation can be described by a Master Playlist. A 200 Master Playlist provides a set of Variant Streams, each of which 201 describes a different version of the same content. 203 A Variant Stream includes a Media Playlist that specifies media 204 encoded at a particular bit rate, in a particular format, and at a 205 particular resolution for media containing video. 207 A Variant Stream can also specify a set of Renditions. Renditions 208 are alternate versions of the content, such as audio produced in 209 different languages or video recorded from different camera angles. 211 Clients should switch between different Variant Streams to adapt to 212 network conditions. Clients should choose Renditions based on user 213 preferences. 215 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 216 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 217 document are to be interpreted as described in RFC 2119 [RFC2119]. 219 3. Media Segments 221 A Media Playlist contains a series of Media Segments which make up 222 the overall presentation. A Media Segment is specified by a URI and 223 optionally a byte range. 225 The duration of each Media Segment is indicated in the Media Playlist 226 by its EXTINF tag (Section 4.3.2.1). 228 Each segment in a Media Playlist has a unique integer Media Sequence 229 Number. The Media Sequence Number of the first segment in the Media 230 Playlist is either 0, or declared in the Playlist (Section 4.3.3.2). 231 The Media Sequence Number of every other segment is equal to the 232 Media Sequence Number of the segment that precedes it plus one. 234 Each Media Segment MUST carry the continuation of the encoded 235 bitstream from the end of the segment with the previous Media 236 Sequence Number, where values in a series such as timestamps and 237 Continuity Counters MUST continue uninterrupted. The only exceptions 238 are the first Media Segment ever to appear in a Media Playlist, and 239 Media Segments which are explicitly signaled as discontinuities 240 (Section 4.3.2.3). Unmarked media discontinuities can trigger 241 playback errors. 243 Any Media Segment that contains video SHOULD include enough 244 information to initialize a video decoder and decode a continuous set 245 of frames that includes the final frame in the Segment; network 246 efficiency is optimized if there is enough information in the Segment 247 to decode all frames in the Segment. For example, any Media Segment 248 containing H.264 video SHOULD contain an IDR; frames prior to the 249 first IDR will be downloaded but possibly discarded. 251 3.1. Supported Media Segment Formats 253 All Media Segments MUST be in a format described in this section. 254 Transport of other media file formats is not defined. 256 Some media formats require a common sequence of bytes to initialize a 257 parser before a Media Segment can be parsed. This format-specific 258 sequence is called the Media Initialization Section. The Media 259 Initialization Section can be specified by an EXT-X-MAP 260 (Section 4.3.2.5) tag. The Media Initialization Section MUST NOT 261 contain sample data. 263 3.2. MPEG-2 Transport Streams 265 MPEG-2 Transport Streams are specified by [ISO_13818]. 267 The Media Initialization Section of an MPEG-2 Transport Stream 268 Segment is a Program Association Table (PAT) followed by a Program 269 Map Table (PMT). 271 Transport Stream Segments MUST contain a single MPEG-2 Program; 272 playback of Multi-Program Transport Streams is not defined. Each 273 Transport Stream Segment MUST contain a PAT and a PMT, or have an 274 EXT-X-MAP (Section 4.3.2.5) tag applied to it. The first two 275 Transport Stream packets in a Segment without an EXT-X-MAP tag SHOULD 276 be a PAT and a PMT. 278 3.3. Fragmented MPEG-4 280 MPEG-4 Fragments are specified by the ISO Base Media File Format 281 [ISOBMFF]. Unlike regular MPEG-4 files which have a Movie Box 282 ('moov') that contains sample tables and a Media Data Box ('mdat') 283 containing the corresponding samples, an MPEG-4 Fragment consists of 284 a Movie Fragment Box ('moof') containing a subset of the sample table 285 and a Media Data Box containing those samples. Use of MPEG-4 286 Fragments does require a Movie Box for initialization, but that Movie 287 Box contains only non-sample-specific information such as track and 288 sample descriptions. 290 A Fragmented MPEG-4 (fMP4) Segment is a "segment" as defined by 291 Section 3 of [ISOBMFF], including the constraints on Media Data Boxes 292 in Section 8.16 [ISOBMFF]. 294 The Media Initialization Section for an fMP4 Segment is an ISO Base 295 Media File that can initialize a parser for that Segment. 297 Broadly speaking, fMP4 Segments and Media Initialization Sections are 298 [ISOBMFF] files that also satisfy the constraints described in this 299 section. 301 The Media Initialization Section for an fMP4 Segment MUST contain a 302 File Type Box ('ftyp') containing a brand that is compatible with 303 'iso6' or higher. The File Type Box MUST be followed by a Movie Box. 304 The Movie Box MUST contain a Track Box ('trak') for every Track 305 Fragment Box ('traf') in the fMP4 Segment, with matching track_ID. 306 Each Track Box SHOULD contain a sample table, but its sample count 307 MUST be zero. Movie Header Boxes ('mvhd') and Track Header Boxes 308 ('tkhd') MUST have durations of zero. A Movie Extends Box ('mvex') 309 MUST follow the last Track Box. Note that a CMAF Header [CMAF] meets 310 all these requirements. 312 In an fMP4 Segment, every Track Fragment Box MUST contain a Track 313 Fragment Decode Time Box ('tfdt'). fMP4 Segments MUST use movie- 314 fragment relative addressing. fMP4 Segments MUST NOT use external 315 data references. Note that a CMAF Segment meets these requirements. 317 An fMP4 Segment in a Playlist containing the EXT-X-I-FRAMES-ONLY 318 (Section 4.3.3.6) tag MAY omit the portion of the Media Data Box 319 following the I-frame sample data. 321 Each fMP4 Segment in a Media Playlist MUST have an EXT-X-MAP tag 322 applied to it. 324 3.4. Packed Audio 326 A Packed Audio Segment contains encoded audio samples and ID3 tags 327 that are simply packed together with minimal framing and no per- 328 sample timestamps. Supported Packed Audio formats are AAC with ADTS 329 framing [ISO_13818_7]; MP3 [ISO_13818_3]; AC-3 [AC_3]; and Enhanced 330 AC-3 [AC_3]. 332 A Packed Audio Segment has no Media Initialization Section. 334 Each Packed Audio Segment MUST signal the timestamp of its first 335 sample with an ID3 PRIV tag [ID3] at the beginning of the segment. 336 The ID3 PRIV owner identifier MUST be 337 "com.apple.streaming.transportStreamTimestamp". The ID3 payload MUST 338 be a 33-bit MPEG-2 Program Elementary Stream timestamp expressed as a 339 big-endian eight-octet number, with the upper 31 bits set to zero. 340 Clients SHOULD NOT play Packed Audio Segments without this ID3 tag. 342 3.5. WebVTT 344 A WebVTT Segment is a section of a WebVTT [WebVTT] file. WebVTT 345 Segments carry subtitles. 347 The Media Initialization Section of a WebVTT Segment is the WebVTT 348 header. 350 Each WebVTT Segment MUST contain all subtitle cues that are intended 351 to be displayed during the period indicated by the segment EXTINF 352 duration. The start time offset and end time offset of each cue MUST 353 indicate the total display time for that cue, even if part of the cue 354 time range is outside the Segment period. A WebVTT Segment MAY 355 contain no cues; this indicates that no subtitles are to be displayed 356 during that period. 358 Each WebVTT Segment MUST either start with a WebVTT header or have an 359 EXT-X-MAP tag applied to it. 361 In order to synchronize timestamps between audio/video and subtitles, 362 a X-TIMESTAMP-MAP metadata header SHOULD be added to each WebVTT 363 header. This header maps WebVTT cue timestamps to MPEG-2 (PES) 364 timestamps in other Renditions of the Variant Stream. Its format is: 366 X-TIMESTAMP-MAP=LOCAL:,MPEGTS: 367 e.g. X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 369 The cue timestamp in the LOCAL attribute MAY fall outside the range 370 of time covered by the segment. 372 If a WebVTT segment does not have the X-TIMESTAMP-MAP, the client 373 MUST assume that the WebVTT cue time of 0 maps to an MPEG-2 timestamp 374 of 0. 376 4. Playlists 378 This section describes the Playlist files used by HTTP Live 379 Streaming. In this section, "MUST" and "MUST NOT" specify the rules 380 for the syntax and structure of legal Playlist files. Playlists that 381 violate these rules are invalid; clients MUST fail to parse them. 382 See Section 6.3.2. 384 The format of the Playlist files is derived from the M3U [M3U] 385 playlist file format and inherits two tags from that earlier file 386 format: EXTM3U (Section 4.3.1.1) and EXTINF (Section 4.3.2.1). 388 In this section, tags are specified using a BNF-style syntax. 390 Each Playlist file MUST be identifiable by either the path component 391 of its URI or by HTTP Content-Type. In the first case, the path MUST 392 end with either .m3u8 or .m3u. In the second, the HTTP Content-type 393 MUST be "application/vnd.apple.mpegurl" or "audio/mpegurl". Clients 394 SHOULD refuse to parse Playlists that are not so identified. 396 4.1. Definition of a Playlist 398 Playlist files MUST be encoded in UTF-8 [RFC3629]. They MUST NOT 399 contain any byte order mark (BOM); Clients SHOULD reject Playlists 400 which contain a BOM or do not parse as UTF-8. Playlist files MUST 401 NOT contain UTF-8 control characters (U+0000 to U+001F and U+007F to 402 U+009F), with the exceptions of CR (U+000D) and LF (U+000A). All 403 character sequences MUST be normalized according to Unicode 404 normalization form "NFC". Note that US-ASCII [US_ASCII] conforms to 405 these rules. 407 Lines in a Playlist file are terminated by either a single line feed 408 character or a carriage return character followed by an line feed 409 character. Each line is a URI, blank, or starts with the character 410 '#'. Blank lines are ignored. White space MUST NOT be present, 411 except for elements in which it is explicitly specified. 413 Lines that start with the character '#' are either comments or tags. 414 Tags begin with #EXT. They are case-sensitive. All other lines that 415 begin with '#' are comments and SHOULD be ignored. 417 A URI line identifies a Media Segment or a Playlist file (see 418 Section 4.3.4.2). Each Media Segment is specified by a URI and the 419 tags that apply to it. 421 A Playlist is a Media Playlist if all URI lines in the Playlist 422 identify Media Segments. A Playlist is a Master Playlist if all URI 423 lines in the Playlist identify Media Playlists. A Playlist MUST be 424 either a Media Playlist or a Master Playlist; all other Playlists are 425 invalid. 427 A URI in a Playlist, whether it is a URI line or part of a tag, MAY 428 be relative. Any relative URI is considered to be relative to the 429 URI of the Playlist that contains it. 431 The duration of a Media Playlist file is the sum of the durations of 432 the Media Segments within it. 434 The segment bit rate of a Media Segment is the size of the Media 435 Segment divided by its EXTINF duration (Section 4.3.2.1). Note that 436 this includes container overhead but does not include overhead 437 imposed by the delivery system, such as HTTP, TCP or IP headers. 439 The peak segment bit rate of a Media Playlist is the largest bit rate 440 of any contiguous set of segments whose total duration is between 0.5 441 and 1.5 times the target duration. The bit rate of a set is 442 calculated by dividing the sum of the segment sizes by the sum of the 443 segment durations. 445 The average segment bit rate of a Media Playlist is the sum of the 446 sizes (in bits) of every Media Segment in the Media Playlist, divided 447 by the Media Playlist duration. Note that this includes container 448 overhead, but not HTTP or other overhead imposed by the delivery 449 system. 451 4.2. Attribute Lists 453 Certain tags have values which are Attribute Lists. An attribute- 454 list is a comma-separated list of attribute/value pairs with no 455 whitespace. 457 An attribute/value pair has the following syntax: 459 AttributeName=AttributeValue 461 An AttributeName is an unquoted string containing characters from the 462 set [A..Z], [0..9] and '-'. Therefore, AttributeNames contain only 463 uppercase letters, not lowercase. There MUST NOT be any whitespace 464 between the AttributeName and the '=' character, nor between the '=' 465 character and the AttributeValue. 467 An AttributeValue is one of the following: 469 o decimal-integer: an unquoted string of characters from the set 470 [0..9] expressing an integer in base-10 arithmetic in the range 471 from 0 to 2^64-1 (18446744073709551615). A decimal-integer may be 472 from 1 to 20 characters long. 474 o hexadecimal-sequence: an unquoted string of characters from the 475 set [0..9] and [A..F] that is prefixed with 0x or 0X. The maximum 476 length of a hexadecimal-sequence depends on its AttributeName. 478 o decimal-floating-point: an unquoted string of characters from the 479 set [0..9] and '.' which expresses a non-negative floating-point 480 number in decimal positional notation. 482 o signed-decimal-floating-point: an unquoted string of characters 483 from the set [0..9], '-' and '.' which expresses a signed 484 floating-point number in decimal positional notation. 486 o quoted-string: a string of characters within a pair of double- 487 quotes (0x22). The following characters MUST NOT appear in a 488 quoted-string: line feed (0xA), carriage return (0xD), or double 489 quote (0x22). Quoted-string AttributeValues SHOULD be constructed 490 so that byte-wise comparison is sufficient to test two quoted- 491 string AttributeValues for equality. Note that this implies case- 492 sensitive comparison. 494 o enumerated-string: an unquoted character string from a set which 495 is explicitly defined by the Attribute. An enumerated-string will 496 never contain double-quotes ("), commas (,), or whitespace. 498 o decimal-resolution: two decimal-integers separated by the "x" 499 character. The first integer is a horizontal pixel dimension 500 (width); the second is a vertical pixel dimension (height). 502 The type of the AttributeValue for a given AttributeName is specified 503 by the Attribute definition. 505 A given AttributeName MUST NOT appear more than once in a given 506 Attribute List. Clients SHOULD refuse to play such Playlists. 508 4.3. Playlist Tags 510 Playlist tags specify either global parameters of the Playlist, or 511 information about the Media Segments or Media Playlists that appear 512 after them. 514 4.3.1. Basic Tags 516 These tags are allowed in both Media Playlists and Master Playlists. 518 4.3.1.1. EXTM3U 520 The EXTM3U tag indicates that the file is an Extended M3U [M3U] 521 Playlist file. It MUST be the first line of every Media Playlist and 522 every Master Playlist. Its format is: 524 #EXTM3U 526 4.3.1.2. EXT-X-VERSION 528 The EXT-X-VERSION tag indicates the compatibility version of the 529 Playlist file, its associated media, and its server. 531 The EXT-X-VERSION tag applies to the entire Playlist file. Its 532 format is: 534 #EXT-X-VERSION: 536 where n is an integer indicating the protocol compatibility version 537 number. 539 It MUST appear in all Playlists containing tags or attributes that 540 are not compatible with protocol version 1 to support 541 interoperability with older clients. Section 7 specifies the minimum 542 value of the compatibility version number for any given Playlist 543 file. 545 A Playlist file MUST NOT contain more than one EXT-X-VERSION tag. If 546 a client encounters a Playlist with multiple EXT-X-VERSION tags, it 547 MUST reject it. 549 4.3.2. Media Segment Tags 551 Each Media Segment is specified by a series of Media Segment tags 552 followed by a URI. Some Media Segment tags apply to just the next 553 segment; others apply to all subsequent segments until another 554 instance of the same tag. 556 A Media Segment tag MUST NOT appear in a Master Playlist. Clients 557 MUST reject Playlists that contain both Media Segment Tags and Master 558 Playlist tags (Section 4.3.4). 560 4.3.2.1. EXTINF 562 The EXTINF tag specifies the duration of a Media Segment. It applies 563 only to the next Media Segment. This tag is REQUIRED for each Media 564 Segment. Its format is: 566 #EXTINF:,[] 568 where duration is a decimal-floating-point or decimal-integer number 569 (as described in Section 4.2) that specifies the duration of the 570 Media Segment in seconds. Generally, durations SHOULD be decimal- 571 floating-point, with enough accuracy to avoid perceptible error when 572 segment durations are accumulated. If the compatibility version 573 number is less than 3, durations MUST be integers. Durations that 574 are reported as integers SHOULD be rounded to the nearest integer. 575 The remainder of the line following the comma is an optional human- 576 readable informative title of the Media Segment expressed as raw 577 UTF-8 text. 579 4.3.2.2. EXT-X-BYTERANGE 581 The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range 582 of the resource identified by its URI. It applies only to the next 583 URI line that follows it in the Playlist. Its format is: 585 #EXT-X-BYTERANGE:<n>[@<o>] 587 where n is a decimal-integer indicating the length of the sub-range 588 in bytes. If present, o is a decimal-integer indicating the start of 589 the sub-range, as a byte offset from the beginning of the resource. 590 If o is not present, the sub-range begins at the next byte following 591 the sub-range of the previous Media Segment. 593 If o is not present, a previous Media Segment MUST appear in the 594 Playlist file and MUST be a sub-range of the same media resource, or 595 the Media Segment is undefined and the Playlist MUST be rejected. 597 A Media Segment without an EXT-X-BYTERANGE tag consists of the entire 598 resource identified by its URI. 600 Use of the EXT-X-BYTERANGE tag REQUIRES a compatibility version 601 number of 4 or greater. 603 4.3.2.3. EXT-X-DISCONTINUITY 605 The EXT-X-DISCONTINUITY tag indicates a discontinuity between the 606 Media Segment that follows it and the one that preceded it. 608 Its format is: 610 #EXT-X-DISCONTINUITY 612 The EXT-X-DISCONTINUITY tag MUST be present if there is a change in 613 any of the following characteristics: 615 o file format 617 o number, type and identifiers of tracks 619 o timestamp sequence 621 The EXT-X-DISCONTINUITY tag SHOULD be present if there is a change in 622 any of the following characteristics: 624 o encoding parameters 626 o encoding sequence 628 See Section 3, Section 6.2.1, and Section 6.3.3 for more information 629 about the EXT-X-DISCONTINUITY tag. 631 4.3.2.4. EXT-X-KEY 633 Media Segments MAY be encrypted. The EXT-X-KEY tag specifies how to 634 decrypt them. It applies to every Media Segment that appears between 635 it and the next EXT-X-KEY tag in the Playlist file with the same 636 KEYFORMAT attribute (or the end of the Playlist file). Two or more 637 EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the 638 same Media Segment if they ultimately produce the same decryption 639 key. The format is: 641 #EXT-X-KEY:<attribute-list> 643 The following attributes are defined: 645 METHOD 647 The value is an enumerated-string that specifies the encryption 648 method. This attribute is REQUIRED. 650 The methods defined are: NONE, AES-128, and SAMPLE-AES. 652 An encryption method of NONE means that Media Segments are not 653 encrypted. If the encryption method is NONE, other attributes 654 MUST NOT be present. 656 An encryption method of AES-128 signals that Media Segments are 657 completely encrypted using the Advanced Encryption Standard 658 [AES_128] with a 128-bit key, Cipher Block Chaining, and PKCS7 659 padding [RFC5652]. CBC is restarted on each segment boundary, 660 using either the IV attribute value or the Media Sequence Number 661 as the IV; see Section 5.2. 663 An encryption method of SAMPLE-AES means that the Media Segments 664 contain media samples, such as audio or video, that are encrypted 665 using the Advanced Encryption Standard [AES_128]. How these media 666 streams are encrypted and encapsulated in a segment depends on the 667 media encoding and the media format of the segment. fMP4 Media 668 Segments are encrypted using the 'cbcs' scheme of Common 669 Encryption [COMMON_ENC]. Encryption of other Media Segment 670 formats containing H.264 [H_264], AAC [ISO_14496], AC-3 [AC_3], 671 and Enhanced AC-3 [AC_3] media streams is described in the HLS 672 Sample Encryption [SampleEnc] specification. The IV attribute MAY 673 be present; see Section 5.2. 675 URI 677 The value is a quoted-string containing a URI that specifies how 678 to obtain the key. This attribute is REQUIRED unless the METHOD 679 is NONE. 681 IV 683 The value is a hexadecimal-sequence that specifies a 128-bit 684 unsigned integer Initialization Vector to be used with the key. 685 Use of the IV attribute REQUIRES a compatibility version number of 686 2 or greater. See Section 5.2 for when the IV attribute is used. 688 KEYFORMAT 690 The value is a quoted-string that specifies how the key is 691 represented in the resource identified by the URI; see Section 5 692 for more detail. This attribute is OPTIONAL; its absence 693 indicates an implicit value of "identity". Use of the KEYFORMAT 694 attribute REQUIRES a compatibility version number of 5 or greater. 696 KEYFORMATVERSIONS 698 The value is a quoted-string containing one or more positive 699 integers separated by the "/" character (for example, "1", "1/2", 700 or "1/2/5"). If more than one version of a particular KEYFORMAT 701 is defined, this attribute can be used to indicate which 702 version(s) this instance complies with. This attribute is 703 OPTIONAL; if it is not present, its value is considered to be "1". 704 Use of the KEYFORMATVERSIONS attribute REQUIRES a compatibility 705 version number of 5 or greater. 707 If the Media Playlist file does not contain an EXT-X-KEY tag then 708 Media Segments are not encrypted. 710 See Section 5 for the format of the key file, and Section 5.2, 711 Section 6.2.3 and Section 6.3.6 for additional information on Media 712 Segment encryption. 714 4.3.2.5. EXT-X-MAP 716 The EXT-X-MAP tag specifies how to obtain the Media Initialization 717 Section (Section 3) required to parse the applicable Media Segments. 718 It applies to every Media Segment that appears after it in the 719 Playlist until the next EXT-X-MAP tag or until the end of the 720 playlist. 722 Its format is: 724 #EXT-X-MAP:<attribute-list> 726 The following attributes are defined: 728 URI 730 The value is a quoted-string containing a URI that identifies a 731 resource that contains the Media Initialization Section. This 732 attribute is REQUIRED. 734 BYTERANGE 736 The value is a quoted-string specifying a byte range into the 737 resource identified by the URI attribute. This range SHOULD 738 contain only the Media Initialization Section. The format of the 739 byte range is described in Section 4.3.2.2. This attribute is 740 OPTIONAL; if it is not present, the byte range is the entire 741 resource indicated by the URI. 743 An EXT-X-MAP tag SHOULD be supplied for Media Segments in Playlists 744 with the EXT-X-I-FRAMES-ONLY tag when the first Media Segment (i.e., 745 I-frame) in the Playlist (or the first segment following an 746 EXT-X-DISCONTINUITY tag) does not immediately follow the Media 747 Initialization Section at the beginning of its resource. 749 Use of the EXT-X-MAP tag in a Media Playlist that contains the 750 EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility version number of 5 751 or greater. Use of the EXT-X-MAP tag in a Media Playlist that DOES 752 NOT contain the EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility 753 version number of 6 or greater. 755 4.3.2.6. EXT-X-PROGRAM-DATE-TIME 757 The EXT-X-PROGRAM-DATE-TIME tag associates the first sample of a 758 Media Segment with an absolute date and/or time. It applies only to 759 the next Media Segment. 761 The date/time representation is ISO/IEC 8601:2004 [ISO_8601] and 762 SHOULD indicate a time zone and fractional parts of seconds: 764 #EXT-X-PROGRAM-DATE-TIME:<YYYY-MM-DDThh:mm:ss.SSSZ> 766 For example: 768 #EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031+08:00 770 EXT-X-PROGRAM-DATE-TIME tags SHOULD provide millisecond accuracy. 772 See Section 6.2.1 and Section 6.3.3 for more information on the EXT-X 773 -PROGRAM-DATE-TIME tag. 775 4.3.2.7. EXT-X-DATERANGE 777 The EXT-X-DATERANGE tag associates a Date Range (i.e. a range of time 778 defined by a starting and ending date) with a set of attribute / 779 value pairs. Its format is: 781 #EXT-X-DATERANGE:<attribute-list> 783 where the defined attributes are: 785 ID 786 A quoted-string that uniquely identifies a Date Range in the 787 Playlist. This attribute is REQUIRED. 789 CLASS 791 A client-defined quoted-string that specifies some set of 792 attributes and their associated value semantics. All Date Ranges 793 with the same CLASS attribute value MUST adhere to these 794 attribute-value semantics. This attribute is OPTIONAL. 796 START-DATE 798 A quoted-string containing the ISO-8601 date at which the Date 799 Range begins. This attribute is REQUIRED. 801 END-DATE 803 A quoted-string containing the ISO-8601 date at which the Date 804 Range ends. It MUST be equal to or later than the value of the 805 START-DATE attribute. This attribute is OPTIONAL. 807 DURATION 809 The duration of the Date Range expressed as a decimal-floating- 810 point number of seconds. It MUST NOT be negative. A single 811 instant in time (e.g. crossing a finish line) SHOULD be 812 represented with a duration of 0. This attribute is OPTIONAL. 814 PLANNED-DURATION 816 The expected duration of the Date Range expressed as a decimal- 817 floating-point number of seconds. It MUST NOT be negative. This 818 attribute SHOULD be used to indicate the expected duration of a 819 Date Range whose actual duration is not yet known. It is 820 OPTIONAL. 822 X-<client-attribute> 824 The "X-" prefix defines a namespace reserved for client-defined 825 attributes. The client-attribute MUST be a legal AttributeName. 826 Clients SHOULD use a reverse-DNS syntax when defining their own 827 attribute names to avoid collisions. The attribute value MUST be 828 a quoted-string, a hexadecimal-sequence, or a decimal-floating- 829 point. An example of a client-defined attribute is X-COM-EXAMPLE- 830 AD-ID="XYZ123". These attributes are OPTIONAL. 832 SCTE35-CMD, SCTE35-OUT, SCTE35-IN 833 Used to carry SCTE-35 data; see Section 4.3.2.7.1 for more 834 information. These attributes are OPTIONAL. 836 END-ON-NEXT 838 An enumerated-string whose value MUST be YES. This attribute 839 indicates that the end of the range containing it is equal to the 840 START-DATE of its Following Range. The Following Range is the 841 Date Range of the same CLASS that has the earliest START-DATE 842 after the START-DATE of the range in question. This attribute is 843 OPTIONAL. 845 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST have a 846 CLASS attribute. Other EXT-X-DATERANGE tags with the same CLASS 847 attribute MUST NOT specify Date Ranges that overlap. 849 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT 850 contain DURATION or END-DATE attributes. 852 A Date Range with neither a DURATION, an END-DATE, or an END-ON- 853 NEXT=YES attribute has an unknown duration, even if it has a PLANNED- 854 DURATION. 856 If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain 857 at least one EXT-X-PROGRAM-DATE-TIME tag. 859 If a Playlist contains two EXT-X-DATERANGE tags with the same ID 860 attribute value, then any AttributeName that appears in both tags 861 MUST have the same AttributeValue. 863 If a Date Range contains both a DURATION attribute and an END-DATE 864 attribute, the value of the END-DATE attribute MUST be equal to the 865 value of the START-DATE attribute plus the value of the DURATION 866 attribute. 868 Clients SHOULD ignore EXT-X-DATERANGE tags with illegal syntax. 870 4.3.2.7.1. Mapping SCTE-35 into EXT-X-DATERANGE 872 Splice information carried in source media according to the SCTE-35 873 specification [SCTE35] MAY be represented in a Media Playlist using 874 EXT-X-DATERANGE tags. 876 Each SCTE-35 splice_info_section() containing a splice_null(), 877 splice_schedule(), bandwidth_reservation() or private_cmd() SHOULD be 878 represented by an EXT-X-DATERANGE tag with a SCTE35-CMD attribute 879 whose value is the big-endian binary representation of the 880 splice_info_section(), expressed as a hexadecimal-sequence. 882 A SCTE-35 splice out/in pair signaled by a pair of splice_insert() 883 commands SHOULD be represented by one or more EXT-X-DATERANGE tags 884 carrying the same ID attribute, which MUST be unique to that splice 885 out/in pair. The "out" splice_info_section() (with 886 out_of_network_indicator set to 1) MUST be placed in a SCTE35-OUT 887 attribute, with the same formatting as SCTE35-CMD. The "in" 888 splice_info_section() (with out_of_network_indicator set to 0) MUST 889 be placed in a SCTE35-IN attribute, with the same formatting as 890 SCTE35-CMD. 892 A SCTE-35 splice out/in pair signaled by a pair of time_signal() 893 commands, each carrying a single segmentation_descriptor(), SHOULD be 894 represented by one or more EXT-X-DATERANGE tags carrying the same ID 895 attribute, which MUST be unique to that splice out/in pair. The 896 "out" splice_info_section() MUST be placed in a SCTE35-OUT attribute; 897 the "in" splice_info_section() MUST be placed in a SCTE35-IN 898 attribute. 900 Different types of segmentation (as indicated by the 901 segmentation_type_id in the segmentation_descriptor() SHOULD be 902 represented by separate EXT-X-DATERANGE tags, even if two or more 903 segmentation_descriptor()s arrive in the same splice_info_section(). 904 In that case, each EXT-X-DATERANGE tag will have a SCTE35-OUT, 905 SCTE35-IN or SCTE35-CMD attribute whose value is the entire 906 splice_info_section(). 908 A SCTE-35 time_signal() command that does not signal a splice out or 909 in point SHOULD be represented by an EXT-X-DATERANGE tag with a 910 SCTE35-CMD attribute. 912 The START-DATE of an EXT-X-DATERANGE tag containing a SCTE35-OUT 913 attribute MUST be the date and time that corresponds to the program 914 time of that splice. 916 The START-DATE of an EXT-X-DATERANGE tag containing a SCTE35-CMD MUST 917 be the date and time specified by the splice_time() in the command, 918 or to the program time at which the command appeared in the source 919 stream if the command does not specify a splice_time(). 921 An EXT-X-DATERANGE tag containing a SCTE35-OUT attribute MAY contain 922 a PLANNED-DURATION attribute. Its value MUST be the planned duration 923 of the splice. 925 The DURATION of an EXT-X-DATERANGE tag containing a SCTE35-IN 926 attribute MUST be the actual (not planned) program duration between 927 the corresponding out-point and that in-point. 929 The END-DATE of an EXT-X-DATERANGE tag containing a SCTE35-IN 930 attribute MUST be the actual (not planned) program date and time of 931 that in-point. 933 If the actual end date and time is not known when a SCTE35-OUT 934 attribute is added to the Playlist, the DURATION attribute and the 935 END-TIME attribute MUST NOT be present; the actual end date of the 936 splice SHOULD be signaled by another EXT-X-DATERANGE tag once it has 937 been established. 939 A canceled splice SHOULD NOT appear in the Playlist as an 940 EXT-X-DATERANGE tag. 942 An EXT-X-DATERANGE tag announcing a splice SHOULD be added to a 943 Playlist at the same time as the last pre-splice Media Segment. 945 The ID attribute of an EXT-X-DATERANGE tag MAY contain a 946 splice_event_id and/or a segmentation_event_id, but it MUST be unique 947 in the the Playlist. If there is a possibility that a SCTE-35 id 948 will be reused, the ID attribute value MUST include disambiguation, 949 such as a date or sequence number. 951 4.3.3. Media Playlist Tags 953 Media Playlist tags describe global parameters of the Media Playlist. 954 There MUST NOT be more than one Media Playlist tag of each type in 955 any Media Playlist. 957 A Media Playlist Tag MUST NOT appear in a Master Playlist 959 4.3.3.1. EXT-X-TARGETDURATION 961 The EXT-X-TARGETDURATION tag specifies the maximum Media Segment 962 duration. The EXTINF duration of each Media Segment in the Playlist 963 file, when rounded to the nearest integer, MUST be less than or equal 964 to the target duration; longer segments can trigger playback stalls 965 or other errors. It applies to the entire Playlist file. Its format 966 is: 968 #EXT-X-TARGETDURATION:<s> 970 where s is a decimal-integer indicating the target duration in 971 seconds. The EXT-X-TARGETDURATION tag is REQUIRED. 973 4.3.3.2. EXT-X-MEDIA-SEQUENCE 975 The EXT-X-MEDIA-SEQUENCE tag indicates the Media Sequence Number of 976 the first Media Segment that appears in a Playlist file. Its format 977 is: 979 #EXT-X-MEDIA-SEQUENCE:<number> 981 where number is a decimal-integer. 983 If the Media Playlist file does not contain an EXT-X-MEDIA-SEQUENCE 984 tag then the Media Sequence Number of the first Media Segment in the 985 Media Playlist SHALL be considered to be 0. A client MUST NOT assume 986 that segments with the same Media Sequence Number in different Media 987 Playlists contain matching content - see Section 6.3.2. 989 A URI for a Media Segment is not required to contain its Media 990 Sequence Number. 992 See Section 6.2.1 and Section 6.3.5 for more information on setting 993 the EXT-X-MEDIA-SEQUENCE tag. 995 The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media 996 Segment in the Playlist. 998 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE 1000 The EXT-X-DISCONTINUITY-SEQUENCE tag allows synchronization between 1001 different Renditions of the same Variant Stream or different Variant 1002 Streams that have EXT-X-DISCONTINUITY tags in their Media Playlists. 1004 Its format is: 1006 #EXT-X-DISCONTINUITY-SEQUENCE:<number> 1008 where number is a decimal-integer. 1010 If the Media Playlist does not contain an EXT-X-DISCONTINUITY- 1011 SEQUENCE tag, then the Discontinuity Sequence Number of the first 1012 Media Segment in the Playlist SHALL be considered to be 0. 1014 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first 1015 Media Segment in the Playlist. 1017 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any 1018 EXT-X-DISCONTINUITY tag. 1020 See Section 6.2.1 and Section 6.2.2 for more information about 1021 setting the value of the EXT-X-DISCONTINUITY-SEQUENCE tag. 1023 4.3.3.4. EXT-X-ENDLIST 1025 The EXT-X-ENDLIST tag indicates that no more Media Segments will be 1026 added to the Media Playlist file. It MAY occur anywhere in the Media 1027 Playlist file. Its format is: 1029 #EXT-X-ENDLIST 1031 4.3.3.5. EXT-X-PLAYLIST-TYPE 1033 The EXT-X-PLAYLIST-TYPE tag provides mutability information about the 1034 Media Playlist file. It applies to the entire Media Playlist file. 1035 It is OPTIONAL. Its format is: 1037 #EXT-X-PLAYLIST-TYPE:<EVENT|VOD> 1039 Section 6.2.1 defines the implications of the EXT-X-PLAYLIST-TYPE 1040 tag. 1042 If the EXT-X-PLAYLIST-TYPE value is EVENT, Media Segments can only be 1043 added to the end of the Media Playlist. If the EXT-X-PLAYLIST-TYPE 1044 value is VOD, the Media Playlist cannot change. 1046 If the EXT-X-PLAYLIST-TYPE tag is omitted from a Media Playlist, the 1047 Playlist can be updated according to the rules in Section 6.2.1 with 1048 no additional restrictions. For example, a live Playlist 1049 (Section 6.2.2) MAY be updated to remove Media Segments in the order 1050 that they appeared. 1052 4.3.3.6. EXT-X-I-FRAMES-ONLY 1054 The EXT-X-I-FRAMES-ONLY tag indicates that each Media Segment in the 1055 Playlist describes a single I-frame. I-frames (or Intra frames) are 1056 encoded video frames whose encoding does not depend on any other 1057 frame. I-frame playlists can be used for trick play, such as fast 1058 forward, rapid reverse and scrubbing. 1060 The EXT-X-I-FRAMES-ONLY tag applies to the entire Playlist. Its 1061 format is: 1063 #EXT-X-I-FRAMES-ONLY 1065 In a Playlist with the EXT-X-I-FRAMES-ONLY tag, the Media Segment 1066 duration (EXTINF tag value) is the time between the presentation time 1067 of the I-frame in the Media Segment and the presentation time of the 1068 next I-frame in the Playlist, or the end of the presentation if it is 1069 the last I-frame in the Playlist. 1071 Media resources containing I-frame segments MUST begin with either a 1072 Media Initialization Section (Section 3) or be accompanied by an 1073 EXT-X-MAP tag indicating the Media Initialization Section so that 1074 clients can load and decode I-frame segments in any order. The byte 1075 range of an I-frame segment with an EXT-X-BYTERANGE tag applied to it 1076 (Section 4.3.2.2) MUST NOT include its Media Initialization Section; 1077 clients can assume that the Media Initialization Section is defined 1078 by EXT-X-MAP tag, or is located from the start of the resource to the 1079 offset of the first I-frame segment in that resource. 1081 Use of the EXT-X-I-FRAMES-ONLY REQUIRES a compatibility version 1082 number of 4 or greater. 1084 4.3.4. Master Playlist Tags 1086 Master Playlist tags define the Variant Streams, Renditions, and 1087 other global parameters of the presentation. 1089 Master Playlist Tags MUST NOT appear in a Media Playlist; clients 1090 MUST reject any Playlist that contains both a Master Playlist tag and 1091 either a Media Playlist tag or a Media Segment tag. 1093 4.3.4.1. EXT-X-MEDIA 1095 The EXT-X-MEDIA tag is used to relate Media Playlists that contain 1096 alternative Renditions (Section 4.3.4.2.1) of the same content. For 1097 example, three EXT-X-MEDIA tags can be used to identify audio-only 1098 Media Playlists that contain English, French and Spanish Renditions 1099 of the same presentation. Or two EXT-X-MEDIA tags can be used to 1100 identify video-only Media Playlists that show two different camera 1101 angles. 1103 Its format is: 1105 #EXT-X-MEDIA:<attribute-list> 1107 The following attributes are defined: 1109 TYPE 1111 The value is an enumerated-string; valid strings are AUDIO, VIDEO, 1112 SUBTITLES and CLOSED-CAPTIONS. This attribute is REQUIRED. 1114 In Transport Streams, Closed captions [CEA608] media is carried in 1115 the video stream. Therefore, an EXT-X-MEDIA tag with TYPE of 1116 CLOSED-CAPTION does not specify a Rendition; the closed caption 1117 media is present in the Media Segments of every video Rendition. 1119 URI 1121 The value is a quoted-string containing a URI that identifies the 1122 Media Playlist file. This attribute is OPTIONAL; see 1123 Section 4.3.4.2.1. If the TYPE is CLOSED-CAPTIONS, the URI 1124 attribute MUST NOT be present. 1126 GROUP-ID 1128 The value is a quoted-string which specifies the group to which 1129 the Rendition belongs. See Section 4.3.4.1.1. This attribute is 1130 REQUIRED. 1132 LANGUAGE 1134 The value is a quoted-string containing one of the standard Tags 1135 for Identifying Languages [RFC5646], which identifies the primary 1136 language used in the Rendition. This attribute is OPTIONAL. 1138 ASSOC-LANGUAGE 1140 The value is a quoted-string containing a language tag [RFC5646] 1141 that identifies a language that is associated with the Rendition. 1142 An associated language is often used in a different role than the 1143 language specified by the LANGUAGE attribute (e.g. written vs. 1144 spoken, or as a fallback dialect). This attribute is OPTIONAL. 1146 The LANGUAGE and ASSOC-LANGUAGE attributes can be used, for 1147 example, to link Norwegian renditions that use different spoken 1148 and written languages. 1150 NAME 1152 The value is a quoted-string containing a human-readable 1153 description of the Rendition. If the LANGUAGE attribute is 1154 present then this description SHOULD be in that language. This 1155 attribute is REQUIRED. 1157 DEFAULT 1159 The value is an enumerated-string; valid strings are YES and NO. 1160 If the value is YES, then the client SHOULD play this Rendition of 1161 the content in the absence of information from the user indicating 1162 a different choice. This attribute is OPTIONAL. Its absence 1163 indicates an implicit value of NO. 1165 AUTOSELECT 1167 The value is an enumerated-string; valid strings are YES and NO. 1168 This attribute is OPTIONAL. Its absence indicates an implicit 1169 value of NO. If the value is YES, then the client MAY choose to 1170 play this Rendition in the absence of explicit user preference 1171 because it matches the current playback environment, such as 1172 chosen system language. 1174 If the AUTOSELECT attribute is present, its value MUST be YES if 1175 the value of the DEFAULT attribute is YES. 1177 FORCED 1179 The value is an enumerated-string; valid strings are YES and NO. 1180 This attribute is OPTIONAL. Its absence indicates an implicit 1181 value of NO. The FORCED attribute MUST NOT be present unless the 1182 TYPE is SUBTITLES. 1184 A value of YES indicates that the Rendition contains content which 1185 is considered essential to play. When selecting a FORCED 1186 Rendition, a client SHOULD choose the one that best matches the 1187 current playback environment (e.g. language). 1189 A value of NO indicates that the Rendition contains content which 1190 is intended to be played in response to explicit user request. 1192 INSTREAM-ID 1194 The value is a quoted-string that specifies a Rendition within the 1195 segments in the Media Playlist. This attribute is REQUIRED if the 1196 TYPE attribute is CLOSED-CAPTIONS, in which case it MUST have one 1197 of the values: "CC1", "CC2", "CC3", "CC4", or "SERVICEn" where n 1198 MUST be an integer between 1 and 63 (e.g."SERVICE3" or 1199 "SERVICE42"). 1201 The values "CC1", "CC2", "CC3", and "CC4" identify a Line 21 Data 1202 Services channel [CEA608]. The "SERVICE" values identify a 1203 Digital Television Closed Captioning [CEA708] service block 1204 number. 1206 For all other TYPE values, the INSTREAM-ID MUST NOT be specified. 1208 CHARACTERISTICS 1210 The value is a quoted-string containing one or more Uniform Type 1211 Identifiers [UTI] separated by comma (,) characters. This 1212 attribute is OPTIONAL. Each UTI indicates an individual 1213 characteristic of the Rendition. 1215 A SUBTITLES Rendition MAY include the following characteristics: 1216 "public.accessibility.transcribes-spoken-dialog"; 1217 "public.accessibility.describes-music-and-sound"; "public.easy-to- 1218 read" (which indicates that the subtitles have been edited for 1219 ease of reading). 1221 An AUDIO Rendition MAY include the following characteristics: 1222 "public.accessibility.describes-video". 1224 The CHARACTERISTICS attribute MAY include private UTIs. 1226 CHANNELS 1228 The value is a quoted-string that specifies an ordered, 1229 "/"-separated list of parameters. If the TYPE attribute is AUDIO 1230 then the first parameter is a count of audio channels expressed as 1231 a decimal-integer, indicating the maximum number of independent, 1232 simultaneous audio channels present in any Media Segment in the 1233 Rendition. For example, an AC-3 5.1 rendition would have a 1234 CHANNELS="6" attribute. No other CHANNELS parameters are 1235 currently defined. 1237 All audio EXT-X-MEDIA tags SHOULD have a CHANNELS attribute. If a 1238 Master Playlist contains two renditions encoded with the same 1239 codec but a different number of channels, then the CHANNELS 1240 attribute is REQUIRED; otherwise it is OPTIONAL. 1242 4.3.4.1.1. Rendition Groups 1244 A set of one or more EXT-X-MEDIA tags with the same GROUP-ID value 1245 and the same TYPE value defines a Group of Renditions. Each member 1246 of the Group MUST be an alternative rendition of the same content; 1247 otherwise playback errors can occur. 1249 All EXT-X-MEDIA tags in a Playlist MUST meet the following 1250 constraints: 1252 o All EXT-X-MEDIA tags in the same Group MUST have different NAME 1253 attributes. 1255 o A Group MUST NOT have more than one member with a DEFAULT 1256 attribute of YES. 1258 o Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have 1259 a combination of LANGUAGE [RFC5646], ASSOC-LANGUAGE, FORCED, and 1260 CHARACTERISTICS attributes that is distinct from those of other 1261 AUTOSELECT=YES members of its Group. 1263 A Playlist MAY contain multiple Groups of the same TYPE in order to 1264 provide multiple encodings of that media type. If it does so, each 1265 Group of the same TYPE MUST have the same set of members, and each 1266 corresponding member MUST have identical attributes with the 1267 exception of the URI and CHANNELS attributes. 1269 Each member in a Group of Renditions MAY have a different sample 1270 format. For example, an English rendition can be encoded with AC-3 1271 5.1 while a Spanish rendition is encoded with AAC stereo. However, 1272 any EXT-X-STREAM-INF (Section 4.3.4.2) tag or EXT-X-I-FRAME-STREAM- 1273 INF (Section 4.3.4.3) tag which references such a Group MUST have a 1274 CODECS attribute that lists every sample format present in any 1275 Rendition in the Group, or client playback failures can occur. In 1276 the example above, the CODECS attribute would include 1277 "ac-3,mp4a.40.2". 1279 4.3.4.2. EXT-X-STREAM-INF 1281 The EXT-X-STREAM-INF tag specifies a Variant Stream, which is a set 1282 of Renditions which can be combined to play the presentation. The 1283 attributes of the tag provide information about the Variant Stream. 1285 The URI line that follows the EXT-X-STREAM-INF tag specifies a Media 1286 Playlist that carries a Rendition of the Variant Stream. The URI 1287 line is REQUIRED. Clients that do not support multiple video 1288 renditions SHOULD play this Rendition 1290 Its format is: 1292 #EXT-X-STREAM-INF:<attribute-list> 1293 <URI> 1295 The following attributes are defined: 1297 BANDWIDTH 1299 The value is a decimal-integer of bits per second. It represents 1300 the peak segment bit rate of the Variant Stream. 1302 If all the Media Segments in a Variant Stream have already been 1303 created, the BANDWIDTH value MUST be the largest sum of peak 1304 segment bit rates that is produced by any playable combination of 1305 Renditions. (For a Variant Stream with a single Media Playlist, 1306 this is just the peak segment bit rate of that Media Playlist.) 1307 An inaccurate value can cause playback stalls or prevent clients 1308 from playing the variant. 1310 If the Master Playlist is to be made available before all Media 1311 Segments in the presentation have been encoded, the BANDWIDTH 1312 value SHOULD be the BANDWIDTH value of a representative period of 1313 similar content, encoded using the same settings. 1315 Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. 1317 AVERAGE-BANDWIDTH 1319 The value is a decimal-integer of bits per second. It represents 1320 the average segment bit rate of the Variant Stream. 1322 If all the Media Segments in a Variant Stream have already been 1323 created, the AVERAGE-BANDWIDTH value MUST be the largest sum of 1324 average segment bit rates that is produced by any playable 1325 combination of Renditions. (For a Variant Stream with a single 1326 Media Playlist, this is just the average segment bit rate of that 1327 Media Playlist.) An inaccurate value can cause playback stalls or 1328 prevent clients from playing the variant. 1330 If the Master Playlist is to be made available before all Media 1331 Segments in the presentation have been encoded, the AVERAGE- 1332 BANDWIDTH value SHOULD be the AVERAGE-BANDWIDTH value of a 1333 representative period of similar content, encoded using the same 1334 settings. 1336 The AVERAGE-BANDWIDTH attribute is OPTIONAL. 1338 CODECS 1340 The value is a quoted-string containing a comma-separated list of 1341 formats, where each format specifies a media sample type that is 1342 present in one or more Renditions specified by the Variant Stream. 1343 Valid format identifiers are those in the ISO Base Media File 1344 Format Name Space defined by The 'Codecs' and 'Profiles' 1345 Parameters for "Bucket" Media Types [RFC6381]. 1347 For example, a stream containing AAC-LC audio and H.264 Main 1348 Profile Level 3.0 video would have a CODECS value of 1349 "mp4a.40.2,avc1.4d401e". 1351 Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. 1353 RESOLUTION 1354 The value is a decimal-resolution describing the optimal pixel 1355 resolution at which to display all the video in the Variant 1356 Stream. 1358 The RESOLUTION attribute is OPTIONAL but is recommended if the 1359 Variant Stream includes video. 1361 FRAME-RATE 1363 The value is a decimal-floating-point describing the maximum frame 1364 rate for all the video in the Variant Stream, rounded to 3 decimal 1365 places. 1367 The FRAME-RATE attribute is OPTIONAL but is recommended if the 1368 Variant Stream includes video. The FRAME-RATE attribute SHOULD be 1369 included if any video in a Variant Stream exceeds 30 frames per 1370 second. 1372 HDCP-LEVEL 1374 The value is an enumerated-string; valid strings are TYPE-0 and 1375 NONE. This attribute is advisory; a value of TYPE-0 indicates 1376 that the Variant Stream could fail to play unless the output is 1377 protected by HDCP Type 0 [HDCP] or equivalent. A value of NONE 1378 indicates that the content does not require output copy 1379 protection. 1381 Encrypted Variant Streams with different HDCP levels SHOULD use 1382 different media encryption keys. 1384 The HDCP-LEVEL attribute is OPTIONAL. It SHOULD be present if any 1385 content in the Variant Stream will fail to play without HDCP. 1386 Clients without output copy protection SHOULD NOT load a Variant 1387 Stream with an HDCP-LEVEL attribute unless its value is NONE. 1389 AUDIO 1391 The value is a quoted-string. It MUST match the value of the 1392 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1393 Playlist whose TYPE attribute is AUDIO. It indicates the set of 1394 audio Renditions that SHOULD be used when playing the 1395 presentation. See Section 4.3.4.2.1. 1397 The AUDIO attribute is OPTIONAL. 1399 VIDEO 1400 The value is a quoted-string. It MUST match the value of the 1401 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1402 Playlist whose TYPE attribute is VIDEO. It indicates the set of 1403 video Renditions that SHOULD be used when playing the 1404 presentation. See Section 4.3.4.2.1. 1406 The VIDEO attribute is OPTIONAL. 1408 SUBTITLES 1410 The value is a quoted-string. It MUST match the value of the 1411 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1412 Playlist whose TYPE attribute is SUBTITLES. It indicates the set 1413 of subtitle Renditions that can be used when playing the 1414 presentation. See Section 4.3.4.2.1. 1416 The SUBTITLES attribute is OPTIONAL. 1418 CLOSED-CAPTIONS 1420 The value can be either a quoted-string or an enumerated-string 1421 with the value NONE. If the value is a quoted-string, it MUST 1422 match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag 1423 elsewhere in the Playlist whose TYPE attribute is CLOSED-CAPTIONS, 1424 and indicates the set of closed-caption Renditions that can be 1425 used when playing the presentation. See Section 4.3.4.2.1. 1427 If the value is the enumerated-string value NONE, all EXT-X 1428 -STREAM-INF tags MUST have this attribute with a value of NONE, 1429 indicating that there are no closed captions in any Variant Stream 1430 in the Master Playlist. Having closed captions in one Variant 1431 Stream but not another can trigger playback inconsistencies. 1433 The CLOSED-CAPTIONS attribute is OPTIONAL. 1435 4.3.4.2.1. Alternative Renditions 1437 When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, SUBTITLES, or 1438 CLOSED-CAPTIONS attribute, it indicates that alternative Renditions 1439 of the content are available for playback of that Variant Stream. 1441 When defining alternative Renditions, the following constraints MUST 1442 be met to prevent client playback errors: 1444 o All playable combinations of Renditions associated with an EXT-X 1445 -STREAM-INF tag MUST have an aggregate bandwidth less than or 1446 equal to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. 1448 o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a 1449 VIDEO attribute, then every alternative video Rendition MUST have 1450 an optimal display resolution matching the value of the RESOLUTION 1451 attribute. 1453 o Every alternative Rendition associated with an EXT-X-STREAM-INF 1454 tag MUST meet the constraints for a Variant Stream described in 1455 Section 6.2.4. 1457 The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media 1458 type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. 1459 If the media type is VIDEO or AUDIO, a missing URI attribute 1460 indicates that the media data for this Rendition is included in the 1461 Media Playlist of any EXT-X-STREAM-INF tag referencing this 1462 EXT-X-MEDIA tag. If the media TYPE is AUDIO and the URI attribute is 1463 missing, clients MUST assume that the audio data for this Rendition 1464 is present in every video Rendition specified by the EXT-X-STREAM-INF 1465 tag. 1467 The URI attribute of the EXT-X-MEDIA tag MUST NOT be included if the 1468 media type is CLOSED-CAPTIONS. 1470 4.3.4.3. EXT-X-I-FRAME-STREAM-INF 1472 The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file 1473 containing the I-frames of a multimedia presentation. It stands 1474 alone, in that it does not apply to a particular URI in the Master 1475 Playlist. Its format is: 1477 #EXT-X-I-FRAME-STREAM-INF:<attribute-list> 1479 All attributes defined for the EXT-X-STREAM-INF tag (Section 4.3.4.2) 1480 are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the 1481 FRAME-RATE, AUDIO, SUBTITLES and CLOSED-CAPTIONS attributes. In 1482 addition, the following attribute is defined: 1484 URI 1486 The value is a quoted-string containing a URI that identifies the 1487 I-frame Media Playlist file. That Playlist file MUST contain an 1488 EXT-X-I-FRAMES-ONLY tag. 1490 Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute 1491 and a URI attribute. 1493 The provisions in Section 4.3.4.2.1 also apply to EXT-X-I-FRAME- 1494 STREAM-INF tags with a VIDEO attribute. 1496 A Master Playlist that specifies alternative VIDEO Renditions and 1497 I-frame Playlists SHOULD include an alternative I-frame VIDEO 1498 Rendition for each regular VIDEO Rendition, with the same NAME and 1499 LANGUAGE attributes. 1501 4.3.4.4. EXT-X-SESSION-DATA 1503 The EXT-X-SESSION-DATA tag allows arbitrary session data to be 1504 carried in a Master Playlist. 1506 Its format is: 1508 #EXT-X-SESSION-DATA:<attribute-list> 1510 The following attributes are defined: 1512 DATA-ID 1514 The value of DATA-ID is a quoted-string which identifies that data 1515 value. The DATA-ID SHOULD conform to a reverse DNS naming 1516 convention, such as "com.example.movie.title"; however, there is 1517 no central registration authority, so Playlist authors SHOULD take 1518 care to choose a value which is unlikely to collide with others. 1519 This attribute is REQUIRED. 1521 VALUE 1523 VALUE is a quoted-string. It contains the data identified by 1524 DATA-ID. If the LANGUAGE is specified, VALUE SHOULD contain a 1525 human-readable string written in the specified language. 1527 URI 1529 The value is a quoted-string containing a URI. The resource 1530 identified by the URI MUST be formatted as JSON [RFC7159]; 1531 otherwise, clients may fail to interpret the resource. 1533 LANGUAGE 1535 The value is a quoted-string containing a language tag [RFC5646] 1536 that identifies the language of the VALUE. This attribute is 1537 OPTIONAL. 1539 Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI 1540 attribute, but not both. 1542 A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same 1543 DATA-ID attribute. A Playlist MUST NOT contain more than one EXT-X 1544 -SESSION-DATA tag with the same DATA-ID attribute and the same 1545 LANGUAGE attribute. 1547 4.3.4.5. EXT-X-SESSION-KEY 1549 The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists 1550 to be specified in a Master Playlist. This allows the client to 1551 preload these keys without having to read the Media Playlist(s) 1552 first. 1554 Its format is: 1556 #EXT-X-SESSION-KEY:<attribute-list> 1558 All attributes defined for the EXT-X-KEY tag (Section 4.3.2.4) are 1559 also defined for the EXT-X-SESSION-KEY, except that the value of the 1560 METHOD attribute MUST NOT be NONE. If an EXT-X-SESSION-KEY is used, 1561 the values of the METHOD, KEYFORMAT and KEYFORMATVERSIONS attributes 1562 MUST match any EXT-X-KEY with the same URI value. 1564 EXT-X-SESSION-KEY tags SHOULD be added if multiple Variant Streams or 1565 Renditions use the same encryption keys and formats. A EXT-X 1566 -SESSION-KEY tag is not associated with any particular Media 1567 Playlist. 1569 A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY 1570 tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS 1571 attribute values. 1573 The EXT-X-SESSION-KEY tag is optional. 1575 4.3.5. Media or Master Playlist Tags 1577 The tags in this section can appear in either Master Playlists or 1578 Media Playlists. If one of these tags appears in a Master Playlist, 1579 it SHOULD NOT appear in any Media Playlist referenced by that Master 1580 Playlist. A tag that appears in both MUST have the same value; 1581 otherwise, clients SHOULD ignore the value in the Media Playlist(s). 1583 These tags MUST NOT appear more than once in a Playlist. If a tag 1584 appears more than once, clients MUST reject the playlist. 1586 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS 1588 The EXT-X-INDEPENDENT-SEGMENTS tag indicates that all media samples 1589 in a Media Segment can be decoded without information from other 1590 segments. It applies to every Media Segment in the Playlist. 1592 Its format is: 1594 #EXT-X-INDEPENDENT-SEGMENTS 1596 If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master Playlist, 1597 it applies to every Media Segment in every Media Playlist in the 1598 Master Playlist. 1600 4.3.5.2. EXT-X-START 1602 The EXT-X-START tag indicates a preferred point at which to start 1603 playing a Playlist. By default, clients SHOULD start playback at 1604 this point when beginning a playback session. This tag is OPTIONAL. 1606 Its format is: 1608 #EXT-X-START:<attribute-list> 1610 The following attributes are defined: 1612 TIME-OFFSET 1614 The value of TIME-OFFSET is a signed-decimal-floating-point number 1615 of seconds. A positive number indicates a time offset from the 1616 beginning of the Playlist. A negative number indicates a negative 1617 time offset from the end of the last Media Segment in the 1618 Playlist. This attribute is REQUIRED. 1620 The absolute value of TIME-OFFSET SHOULD NOT be larger than the 1621 Playlist duration. If the absolute value of TIME-OFFSET exceeds 1622 the duration of the Playlist, it indicates either the end of the 1623 Playlist (if positive) or the beginning of the Playlist (if 1624 negative). 1626 If the Playlist does not contain the EXT-X-ENDLIST tag, the TIME- 1627 OFFSET SHOULD NOT be within three target durations of the end of 1628 the Playlist file. 1630 PRECISE 1632 The value is an enumerated-string; valid strings are YES and NO. 1633 If the value is YES, clients SHOULD start playback at the Media 1634 Segment containing the TIME-OFFSET, but SHOULD NOT render media 1635 samples in that segment whose presentation times are prior to the 1636 TIME-OFFSET. If the value is NO, clients SHOULD attempt to render 1637 every media sample in that segment. This attribute is OPTIONAL. 1638 If it is missing, its value should be treated as NO. 1640 5. Key files 1642 5.1. Structure of Key files 1644 An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key 1645 file contains a cipher key that can decrypt Media Segments in the 1646 Playlist. 1648 [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an 1649 EXT-X-KEY tag is "identity", the Key file is a single packed array of 1650 16 octets in binary format. 1652 5.2. IV for [AES_128] 1654 [AES_128] REQUIRES the same 16-octet Initialization Vector (IV) to be 1655 supplied when encrypting and decrypting. Varying this IV increases 1656 the strength of the cipher. 1658 An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" 1659 specifies an Initialization Vector that can be used when decrypting 1660 Media Segments encrypted with that Key file. IV values for AES-128 1661 are 128-bit numbers. 1663 An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an 1664 IV attribute indicates that the Media Sequence Number is to be used 1665 as the IV when decrypting a Media Segment, by putting its big-endian 1666 binary representation into a 16-octet (128-bit) buffer and padding 1667 (on the left) with zeros. 1669 6. Client/Server Responsibilities 1671 6.1. Introduction 1673 This section describes how the server generates the Playlist and 1674 Media Segments and how the client should download them for playback. 1676 6.2. Server Responsibilities 1678 6.2.1. General Server Responsibilities 1680 The production of the source media is outside the scope of this 1681 document, which simply presumes a source of continuous encoded media 1682 containing the presentation. 1684 The server MUST divide the source media into individual Media 1685 Segments whose duration is less than or equal to a constant target 1686 duration. Segments that are longer than the planned target duration 1687 can trigger playback stalls and other errors. 1689 The server SHOULD attempt to divide the source media at points that 1690 support effective decode of individual Media Segments, e.g. on packet 1691 and key frame boundaries. 1693 The server MUST create a URI for every Media Segment that enables its 1694 clients to obtain the segment data. If a server supports partial 1695 loading of resources (e.g. via HTTP Range requests), it MAY specify 1696 segments as sub-ranges of larger resources using the EXT-X-BYTERANGE 1697 tag. 1699 Any Media Segment that is specified in a Playlist loaded by a client 1700 MUST be available for immediate download, or playback errors can 1701 occur. Once download starts, its transfer rate SHOULD NOT be 1702 constrained by the segment production process. 1704 HTTP servers SHOULD transfer text files - such as Playlists and 1705 WebVTT segments - using the "gzip" Content-Encoding if the client 1706 indicates that it is prepared to accept it. 1708 The server must create a Media Playlist file (Section 4) that 1709 contains a URI for each Media Segment that the server wishes to make 1710 available, in the order in which they are to be played. 1712 The value of the EXT-X-VERSION tag (Section 4.3.1.2) SHOULD NOT be 1713 greater than what is required for the tags and attributes in the 1714 Playlist - see Section 7. 1716 Changes to the Playlist file MUST be made atomically from the point 1717 of view of the clients, or playback errors MAY occur. 1719 The server MUST NOT change the Media Playlist file, except to: 1721 Append lines to it (Section 6.2.1). 1723 Remove Media Segment URIs from the Playlist in the order that they 1724 appear, along with any tags that apply only to those segments 1725 (Section 6.2.2). 1727 Increment the value of the EXT-X-MEDIA-SEQUENCE or EXT-X 1728 -DISCONTINUITY-SEQUENCE tags (Section 6.2.2). 1730 Add an EXT-X-ENDLIST tag to the Playlist (Section 6.2.1). 1732 A Media Playlist has further constraints on its updates if it 1733 contains an EXT-X-PLAYLIST-TYPE tag. An EXT-X-PLAYLIST-TYPE tag with 1734 a value of VOD indicates that the Playlist file MUST NOT change. An 1735 EXT-X-PLAYLIST-TYPE tag with a value of EVENT indicates that the 1736 server MUST NOT change or delete any part of the Playlist file; it 1737 MAY append lines to it. 1739 The value of the EXT-X-TARGETDURATION tag in the Media Playlist MUST 1740 NOT change. A typical target duration is 10 seconds. 1742 Playlist changes other than those allowed here can trigger playback 1743 errors and inconsistent client behavior. 1745 Each Media Segment in a Media Playlist has an integer Discontinuity 1746 Sequence Number. The Discontinuity Sequence Number can be used in 1747 addition to the timestamps within the media to synchronize Media 1748 Segments across different Renditions. 1750 A segment's Discontinuity Sequence Number is the value of the EXT-X 1751 -DISCONTINUITY-SEQUENCE tag (or zero if none) plus the number of 1752 EXT-X-DISCONTINUITY tags in the Playlist preceding the URI line of 1753 the segment. 1755 The server MAY associate an absolute date and time with a Media 1756 Segment by applying an EXT-X-PROGRAM-DATE-TIME tag to it. This 1757 defines an informative mapping of the (wall-clock) date and time 1758 specified by the tag to the first media timestamp in the segment, 1759 which may be used as a basis for seeking, for display, or for other 1760 purposes. If a server provides this mapping, it SHOULD apply an 1761 EXT-X-PROGRAM-DATE-TIME tag to every segment that has an 1762 EXT-X-DISCONTINUITY tag applied to it. 1764 The Server MUST NOT add any EXT-X-PROGRAM-DATE-TIME tag to a Playlist 1765 that would cause the mapping between program date and Media Segment 1766 to become ambiguous. 1768 The server MUST NOT remove an EXT-X-DATERANGE tag from a Playlist if 1769 any date in the range maps to a Media Segment in the Playlist. 1771 The server MUST NOT reuse the ID attribute value of an 1772 EXT-X-DATERANGE tag for any new Date Range in the same Playlist. 1774 Once the Following Range of a Date Range with an END-ON-NEXT=YES 1775 attribute is added to a Playlist, the Server MUST NOT subsequently 1776 add a Date Range with the same CLASS attribute whose START-DATE is 1777 between that of the END-ON-NEXT=YES range and its Following Range. 1779 For Date Ranges with a PLANNED-DURATION attribute, the Server SHOULD 1780 signal the actual end of the range once it has been established. It 1781 can do so by adding another EXT-X-DATERANGE tag with the same ID 1782 attribute value and either a DURATION or an END-DATE attribute or, if 1783 the Date Range has an END-ON-NEXT=YES attribute, by adding a 1784 Following Range. 1786 If the Media Playlist contains the final Media Segment of the 1787 presentation then the Playlist file MUST contain the EXT-X-ENDLIST 1788 tag; this allows clients to minimize unproductive Playlist reloads. 1790 If a Media Playlist does not contain the EXT-X-ENDLIST tag, the 1791 server MUST make a new version of the Playlist file available that 1792 contains at least one new Media Segment. It MUST be made available 1793 relative to the time that the previous version of the Playlist file 1794 was made available: no earlier than one-half the target duration 1795 after that time, and no later than 1.5 times the target duration 1796 after that time. This allows clients to utilize the network 1797 efficiently. 1799 If the server wishes to remove an entire presentation, it SHOULD 1800 provide a clear indication to clients that the Playlist file is no 1801 longer available (e.g. with an HTTP 404 or 410 response). It MUST 1802 ensure that all Media Segments in the Playlist file remain available 1803 to clients for at least the duration of the Playlist file at the time 1804 of removal to prevent interruption of in-progress playback. 1806 6.2.2. Live Playlists 1808 The server MAY limit the availability of Media Segments by removing 1809 Media Segments from the Playlist file (Section 6.2.1). If Media 1810 Segments are to be removed, the Playlist file MUST contain an EXT-X 1811 -MEDIA-SEQUENCE tag. Its value MUST be incremented by 1 for every 1812 Media Segment that is removed from the Playlist file; it MUST NOT 1813 decrease or wrap. Clients can malfunction if each Media Segment does 1814 not have a consistent, unique Media Sequence Number. 1816 Media Segments MUST be removed from the Playlist file in the order 1817 that they appear in the Playlist; otherwise, client playback can 1818 malfunction. 1820 The server MUST NOT remove a Media Segment from a Playlist file 1821 without an EXT-X-ENDLIST tag if that would produce a Playlist whose 1822 duration is less than three times the target duration. Doing so can 1823 trigger playback stalls. 1825 When the server removes a Media Segment URI from the Playlist, the 1826 corresponding Media Segment MUST remain available to clients for a 1827 period of time equal to the duration of the segment plus the duration 1828 of the longest Playlist file distributed by the server containing 1829 that segment. Removing a Media Segment earlier than that can 1830 interrupt in-progress playback. 1832 If the server wishes to remove segments from a Media Playlist 1833 containing an EXT-X-DISCONTINUITY tag, the Media Playlist MUST 1834 contain an EXT-X-DISCONTINUITY-SEQUENCE tag. Without the EXT-X 1835 -DISCONTINUITY-SEQUENCE tag, it can be impossible for a client to 1836 locate corresponding segments between Renditions. 1838 If the server removes an EXT-X-DISCONTINUITY tag from the Media 1839 Playlist, it MUST increment the value of the EXT-X-DISCONTINUITY- 1840 SEQUENCE tag so that the Discontinuity Sequence Numbers of the 1841 segments still in the Media Playlist remain unchanged. The value of 1842 the EXT-X-DISCONTINUITY-SEQUENCE tag MUST NOT decrease or wrap. 1843 Clients can malfunction if each Media Segment does not have a 1844 consistent Discontinuity Sequence Number. 1846 If a server plans to remove a Media Segment after it is delivered to 1847 clients over HTTP, it SHOULD ensure that the HTTP response contains 1848 an Expires header that reflects the planned time-to-live. 1850 A Live Playlist MUST NOT contain the EXT-X-PLAYLIST-TYPE tag, as no 1851 value of that tag allows Media Segments to be removed. 1853 6.2.3. Encrypting Media Segments 1855 Media Segments MAY be encrypted. Every encrypted Media Segment MUST 1856 have an EXT-X-KEY tag (Section 4.3.2.4) applied to it with a URI that 1857 the client can use to obtain a Key file (Section 5) containing the 1858 decryption key. 1860 A Media Segment can only be encrypted with one encryption METHOD, 1861 using one encryption key and IV. However, a server MAY offer 1862 multiple ways to retrieve that key by providing multiple EXT-X-KEY 1863 tags, each with a different KEYFORMAT attribute value. 1865 The server MAY set the HTTP Expires header in the key response to 1866 indicate the duration for which the key can be cached. 1868 If an encrypted Media Segment is followed by one or more unencrypted 1869 Media Segments in the Playlist, the unencrypted Media Segments MUST 1870 have an EXT-X-KEY tag whose METHOD is NONE applied to them. 1871 Otherwise, the client will misinterpret those segments as encrypted. 1873 If the encryption METHOD is AES-128 and the Playlist does not contain 1874 the EXT-X-I-FRAMES-ONLY tag, AES encryption as described in 1875 Section 4.3.2.4 SHALL be applied to individual Media Segments. 1877 If the encryption METHOD is AES-128 and the Playlist contains an 1878 EXT-X-I-FRAMES-ONLY tag, the entire resource MUST be encrypted using 1879 AES-128 CBC with PKCS7 padding [RFC5652]. Encryption MAY be 1880 restarted on 16-byte block boundaries, unless the first block 1881 contains an I-frame. The IV used for encryption MUST be either the 1882 Media Sequence Number of the Media Segment or the value of the IV 1883 attribute of the EXT-X-KEY tag, as described in Section 5.2. These 1884 constraints allow a client to load and decrypt individual I-frames 1885 specified as sub-ranges of regular encrypted Media Segments, and 1886 their Media Initialization Sections. 1888 If the encryption METHOD is SAMPLE-AES, media samples MAY be 1889 encrypted prior to encapsulation in a Media Segment. 1891 The server MUST NOT remove an EXT-X-KEY tag from the Playlist file if 1892 it applies to any Media Segment in the Playlist file, or clients who 1893 subsequently load that Playlist will be unable to decrypt those Media 1894 Segments. 1896 6.2.4. Providing Variant Streams 1898 A server MAY offer multiple Media Playlist files to provide different 1899 encodings of the same presentation. If it does so it SHOULD provide 1900 a Master Playlist file that lists each Variant Stream to allow 1901 clients to switch between encodings dynamically. 1903 Master Playlists describe regular Variant Streams with EXT-X-STREAM- 1904 INF tags and I-frame Variant Streams with EXT-X-I-FRAME-STREAM-INF 1905 tags. 1907 If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains 1908 the CODECS attribute, the attribute value MUST include every media 1909 format [RFC6381] present in any Media Segment in any of the 1910 Renditions specified by the Variant Stream. 1912 The server MUST meet the following constraints when producing Variant 1913 Streams in order to allow clients to switch between them seamlessly: 1915 Each Variant Stream MUST present the same content. 1917 Matching content in Variant Streams MUST have matching timestamps. 1918 This allows clients to synchronize the media. 1920 Matching content in Variant Streams MUST have matching 1921 Discontinuity Sequence Numbers - see Section 4.3.3.3. 1923 Each Media Playlist in each Variant Stream MUST have the same 1924 target duration. The only exceptions are SUBTITLES Renditions and 1925 Media Playlists containing an EXT-X-I-FRAMES-ONLY tag, which MAY 1926 have different target durations if they have an EXT-X-PLAYLIST- 1927 TYPE of VOD. 1929 Content that appears in a Media Playlist of one Variant Stream but 1930 not in another MUST appear either at the beginning or at the end 1931 of the Media Playlist file and MUST NOT be longer than the target 1932 duration. 1934 If any Media Playlists have an EXT-X-PLAYLIST-TYPE tag, all Media 1935 Playlists MUST have the EXT-X-PLAYLIST-TYPE tag with the same 1936 value. 1938 If the Playlist contains an EXT-X-PLAYLIST-TYPE tag with the value 1939 of VOD, the first segment of every Media Playlist in every Variant 1940 Stream MUST start at the same media timestamp. 1942 If any Media Playlist in a Master Playlist contains an EXT-X 1943 -PROGRAM-DATE-TIME tag, then all Media Playlists in that Master 1944 Playlist MUST contain EXT-X-PROGRAM-DATE-TIME tags with consistent 1945 mappings of date and time to media timestamps. 1947 Each Variant Stream MUST contain the same set of Date Ranges, each 1948 one identified by EXT-X-DATERANGE tag(s) with the same ID 1949 attribute value and containing the same set of attributes / value 1950 pairs. 1952 In addition, for broadest compatibility, Variant Streams SHOULD 1953 contain the same encoded audio bitstream. This allows clients to 1954 switch between Variant Streams without audible glitching. 1956 The rules for Variant Streams also apply to alternative Renditions - 1957 see Section 4.3.4.2.1. 1959 6.3. Client Responsibilities 1961 6.3.1. General Client Responsibilities 1963 How the client obtains the URI to the Playlist file is outside the 1964 scope of this document; it is presumed to have done so. 1966 The client obtains the Playlist file from the URI. If the Playlist 1967 file so obtained is a Master Playlist, the client can select a 1968 Variant Stream to load from the Master Playlist. 1970 Clients MUST ensure that loaded Playlists comply with Section 4 and 1971 that the EXT-X-VERSION tag, if present, specifies a protocol version 1972 supported by the client; if either check fails, the client MUST NOT 1973 attempt to use the Playlist, or unintended behavior could occur. 1975 If any URI element in a Playlist contains an URI scheme that the 1976 client cannot handle, the client MUST stop playback. All clients 1977 MUST support HTTP schemes. 1979 To support forward compatibility, when parsing Playlists, Clients 1980 MUST: 1982 o ignore any unrecognized tags. 1984 o ignore any Attribute/value pair with an unrecognized 1985 AttributeName. 1987 o ignore any tag containing an attribute/value pair of type 1988 enumerated-string whose AttributeName is recognized but whose 1989 AttributeValue is not recognized, unless the definition of the 1990 attribute says otherwise. 1992 Algorithms used by the client to switch between Variant Streams are 1993 beyond the scope of this document. 1995 6.3.2. Loading the Media Playlist file 1997 Every time a Media Playlist is loaded or reloaded from a Playlist 1998 URI, the client MUST determine the next Media Segment to load, as 1999 described in Section 6.3.5, if it intends to play the presentation 2000 normally (i.e., in playlist order at the nominal playback rate). 2002 If the Media Playlist contains the EXT-X-MEDIA-SEQUENCE tag, the 2003 client SHOULD assume that each Media Segment in it will become 2004 unavailable at the time that the Playlist file was loaded plus the 2005 duration of the Playlist file. 2007 A client MAY use the segment Media Sequence Number to track the 2008 location of a Media Segment within a Playlist when the Playlist is 2009 reloaded. 2011 A client MUST NOT assume that segments with the same Media Sequence 2012 Number in different Variant Streams or Renditions have the same 2013 position in the presentation; Playlists MAY have independent Media 2014 Sequence Numbers. Instead, a client MUST use the relative position 2015 of each segment on the Playlist timeline and its Discontinuity 2016 Sequence Number to locate corresponding segments. 2018 A client MUST load the Media Playlist file of every Rendition 2019 selected for playback in order to locate the media specific to that 2020 Rendition. But, to prevent unnecessary load on the server, it SHOULD 2021 NOT load the Playlist file of any other Rendition. 2023 For some Variant Streams, it is possible to select Renditions that do 2024 not include the Rendition specified by the EXT-X-STREAM-INF tag. As 2025 noted above, the client SHOULD NOT load that Rendition in those 2026 cases. 2028 6.3.3. Playing the Media Playlist file 2030 The client SHALL choose which Media Segment to play first from the 2031 Media Playlist when playback starts. If the EXT-X-ENDLIST tag is not 2032 present and the client intends to play the media normally, the client 2033 SHOULD NOT choose a segment which starts less than three target 2034 durations from the end of the Playlist file. Doing so can trigger 2035 playback stalls. 2037 Normal playback can be achieved by playing the Media Segments in the 2038 order that they appear in the Playlist. The client MAY present the 2039 available media in any way it wishes, including normal playback, 2040 random access, and trick modes. 2042 The encoding parameters for samples in a Media Segment and across 2043 multiple Media Segments in a Media Playlist SHOULD remain consistent. 2044 However, clients SHOULD deal with encoding changes as they are 2045 encountered, for example by scaling video content to accommodate a 2046 resolution change. If the Variant Stream includes a RESOLUTION 2047 attribute, clients SHOULD display all video within a rectangle with 2048 the same proportions as that resolution. 2050 Clients SHOULD be prepared to handle multiple tracks of a particular 2051 type (e.g. audio or video). A client with no other preference SHOULD 2052 choose the track with the lowest numerical track identifier that it 2053 can play. 2055 Clients SHOULD ignore private streams inside Transport Streams that 2056 they do not recognize. Private streams can be used to support 2057 different devices with the same stream, although stream authors 2058 SHOULD be sensitive to the additional network load that this imposes. 2060 The client MUST be prepared to reset its parser(s) and decoder(s) 2061 before playing a Media Segment that has an EXT-X-DISCONTINUITY tag 2062 applied to it, otherwise playback errors can occur. 2064 The client SHOULD attempt to load Media Segments in advance of when 2065 they will be required for uninterrupted playback to compensate for 2066 temporary variations in latency and throughput. 2068 The client MAY use the value of the EXT-X-PROGRAM-DATE-TIME tag to 2069 display the program origination time to the user. If the value 2070 includes time zone information, the client SHALL take it into 2071 account; if it does not the client MAY assume the time to be local. 2073 Note that dates in Playlists can refer to when the content was 2074 produced (or to other times), which have no relation to the time of 2075 playback. 2077 If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after 2078 one or more media segment URIs, the client SHOULD extrapolate 2079 backward from that tag (using EXTINF durations and/or media 2080 timestamps) to associate dates with those segments. To associate a 2081 date with any other media segment that does not have an EXT-X 2082 -PROGRAM-DATE-TIME tag applied to it directly , the client SHOULD 2083 extrapolate forward from the last EXT-X-PROGRAM-DATE-TIME tag 2084 appearing before that segment in the Playlist. 2086 6.3.4. Reloading the Media Playlist file 2088 The client MUST periodically reload a Media Playlist file to learn 2089 what media is currently available, unless it contains an EXT-X 2090 -PLAYLIST-TYPE tag with a value of VOD, or a value of EVENT and the 2091 EXT-X-ENDLIST tag is also present. 2093 However the client MUST NOT attempt to reload the Playlist file more 2094 frequently than specified by this section, in order to limit the 2095 collective load on the server. 2097 When a client loads a Playlist file for the first time or reloads a 2098 Playlist file and finds that it has changed since the last time it 2099 was loaded, the client MUST wait for at least the target duration 2100 before attempting to reload the Playlist file again, measured from 2101 the last time the client began loading the Playlist file. 2103 If the client reloads a Playlist file and finds that it has not 2104 changed then it MUST wait for a period of one-half the target 2105 duration before retrying. 2107 After reloading a Media Playlist, the client SHOULD verify that each 2108 Media Segment in it has the same URI (and byte range, if specified) 2109 as the Media Segment with the same Media Sequence Number in the 2110 previous Media Playlist. It SHOULD halt playback if it does not, as 2111 this normally indicates a server error. 2113 In order to reduce server load, the client SHOULD NOT reload the 2114 Playlist files of Variant Streams or alternate Renditions that are 2115 not currently being played. If it decides to switch playback to a 2116 different Variant Stream, it SHOULD stop reloading the Playlist of 2117 the old Variant Stream and begin loading the Playlist of the new 2118 Variant Stream. It can use the EXTINF durations and the constraints 2119 in Section 6.2.4 to determine the approximate location of 2120 corresponding media. Once media from the new Variant Stream has been 2121 loaded, the timestamps in the Media Segments can be used to 2122 synchronize the old and new timelines precisely. 2124 A client MUST NOT attempt to use the Media Sequence Number to 2125 synchronize between streams - see Section 6.3.2. 2127 6.3.5. Determining the next segment to load 2129 The client MUST examine the Media Playlist file every time it is 2130 loaded or reloaded to determine the next Media Segment to load, as 2131 the set of available media MAY have changed. 2133 The first segment to load is generally the segment that the client 2134 has chosen to play first - see Section 6.3.3. 2136 In order to play the presentation normally, the next Media Segment to 2137 load is the one with the lowest Media Sequence Number that is greater 2138 than the Media Sequence Number of the last Media Segment loaded. 2140 6.3.6. Decrypting encrypted Media Segments 2142 If a Media Playlist file contains an EXT-X-KEY tag that specifies a 2143 Key file URI, the client can obtain that Key file and use the key 2144 inside it to decrypt all Media Segments to which that EXT-X-KEY tag 2145 applies. 2147 A client MUST ignore any EXT-X-KEY tag with an unsupported or 2148 unrecognized KEYFORMAT attribute, to allow for cross-device 2149 addressibility. If the Playlist contains a Media Segment to which 2150 only EXT-X-KEY tags with unrecognized or unsupported KEYFORMAT 2151 attributes are applied, playback SHOULD fail. 2153 A client MUST NOT attempt to decrypt any segments whose EXT-X-KEY tag 2154 has a METHOD attribute that it does not recognize. 2156 If the encryption METHOD is AES-128, AES-128 CBC decryption SHALL be 2157 applied to individual Media Segments, whose encryption format is 2158 described in Section 4.3.2.4. 2160 If the encryption METHOD is AES-128 and the Media Segment is part of 2161 an I-frame playlist (Section 4.3.3.6) and it has an EXT-X-BYTERANGE 2162 tag applied to it, special care needs to be taken in loading and 2163 decrypting the segment, because the resource identified by the URI is 2164 encrypted in 16-byte blocks from the start of the resource. 2166 The decrypted I-frame can be recovered by first widening its byte 2167 range, as specified by the EXT-X-BYTERANGE tag, so that it starts and 2168 ends on 16-byte boundaries from the start of the resource. 2170 Next, the byte range is widened further to include a 16-byte block at 2171 the beginning of the range. This 16-byte block allows the correct IV 2172 for the following block to be calculated. 2174 The widened byte range can then be loaded and decrypted with AES-128 2175 CBC using an arbitrary IV. The number of bytes added to the 2176 beginning and the end of the original byte range are discarded from 2177 the decrypted bytes; what remains is the decrypted I-frame. 2179 If the encryption METHOD is SAMPLE-AES, AES-128 decryption SHALL be 2180 applied to encrypted media samples within the Media Segment. 2182 An EXT-X-KEY tag with a METHOD of NONE indicates that the Media 2183 Segments it applies to are not encrypted. 2185 7. Protocol version compatibility 2187 Protocol compatibility is specified by the EXT-X-VERSION tag. A 2188 Playlist that contains tags or attributes that are not compatible 2189 with protocol version 1 MUST include an EXT-X-VERSION tag. 2191 A client MUST NOT attempt playback if it does not support the 2192 protocol version specified by the EXT-X-VERSION tag, or unintended 2193 behavior could occur. 2195 A Media Playlist MUST indicate a EXT-X-VERSION of 2 or higher if it 2196 contains: 2198 o The IV attribute of the EXT-X-KEY tag. 2200 A Media Playlist MUST indicate a EXT-X-VERSION of 3 or higher if it 2201 contains: 2203 o Floating-point EXTINF duration values. 2205 A Media Playlist MUST indicate a EXT-X-VERSION of 4 or higher if it 2206 contains: 2208 o The EXT-X-BYTERANGE tag. 2210 o The EXT-X-I-FRAMES-ONLY tag. 2212 A Media Playlist MUST indicate a EXT-X-VERSION of 5 or higher if it 2213 contains: 2215 o The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY 2216 tag. 2218 o The EXT-X-MAP tag. 2220 A Media Playlist MUST indicate a EXT-X-VERSION of 6 or higher if it 2221 contains: 2223 o The EXT-X-MAP tag in a Media Playlist that does not contain 2224 EXT-X-I-FRAMES-ONLY. 2226 A Master Playlist MUST indicate a EXT-X-VERSION of 7 or higher if it 2227 contains: 2229 o "SERVICE" values for the INSTREAM-ID attribute of the EXT-X-MEDIA 2230 tag. 2232 The EXT-X-MEDIA tag and the AUDIO, VIDEO and SUBTITLES attributes of 2233 the EXT-X-STREAM-INF tag are backward compatible to protocol version 2234 1, but playback on older clients may not be desirable. A server MAY 2235 consider indicating a EXT-X-VERSION of 4 or higher in the Master 2236 Playlist but is not required to do so. 2238 The PROGRAM-ID attribute of the EXT-X-STREAM-INF and the EXT-X-I 2239 -FRAME-STREAM-INF tags was removed in protocol version 6. 2241 The EXT-X-ALLOW-CACHE tag was removed in protocol version 7. 2243 8. Playlist Examples 2245 8.1. Simple Media Playlist 2247 #EXTM3U 2248 #EXT-X-TARGETDURATION:10 2249 #EXT-X-VERSION:3 2250 #EXTINF:9.009, 2251 http://media.example.com/first.ts 2252 #EXTINF:9.009, 2253 http://media.example.com/second.ts 2254 #EXTINF:3.003, 2255 http://media.example.com/third.ts 2256 #EXT-X-ENDLIST 2258 8.2. Live Media Playlist, using HTTPS 2259 #EXTM3U 2260 #EXT-X-VERSION:3 2261 #EXT-X-TARGETDURATION:8 2262 #EXT-X-MEDIA-SEQUENCE:2680 2264 #EXTINF:7.975, 2265 https://priv.example.com/fileSequence2680.ts 2266 #EXTINF:7.941, 2267 https://priv.example.com/fileSequence2681.ts 2268 #EXTINF:7.975, 2269 https://priv.example.com/fileSequence2682.ts 2271 8.3. Playlist with encrypted Media Segments 2273 #EXTM3U 2274 #EXT-X-VERSION:3 2275 #EXT-X-MEDIA-SEQUENCE:7794 2276 #EXT-X-TARGETDURATION:15 2278 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" 2280 #EXTINF:2.833, 2281 http://media.example.com/fileSequence52-A.ts 2282 #EXTINF:15.0, 2283 http://media.example.com/fileSequence52-B.ts 2284 #EXTINF:13.333, 2285 http://media.example.com/fileSequence52-C.ts 2287 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" 2289 #EXTINF:15.0, 2290 http://media.example.com/fileSequence53-A.ts 2292 8.4. Master Playlist 2294 #EXTM3U 2295 #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000 2296 http://example.com/low.m3u8 2297 #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000 2298 http://example.com/mid.m3u8 2299 #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000 2300 http://example.com/hi.m3u8 2301 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 2302 http://example.com/audio-only.m3u8 2304 8.5. Master Playlist with I-Frames 2306 #EXTM3U 2307 #EXT-X-STREAM-INF:BANDWIDTH=1280000 2308 low/audio-video.m3u8 2309 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=86000,URI="low/iframe.m3u8" 2310 #EXT-X-STREAM-INF:BANDWIDTH=2560000 2311 mid/audio-video.m3u8 2312 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=150000,URI="mid/iframe.m3u8" 2313 #EXT-X-STREAM-INF:BANDWIDTH=7680000 2314 hi/audio-video.m3u8 2315 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=550000,URI="hi/iframe.m3u8" 2316 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 2317 audio-only.m3u8 2319 8.6. Master Playlist with Alternative audio 2321 In this example, the CODECS attributes have been condensed for space. 2322 A '\' is used to indicate that the tag continues on the following 2323 line with whitespace removed: 2325 #EXTM3U 2326 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \ 2327 DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \ 2328 URI="main/english-audio.m3u8" 2329 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \ 2330 DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \ 2331 URI="main/german-audio.m3u8" 2332 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", \ 2333 DEFAULT=NO,AUTOSELECT=NO,LANGUAGE="en", \ 2334 URI="commentary/audio-only.m3u8" 2335 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac" 2336 low/video-only.m3u8 2337 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac" 2338 mid/video-only.m3u8 2339 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac" 2340 hi/video-only.m3u8 2341 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac" 2342 main/english-audio.m3u8 2344 8.7. Master Playlist with Alternative video 2346 This example shows 3 different video Renditions (Main, Centerfield 2347 and Dugout), and 3 different Variant Streams (low, mid and high). In 2348 this example, clients that did not support the EXT-X-MEDIA tag and 2349 the VIDEO attribute of the EXT-X-STREAM-INF tag would only be able to 2350 play the video Rendition "Main". 2352 Since the EXT-X-STREAM-INF tag has no AUDIO attribute, all video 2353 Renditions would be required to contain the audio. 2355 In this example, the CODECS attributes have been condensed for space. 2356 A '\' is used to indicate that the tag continues on the following 2357 line with whitespace removed: 2359 #EXTM3U 2360 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main", \ 2361 DEFAULT=YES,URI="low/main/audio-video.m3u8" 2362 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield", \ 2363 DEFAULT=NO,URI="low/centerfield/audio-video.m3u8" 2364 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Dugout", \ 2365 DEFAULT=NO,URI="low/dugout/audio-video.m3u8" 2367 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",VIDEO="low" 2368 low/main/audio-video.m3u8 2370 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Main", \ 2371 DEFAULT=YES,URI="mid/main/audio-video.m3u8" 2372 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Centerfield", \ 2373 DEFAULT=NO,URI="mid/centerfield/audio-video.m3u8" 2374 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Dugout", \ 2375 DEFAULT=NO,URI="mid/dugout/audio-video.m3u8" 2377 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",VIDEO="mid" 2378 mid/main/audio-video.m3u8 2380 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Main", \ 2381 DEFAULT=YES,URI="hi/main/audio-video.m3u8" 2382 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Centerfield", \ 2383 DEFAULT=NO,URI="hi/centerfield/audio-video.m3u8" 2384 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Dugout", \ 2385 DEFAULT=NO,URI="hi/dugout/audio-video.m3u8" 2387 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",VIDEO="hi" 2388 hi/main/audio-video.m3u8 2390 8.8. Session Data in a Master Playlist 2392 In this example, only the EXT-X-SESSION-DATA is shown: 2394 #EXT-X-SESSION-DATA:DATA-ID="com.example.lyrics",URI="lyrics.json" 2396 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="en", \ 2397 VALUE="This is an example" 2398 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="es", \ 2399 VALUE="Este es un ejemplo" 2401 8.9. CHARACTERISTICS attribute containing multiple characteristics 2403 Certain characteristics are valid in combination, as in: 2405 CHARACTERISTICS= 2406 "public.accessibility.transcribes-spoken-dialog,public.easy-to-read" 2408 8.10. EXT-X-DATERANGE carrying SCTE-35 tags 2410 This example shows two EXT-X-DATERANGE tags that describe a single 2411 Date Range, with a SCTE-35 "out" splice_insert() command that is 2412 subsequently updated with an SCTE-35 "in" splice_insert() command. 2414 #EXTM3U 2415 ... 2416 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11: 2417 15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF0 2418 00014056FFFFFF000E011622DCAFF000052636200000000000A0008029896F50 2419 000008700000000 2421 ... Media Segment declarations for 60s worth of media 2423 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",DURATION=59.993,SCTE35-IN= 2424 0xFC002A0000000000FF00000F056FFFFFF000401162802E6100000000000A00 2425 08029896F50000008700000000 2426 ... 2428 9. Contributors 2430 Significant contributions to the design of this protocol were made by 2431 Jim Batson, David Biderman, Bill May, Roger Pantos, Alan Tseng, and 2432 Eryk Vershen. Stuart Cheshire helped edit the specification. 2434 10. IANA Considerations 2436 This memo requests that the following MIME type [RFC2046] be 2437 registered with the IANA: 2439 Type name: "application" 2441 Subtype name: "vnd.apple.mpegurl" 2442 Required parameters: (none) 2444 Optional parameters: (none) 2446 Encoding considerations: encoded as UTF-8, which is 8-bit text. This 2447 media type may require encoding on transports not capable of handling 2448 8-bit text. See Section 4 for more information. 2450 Security considerations: See Section 11. 2452 Compression: this media type does not employ compression. 2454 Interoperability considerations: There are no byte-ordering issues, 2455 since files are 8-bit text. Applications could encounter 2456 unrecognized tags, which SHOULD be ignored. 2458 Published specification: see Section 4. 2460 Applications that use this media type: Multimedia applications such 2461 as the iPhone media player in iOS 3.0 and later and QuickTime Player 2462 in Mac OS X version 10.6 and later. 2464 Additional information: 2466 Deprecated alias names for this type: (none) 2467 Magic number(s): #EXTM3U 2468 File extension(s): .m3u8, .m3u (see Section 4) 2469 Macintosh file type code(s): (none) 2471 Fragment identifier considerations: no Fragment Identifiers are 2472 defined for this media type. 2474 Person & email address to contact for further information: David 2475 Singer, singer AT apple.com. 2477 Intended usage: LIMITED USE 2479 Restrictions on usage: (none) 2481 Author: Roger Pantos 2483 Change Controller: David Singer 2485 11. Security Considerations 2487 Since the protocol generally uses HTTP to transfer data, most of the 2488 same security considerations apply. See section 15 of HTTP 2489 [RFC7230]. 2491 Media file parsers are typically subject to "fuzzing" attacks. 2492 Implementors SHOULD pay particular attention to code that will parse 2493 data received from a server and ensure that all possible inputs are 2494 handled correctly. 2496 Playlist files contain URIs, which clients will use to make network 2497 requests of arbitrary entities. Clients SHOULD range-check responses 2498 to prevent buffer overflows. See also the Security Considerations 2499 section of Uniform Resource Identifier (URI): Generic Syntax 2500 [RFC3986]. 2502 Apart from URL resolution, this format does not employ any form of 2503 active content. 2505 Clients SHOULD limit each playback session to a reasonable number of 2506 concurrent downloads (e.g. 4) to avoid contributing to denial-of- 2507 service attacks. 2509 HTTP requests often include session state ("cookies"), which may 2510 contain private user data. Implementations MUST follow cookie 2511 restriction and expiry rules specified by HTTP State Management 2512 Mechanism [RFC6265] to protect themselves from attack. See also the 2513 Security Considerations section of that document, and Use of HTTP 2514 State Management [RFC2964]. 2516 Encryption keys are specified by URI. The delivery of these keys 2517 SHOULD be secured by a mechanism such as HTTP Over TLS [RFC2818] 2518 (formerly SSL) in conjunction with a secure realm or a session token. 2520 12. References 2522 12.1. Normative References 2524 [AC_3] Advanced Television Systems Committee, "ATSC Standard: 2525 A/52:2010: Digital Audio Compression (AC-3) (E-AC-3) 2526 Standard", November 2010, <http://atsc.org/wp-content/ 2527 uploads/2015/03/A52-201212-17.pdf>. 2529 [AES_128] U.S. Department of Commerce/National Institute of 2530 Standards and Technology, "Advanced Encryption Standard 2531 (AES), FIPS PUB 197", November 2001, <http://csrc.nist 2532 .gov/publications/fips/fips197/fips-197.pdf>. 2534 [CEA608] Consumer Electronics Association, "CEA-608-E: Line 21 Data 2535 Services", April 2008, <http://www.ce.org/Standards/ 2536 Standard-Listings/R4-3-Television-Data-Systems 2537 -Subcommittee/Line-21-Data-Service.aspx>. 2539 [CEA708] Consumer Electronics Association, "CEA-708-E (ANSI): 2540 Digital Television (DTV) Closed Captioning", August 2013, 2541 <http://www.ce.org/Standards/Standard-Listings/ 2542 R4-3-Television-Data-Systems-Subcommittee/CEA-708-D.aspx>. 2544 [COMMON_ENC] 2545 International Organization for Standardization, "ISO/IEC 2546 23001-7:2016; Information technology -- MPEG systems 2547 technologies -- Part 7: Common encryption in ISO base 2548 media file format files", February 2016, <http://www.iso 2549 .org/iso/catalogue_detail.htm?csnumber=68042>. 2551 [HDCP] Digital Content Protection LLC, "High-bandwidth Digital 2552 Content Protection System - Mapping HDCP to HDMI", 2553 February 2013, <http://www.digital-cp.com/sites/default/ 2554 files/specifications/ 2555 HDCP%20on%20HDMI%20Specification%20Rev2_2_Final1.pdf>. 2557 [H_264] International Telecommunications Union, "Advanced video 2558 coding for generic audiovisual services", January 2012, 2559 <http://www.itu.int/rec/T-REC-H.264>. 2561 [ISOBMFF] International Organization for Standardization, "ISO/IEC 2562 14496-12:2015; Information technology -- Coding of audio- 2563 visual objects -- Part 12: ISO base media file format", 2564 December 2015, <http://www.iso.org/iso/ 2565 catalogue_detail.htm?csnumber=68960>. 2567 [ISO_13818] 2568 International Organization for Standardization, "ISO/IEC 2569 International Standard 13818; Generic coding of moving 2570 pictures and associated audio information", October 2007, 2571 <http://www.iso.org/iso/catalogue_detail?csnumber=44169>. 2573 [ISO_13818_3] 2574 International Organization for Standardization, "ISO/IEC 2575 International Standard 13818-3:1998; Generic coding of 2576 moving pictures and associated audio information - Part 3: 2577 Audio", April 1998, <http://www.iso.org/iso/home/store/ 2578 catalogue_tc/catalogue_detail.htm?csnumber=26797>. 2580 [ISO_13818_7] 2581 International Organization for Standardization, "ISO/IEC 2582 International Standard 13818-3:2006; Generic coding of 2583 moving pictures and associated audio information - Part 7: 2584 Advanced Audio Coding (AAC)", January 2006, 2585 <http://www.iso.org/iso/home/store/catalogue_tc/ 2586 catalogue_detail.htm?csnumber=43345>. 2588 [ISO_14496] 2589 International Organization for Standardization, "ISO/IEC 2590 14496-3:2009 Information technology -- Coding of audio- 2591 visual objects -- Part 3: Audio", 2009, 2592 <http://www.iso.org/iso/catalogue_detail?csnumber=53943>. 2594 [ISO_8601] 2595 International Organization for Standardization, "ISO/IEC 2596 International Standard 8601:2004; Data elements and 2597 interchange formats -- Information interchange -- 2598 Representation of dates and times", December 2004, 2599 <http://www.iso.org/iso/catalogue_detail?csnumber=40874>. 2601 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2602 Extensions (MIME) Part Two: Media Types", RFC 2046, 2603 November 1996. 2605 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2606 Requirement Levels", BCP 14, RFC 2119, March 1997. 2608 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 2610 [RFC2964] Moore, K. and N. Freed, "Use of HTTP State Management", 2611 BCP 44, RFC 2964, October 2000. 2613 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2614 10646", STD 63, RFC 3629, November 2003. 2616 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2617 Resource Identifier (URI): Generic Syntax", STD 66, RFC 2618 3986, January 2005. 2620 [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying 2621 Languages", BCP 47, RFC 5646, September 2009. 2623 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 2624 RFC 5652, September 2009. 2626 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2627 April 2011. 2629 [RFC6381] Gellens, R., Singer, D., and P. Frojdh, "The 'Codecs' and 2630 'Profiles' Parameters for "Bucket" Media Types", RFC 6381, 2631 August 2011. 2633 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 2634 Interchange Format", RFC 7159, March 2014. 2636 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2637 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 2638 7230, DOI 10.17487/RFC7230, June 2014, 2639 <http://www.rfc-editor.org/info/rfc7230>. 2641 [SCTE35] Society of Cable Telecommunications Engineers, "SCTE-35 2642 (ANSI/SCTE): Digital Program Insertion Cueing Message for 2643 Cable", August 2014, <http://www.scte.org/documents/pdf/ 2644 Standards/ANSI_SCTE%2035%202014.pdf>. 2646 [US_ASCII] 2647 American National Standards Institute, "ANSI X3.4-1986, 2648 Information Systems -- Coded Character Sets 7-Bit American 2649 National Standard Code for Information Interchange (7-Bit 2650 ASCII)", December 1986. 2652 [WebVTT] World Wide Web Consortium (W3C), "WebVTT: The Web Video 2653 Text Tracks Format", July 2013, 2654 <http://dev.w3.org/html5/webvtt/>. 2656 12.2. Informative References 2658 [CMAF] International Organization for Standardization, "ISO/IEC 2659 23000-19; Information technology -- Multimedia application 2660 format (MPEG-A) -- Part 5: Common media application format 2661 (CMAF) for segmented media", <https://www.iso.org/ 2662 standard/71975.html/>. 2664 [ID3] ID3.org, "The ID3 audio file data tagging format", 2665 <http://www.id3.org/Developer_Information>. 2667 [M3U] Nullsoft, Inc., "The M3U Playlist format, originally 2668 invented for the Winamp media player", 2669 <http://wikipedia.org/wiki/M3U>. 2671 [SampleEnc] 2672 Apple Inc., "MPEG-2 Stream Encryption Format for HTTP Live 2673 Streaming", <https://developer.apple.com/library/ios/ 2674 documentation/AudioVideo/Conceptual/ 2675 HLS_Sample_Encryption/>. 2677 [UTI] Apple Inc., "Uniform Type Identifier", 2678 <http://developer.apple.com/library/ios/#documentation/ 2679 general/conceptual/DevPedia-CocoaCore/ 2680 UniformTypeIdentifier.html>. 2682 Authors' Addresses 2684 Roger Pantos (editor) 2685 Apple Inc. 2686 Cupertino, California 2687 United States 2689 Email: http-live-streaming-review@group.apple.com 2691 William May, Jr. 2692 Major League Baseball Advanced Media 2693 New York, New York 2694 United States 2696 Email: bill.may@mlb.com