idnits 2.17.1 draft-pantos-http-live-streaming-21.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- -- The document has an IETF Trust Provisions (28 Dec 2009) Section 6.c(ii) Publication Limitation clause. If this document is intended for submission to the IESG for publication, this constitutes an error. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 27, 2017) is 2586 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: September 28, 2017 Major League Baseball Advanced Media 6 March 27, 2017 8 HTTP Live Streaming 9 draft-pantos-http-live-streaming-21 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 September 28, 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 document may not be modified, and derivative works of it may not 48 be created, and it may not be published except as an Internet-Draft. 50 This Informational Internet Draft is submitted as an RFC Editor 51 Contribution and/or non-IETF Document (not as a Contribution, IETF 52 Contribution, nor IETF Document) in accordance with BCP 78 and BCP 53 79. 55 Table of Contents 57 1. Introduction to HTTP Live Streaming . . . . . . . . . . . . . 3 58 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4 59 3. Media Segments . . . . . . . . . . . . . . . . . . . . . . . 5 60 3.1. Supported Media Segment Formats . . . . . . . . . . . . . 6 61 3.2. MPEG-2 Transport Streams . . . . . . . . . . . . . . . . 6 62 3.3. Fragmented MPEG-4 . . . . . . . . . . . . . . . . . . . . 6 63 3.4. Packed Audio . . . . . . . . . . . . . . . . . . . . . . 7 64 3.5. WebVTT . . . . . . . . . . . . . . . . . . . . . . . . . 8 65 4. Playlists . . . . . . . . . . . . . . . . . . . . . . . . . . 8 66 4.1. Definition of a Playlist . . . . . . . . . . . . . . . . 9 67 4.2. Attribute Lists . . . . . . . . . . . . . . . . . . . . . 10 68 4.3. Playlist Tags . . . . . . . . . . . . . . . . . . . . . . 11 69 4.3.1. Basic Tags . . . . . . . . . . . . . . . . . . . . . 11 70 4.3.1.1. EXTM3U . . . . . . . . . . . . . . . . . . . . . 11 71 4.3.1.2. EXT-X-VERSION . . . . . . . . . . . . . . . . . . 12 72 4.3.2. Media Segment Tags . . . . . . . . . . . . . . . . . 12 73 4.3.2.1. EXTINF . . . . . . . . . . . . . . . . . . . . . 12 74 4.3.2.2. EXT-X-BYTERANGE . . . . . . . . . . . . . . . . . 13 75 4.3.2.3. EXT-X-DISCONTINUITY . . . . . . . . . . . . . . . 13 76 4.3.2.4. EXT-X-KEY . . . . . . . . . . . . . . . . . . . . 14 77 4.3.2.5. EXT-X-MAP . . . . . . . . . . . . . . . . . . . . 16 78 4.3.2.6. EXT-X-PROGRAM-DATE-TIME . . . . . . . . . . . . . 17 79 4.3.2.7. EXT-X-DATERANGE . . . . . . . . . . . . . . . . . 17 80 4.3.2.7.1. Mapping SCTE-35 into EXT-X-DATERANGE . . . . 19 81 4.3.3. Media Playlist Tags . . . . . . . . . . . . . . . . . 21 82 4.3.3.1. EXT-X-TARGETDURATION . . . . . . . . . . . . . . 21 83 4.3.3.2. EXT-X-MEDIA-SEQUENCE . . . . . . . . . . . . . . 21 84 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE . . . . . . . . . . 22 85 4.3.3.4. EXT-X-ENDLIST . . . . . . . . . . . . . . . . . . 22 86 4.3.3.5. EXT-X-PLAYLIST-TYPE . . . . . . . . . . . . . . . 23 87 4.3.3.6. EXT-X-I-FRAMES-ONLY . . . . . . . . . . . . . . . 23 88 4.3.4. Master Playlist Tags . . . . . . . . . . . . . . . . 24 89 4.3.4.1. EXT-X-MEDIA . . . . . . . . . . . . . . . . . . . 24 90 4.3.4.1.1. Rendition Groups . . . . . . . . . . . . . . 27 91 4.3.4.2. EXT-X-STREAM-INF . . . . . . . . . . . . . . . . 28 92 4.3.4.2.1. Alternative Renditions . . . . . . . . . . . 31 93 4.3.4.3. EXT-X-I-FRAME-STREAM-INF . . . . . . . . . . . . 32 94 4.3.4.4. EXT-X-SESSION-DATA . . . . . . . . . . . . . . . 33 95 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 . . . . . . . . . . . . . . . . . . . . . . . 57 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. 146 It provides a flexible framework for media encryption. It can 147 efficiently offer multiple renditions of the same content, such as 148 audio translations. It offers compatibility with large-scale HTTP 149 caching infrastructure to support delivery to large audiences. 151 Since its first draft publication in 2009, HTTP Live Streaming has 152 been implemented and deployed by a wide array of content producers, 153 tools vendors, distributors, and device manufacturers. In the 154 subsequent eight years the protocol has been refined by extensive 155 review and discussion with a variety of media streaming implementors. 157 The purpose of this document is to facilitate interoperability 158 between HTTP Live Streaming implementations by describing the media 159 transmission protocol. Using this protocol, a client can receive a 160 continuous stream of media from a server for concurrent presentation. 162 This document describes version 7 of the protocol. 164 2. Overview 166 A multimedia presentation is specified by a Uniform Resource 167 Identifier (URI) [RFC3986] to a Playlist. 169 A Playlist is either a Media Playlist or a Master Playlist. Both are 170 UTF-8 text files containing URIs and descriptive tags. 172 A Media Playlist contains a list of Media Segments, which when played 173 sequentially will play the multimedia presentation. 175 Here is an example of a Media Playlist: 177 #EXTM3U 178 #EXT-X-TARGETDURATION:10 180 #EXTINF:9.009, 181 http://media.example.com/first.ts 182 #EXTINF:9.009, 183 http://media.example.com/second.ts 184 #EXTINF:3.003, 185 http://media.example.com/third.ts 187 The first line is the format identifier tag #EXTM3U. The line 188 containing #EXT-X-TARGETDURATION says that all Media Segments will be 189 10 seconds long or less. Then three Media Segments are declared. 190 The first and second are 9.009 seconds long; the third is 3.003 191 seconds. 193 To play this Playlist, the client first downloads it and then 194 downloads and plays each Media Segment declared within it. The 195 client reloads the Playlist as described in this document to discover 196 any added segments. Data SHOULD be carried over HTTP [RFC7230], but 197 in general a URI can specify any protocol that can reliably transfer 198 the specified resource on demand. 200 A more complex presentation can be described by a Master Playlist. A 201 Master Playlist provides a set of Variant Streams, each of which 202 describes a different version of the same content. 204 A Variant Stream includes a Media Playlist that specifies media 205 encoded at a particular bit rate, in a particular format, and at a 206 particular resolution for media containing video. 208 A Variant Stream can also specify a set of Renditions. Renditions 209 are alternate versions of the content, such as audio produced in 210 different languages or video recorded from different camera angles. 212 Clients should switch between different Variant Streams to adapt to 213 network conditions. Clients should choose Renditions based on user 214 preferences. 216 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 217 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 218 document are to be interpreted as described in RFC 2119 [RFC2119]. 220 3. Media Segments 222 A Media Playlist contains a series of Media Segments which make up 223 the overall presentation. A Media Segment is specified by a URI and 224 optionally a byte range. 226 The duration of each Media Segment is indicated in the Media Playlist 227 by its EXTINF tag (Section 4.3.2.1). 229 Each segment in a Media Playlist has a unique integer Media Sequence 230 Number. The Media Sequence Number of the first segment in the Media 231 Playlist is either 0, or declared in the Playlist (Section 4.3.3.2). 232 The Media Sequence Number of every other segment is equal to the 233 Media Sequence Number of the segment that precedes it plus one. 235 Each Media Segment MUST carry the continuation of the encoded 236 bitstream from the end of the segment with the previous Media 237 Sequence Number, where values in a series such as timestamps and 238 Continuity Counters MUST continue uninterrupted. The only exceptions 239 are the first Media Segment ever to appear in a Media Playlist, and 240 Media Segments which are explicitly signaled as discontinuities 241 (Section 4.3.2.3). Unmarked media discontinuities can trigger 242 playback errors. 244 Any Media Segment that contains video SHOULD include enough 245 information to initialize a video decoder and decode a continuous set 246 of frames that includes the final frame in the Segment; network 247 efficiency is optimized if there is enough information in the Segment 248 to decode all frames in the Segment. For example, any Media Segment 249 containing H.264 video SHOULD contain an IDR; frames prior to the 250 first IDR will be downloaded but possibly discarded. 252 3.1. Supported Media Segment Formats 254 All Media Segments MUST be in a format described in this section. 255 Transport of other media file formats is not defined. 257 Some media formats require a common sequence of bytes to initialize a 258 parser before a Media Segment can be parsed. This format-specific 259 sequence is called the Media Initialization Section. The Media 260 Initialization Section can be specified by an EXT-X-MAP 261 (Section 4.3.2.5) tag. The Media Initialization Section MUST NOT 262 contain sample data. 264 3.2. MPEG-2 Transport Streams 266 MPEG-2 Transport Streams are specified by [ISO_13818]. 268 The Media Initialization Section of an MPEG-2 Transport Stream 269 Segment is a Program Association Table (PAT) followed by a Program 270 Map Table (PMT). 272 Transport Stream Segments MUST contain a single MPEG-2 Program; 273 playback of Multi-Program Transport Streams is not defined. Each 274 Transport Stream Segment MUST contain a PAT and a PMT, or have an 275 EXT-X-MAP (Section 4.3.2.5) tag applied to it. The first two 276 Transport Stream packets in a Segment without an EXT-X-MAP tag SHOULD 277 be a PAT and a PMT. 279 3.3. Fragmented MPEG-4 281 MPEG-4 Fragments are specified by the ISO Base Media File Format 282 [ISOBMFF]. Unlike regular MPEG-4 files which have a Movie Box 283 ('moov') that contains sample tables and a Media Data Box ('mdat') 284 containing the corresponding samples, an MPEG-4 Fragment consists of 285 a Movie Fragment Box ('moof') containing a subset of the sample table 286 and a Media Data Box containing those samples. Use of MPEG-4 287 Fragments does require a Movie Box for initialization, but that Movie 288 Box contains only non-sample-specific information such as track and 289 sample descriptions. 291 A Fragmented MPEG-4 (fMP4) Segment is a "segment" as defined by 292 Section 3 of [ISOBMFF], including the constraints on Media Data Boxes 293 in Section 8.16 [ISOBMFF]. 295 The Media Initialization Section for an fMP4 Segment is an ISO Base 296 Media File that can initialize a parser for that Segment. 298 Broadly speaking, fMP4 Segments and Media Initialization Sections are 299 [ISOBMFF] files that also satisfy the constraints described in this 300 section. 302 The Media Initialization Section for an fMP4 Segment MUST contain a 303 File Type Box ('ftyp') containing a brand that is compatible with 304 'iso6' or higher. The File Type Box MUST be followed by a Movie Box. 305 The Movie Box MUST contain a Track Box ('trak') for every Track 306 Fragment Box ('traf') in the fMP4 Segment, with matching track_ID. 307 Each Track Box SHOULD contain a sample table, but its sample count 308 MUST be zero. Movie Header Boxes ('mvhd') and Track Header Boxes 309 ('tkhd') MUST have durations of zero. A Movie Extends Box ('mvex') 310 MUST follow the last Track Box. 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. 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. 337 The ID3 PRIV owner identifier MUST be 338 "com.apple.streaming.transportStreamTimestamp". The ID3 payload MUST 339 be a 33-bit MPEG-2 Program Elementary Stream timestamp expressed as a 340 big-endian eight-octet number, with the upper 31 bits set to zero. 341 Clients SHOULD NOT play Packed Audio Segments without this ID3 tag. 343 3.5. WebVTT 345 A WebVTT Segment is a section of a WebVTT [WebVTT] file. WebVTT 346 Segments carry subtitles. 348 The Media Initialization Section of a WebVTT Segment is the WebVTT 349 header. 351 Each WebVTT Segment MUST contain all subtitle cues that are intended 352 to be displayed during the period indicated by the segment EXTINF 353 duration. The start time offset and end time offset of each cue MUST 354 indicate the total display time for that cue, even if part of the cue 355 time range is outside the Segment period. A WebVTT Segment MAY 356 contain no cues; this indicates that no subtitles are to be displayed 357 during that period. 359 Each WebVTT Segment MUST either start with a WebVTT header or have an 360 EXT-X-MAP tag applied to it. 362 In order to synchronize timestamps between audio/video and subtitles, 363 a X-TIMESTAMP-MAP metadata header SHOULD be added to each WebVTT 364 header. This header maps WebVTT cue timestamps to MPEG-2 (PES) 365 timestamps in other Renditions of the Variant Stream. Its format is: 367 X-TIMESTAMP-MAP=LOCAL:,MPEGTS: 368 e.g. X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 370 The cue timestamp in the LOCAL attribute MAY fall outside the range 371 of time covered by the segment. 373 If a WebVTT segment does not have the X-TIMESTAMP-MAP, the client 374 MUST assume that the WebVTT cue time of 0 maps to an MPEG-2 timestamp 375 of 0. 377 4. Playlists 379 This section describes the Playlist files used by HTTP Live 380 Streaming. In this section, "MUST" and "MUST NOT" specify the rules 381 for the syntax and structure of legal Playlist files. Playlists that 382 violate these rules are invalid; clients MUST fail to parse them. 383 See Section 6.3.2. 385 The format of the Playlist files is derived from the M3U [M3U] 386 playlist file format and inherits two tags from that earlier file 387 format: EXTM3U (Section 4.3.1.1) and EXTINF (Section 4.3.2.1). 389 In this section, tags are specified using a BNF-style syntax. 391 Each Playlist file MUST be identifiable by either the path component 392 of its URI or by HTTP Content-Type. In the first case, the path MUST 393 end with either .m3u8 or .m3u. In the second, the HTTP Content-type 394 MUST be "application/vnd.apple.mpegurl" or "audio/mpegurl". Clients 395 SHOULD refuse to parse Playlists that are not so identified. 397 4.1. Definition of a Playlist 399 Playlist files MUST be encoded in UTF-8 [RFC3629]. They MUST NOT 400 contain any byte order mark (BOM); Clients SHOULD reject Playlists 401 which contain a BOM or do not parse as UTF-8. Playlist files MUST 402 NOT contain UTF-8 control characters (U+0000 to U+001F and U+007F to 403 U+009F), with the exceptions of CR (U+000D) and LF (U+000A). All 404 character sequences MUST be normalized according to Unicode 405 normalization form "NFC". Note that US-ASCII [US_ASCII] conforms to 406 these rules. 408 Lines in a Playlist file are terminated by either a single line feed 409 character or a carriage return character followed by an line feed 410 character. Each line is a URI, blank, or starts with the character 411 '#'. Blank lines are ignored. White space MUST NOT be present, 412 except for elements in which it is explicitly specified. 414 Lines that start with the character '#' are either comments or tags. 415 Tags begin with #EXT. They are case-sensitive. All other lines that 416 begin with '#' are comments and SHOULD be ignored. 418 A URI line identifies a Media Segment or a Playlist file (see 419 Section 4.3.4.2). Each Media Segment is specified by a URI and the 420 tags that apply to it. 422 A Playlist is a Media Playlist if all URI lines in the Playlist 423 identify Media Segments. A Playlist is a Master Playlist if all URI 424 lines in the Playlist identify Media Playlists. A Playlist MUST be 425 either a Media Playlist or a Master Playlist; all other Playlists are 426 invalid. 428 A URI in a Playlist, whether it is a URI line or part of a tag, MAY 429 be relative. Any relative URI is considered to be relative to the 430 URI of the Playlist that contains it. 432 The duration of a Media Playlist file is the sum of the durations of 433 the Media Segments within it. 435 The segment bit rate of a Media Segment is the size of the Media 436 Segment divided by its EXTINF duration (Section 4.3.2.1). Note that 437 this includes container overhead but does not include overhead 438 imposed by the delivery system, such as HTTP, TCP or IP headers. 440 The peak segment bit rate of a Media Playlist is the largest bit rate 441 of any contiguous set of segments whose total duration is between 0.5 442 and 1.5 times the target duration. The bit rate of a set is 443 calculated by dividing the sum of the segment sizes by the sum of the 444 segment durations. 446 The average segment bit rate of a Media Playlist is the sum of the 447 sizes (in bits) of every Media Segment in the Media Playlist, divided 448 by the Media Playlist duration. Note that this includes container 449 overhead, but not HTTP or other overhead imposed by the delivery 450 system. 452 4.2. Attribute Lists 454 Certain tags have values which are Attribute Lists. An attribute- 455 list is a comma-separated list of attribute/value pairs with no 456 whitespace. 458 An attribute/value pair has the following syntax: 460 AttributeName=AttributeValue 462 An AttributeName is an unquoted string containing characters from the 463 set [A..Z], [0..9] and '-'. Therefore, AttributeNames contain only 464 uppercase letters, not lowercase. There MUST NOT be any whitespace 465 between the AttributeName and the '=' character, nor between the '=' 466 character and the AttributeValue. 468 An AttributeValue is one of the following: 470 o decimal-integer: an unquoted string of characters from the set 471 [0..9] expressing an integer in base-10 arithmetic in the range 472 from 0 to 2^64-1 (18446744073709551615). A decimal-integer may be 473 from 1 to 20 characters long. 475 o hexadecimal-sequence: an unquoted string of characters from the 476 set [0..9] and [A..F] that is prefixed with 0x or 0X. The maximum 477 length of a hexadecimal-sequence depends on its AttributeName. 479 o decimal-floating-point: an unquoted string of characters from the 480 set [0..9] and '.' which expresses a non-negative floating-point 481 number in decimal positional notation. 483 o signed-decimal-floating-point: an unquoted string of characters 484 from the set [0..9], '-' and '.' which expresses a signed 485 floating-point number in decimal positional notation. 487 o quoted-string: a string of characters within a pair of double- 488 quotes (0x22). The following characters MUST NOT appear in a 489 quoted-string: line feed (0xA), carriage return (0xD), or double 490 quote (0x22). Quoted-string AttributeValues SHOULD be constructed 491 so that byte-wise comparison is sufficient to test two quoted- 492 string AttributeValues for equality. Note that this implies case- 493 sensitive comparison. 495 o enumerated-string: an unquoted character string from a set which 496 is explicitly defined by the Attribute. An enumerated-string will 497 never contain double-quotes ("), commas (,), or whitespace. 499 o decimal-resolution: two decimal-integers separated by the "x" 500 character. The first integer is a horizontal pixel dimension 501 (width); the second is a vertical pixel dimension (height). 503 The type of the AttributeValue for a given AttributeName is specified 504 by the Attribute definition. 506 A given AttributeName MUST NOT appear more than once in a given 507 Attribute List. Clients SHOULD refuse to play such Playlists. 509 4.3. Playlist Tags 511 Playlist tags specify either global parameters of the Playlist, or 512 information about the Media Segments or Media Playlists that appear 513 after them. 515 4.3.1. Basic Tags 517 These tags are allowed in both Media Playlists and Master Playlists. 519 4.3.1.1. EXTM3U 521 The EXTM3U tag indicates that the file is an Extended M3U [M3U] 522 Playlist file. It MUST be the first line of every Media Playlist and 523 every Master Playlist. Its format is: 525 #EXTM3U 527 4.3.1.2. EXT-X-VERSION 529 The EXT-X-VERSION tag indicates the compatibility version of the 530 Playlist file, its associated media, and its server. 532 The EXT-X-VERSION tag applies to the entire Playlist file. Its 533 format is: 535 #EXT-X-VERSION: 537 where n is an integer indicating the protocol compatibility version 538 number. 540 It MUST appear in all Playlists containing tags or attributes that 541 are not compatible with protocol version 1 to support 542 interoperability with older clients. Section 7 specifies the minimum 543 value of the compatibility version number for any given Playlist 544 file. 546 A Playlist file MUST NOT contain more than one EXT-X-VERSION tag. If 547 a client encounters a Playlist with multiple EXT-X-VERSION tags, it 548 MUST reject it. 550 4.3.2. Media Segment Tags 552 Each Media Segment is specified by a series of Media Segment tags 553 followed by a URI. Some Media Segment tags apply to just the next 554 segment; others apply to all subsequent segments until another 555 instance of the same tag. 557 A Media Segment tag MUST NOT appear in a Master Playlist. Clients 558 MUST reject Playlists that contain both Media Segment Tags and Master 559 Playlist tags (Section 4.3.4). 561 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". 705 Use of the KEYFORMATVERSIONS attribute REQUIRES a compatibility 706 version number of 5 or greater. 708 If the Media Playlist file does not contain an EXT-X-KEY tag then 709 Media Segments are not encrypted. 711 See Section 5 for the format of the key file, and Section 5.2, 712 Section 6.2.3 and Section 6.3.6 for additional information on Media 713 Segment encryption. 715 4.3.2.5. EXT-X-MAP 717 The EXT-X-MAP tag specifies how to obtain the Media Initialization 718 Section (Section 3) required to parse the applicable Media Segments. 719 It applies to every Media Segment that appears after it in the 720 Playlist until the next EXT-X-MAP tag or until the end of the 721 playlist. 723 Its format is: 725 #EXT-X-MAP:<attribute-list> 727 The following attributes are defined: 729 URI 731 The value is a quoted-string containing a URI that identifies a 732 resource that contains the Media Initialization Section. This 733 attribute is REQUIRED. 735 BYTERANGE 737 The value is a quoted-string specifying a byte range into the 738 resource identified by the URI attribute. This range SHOULD 739 contain only the Media Initialization Section. The format of the 740 byte range is described in Section 4.3.2.2. This attribute is 741 OPTIONAL; if it is not present, the byte range is the entire 742 resource indicated by the URI. 744 An EXT-X-MAP tag SHOULD be supplied for Media Segments in Playlists 745 with the EXT-X-I-FRAMES-ONLY tag when the first Media Segment (i.e., 746 I-frame) in the Playlist (or the first segment following an 747 EXT-X-DISCONTINUITY tag) does not immediately follow the Media 748 Initialization Section at the beginning of its resource. 750 Use of the EXT-X-MAP tag in a Media Playlist that contains the 751 EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility version number of 5 752 or greater. Use of the EXT-X-MAP tag in a Media Playlist that DOES 753 NOT contain the EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility 754 version number of 6 or greater. 756 4.3.2.6. EXT-X-PROGRAM-DATE-TIME 758 The EXT-X-PROGRAM-DATE-TIME tag associates the first sample of a 759 Media Segment with an absolute date and/or time. It applies only to 760 the next Media Segment. 762 The date/time representation is ISO/IEC 8601:2004 [ISO_8601] and 763 SHOULD indicate a time zone and fractional parts of seconds: 765 #EXT-X-PROGRAM-DATE-TIME:<YYYY-MM-DDThh:mm:ss.SSSZ> 767 For example: 769 #EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031+08:00 771 EXT-X-PROGRAM-DATE-TIME tags SHOULD provide millisecond accuracy. 773 See Section 6.2.1 and Section 6.3.3 for more information on the EXT-X 774 -PROGRAM-DATE-TIME tag. 776 4.3.2.7. EXT-X-DATERANGE 778 The EXT-X-DATERANGE tag associates a Date Range (i.e. a range of time 779 defined by a starting and ending date) with a set of attribute / 780 value pairs. Its format is: 782 #EXT-X-DATERANGE:<attribute-list> 784 where the defined attributes are: 786 ID 788 A quoted-string that uniquely identifies a Date Range in the 789 Playlist. This attribute is REQUIRED. 791 CLASS 793 A client-defined quoted-string that specifies some set of 794 attributes and their associated value semantics. All Date Ranges 795 with the same CLASS attribute value MUST adhere to these 796 attribute-value semantics. This attribute is OPTIONAL. 798 START-DATE 799 A quoted-string containing the ISO-8601 date at which the Date 800 Range begins. This attribute is REQUIRED. 802 END-DATE 804 A quoted-string containing the ISO-8601 date at which the Date 805 Range ends. It MUST be equal to or later than the value of the 806 START-DATE attribute. This attribute is OPTIONAL. 808 DURATION 810 The duration of the Date Range expressed as a decimal-floating- 811 point number of seconds. It MUST NOT be negative. A single 812 instant in time (e.g. crossing a finish line) SHOULD be 813 represented with a duration of 0. This attribute is OPTIONAL. 815 PLANNED-DURATION 817 The expected duration of the Date Range expressed as a decimal- 818 floating-point number of seconds. It MUST NOT be negative. This 819 attribute SHOULD be used to indicate the expected duration of a 820 Date Range whose actual duration is not yet known. It is 821 OPTIONAL. 823 X-<client-attribute> 825 The "X-" prefix defines a namespace reserved for client-defined 826 attributes. The client-attribute MUST be a legal AttributeName. 827 Clients SHOULD use a reverse-DNS syntax when defining their own 828 attribute names to avoid collisions. The attribute value MUST be 829 a quoted-string, a hexadecimal-sequence, or a decimal-floating- 830 point. An example of a client-defined attribute is X-COM-EXAMPLE- 831 AD-ID="XYZ123". These attributes are OPTIONAL. 833 SCTE35-CMD, SCTE35-OUT, SCTE35-IN 835 Used to carry SCTE-35 data; see Section 4.3.2.7.1 for more 836 information. These attributes are OPTIONAL. 838 END-ON-NEXT 840 An enumerated-string whose value MUST be YES. This attribute 841 indicates that the end of the range containing it is equal to the 842 START-DATE of its Following Range. The Following Range is the 843 Date Range of the same CLASS that has the earliest START-DATE 844 after the START-DATE of the range in question. This attribute is 845 OPTIONAL. 847 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST have a 848 CLASS attribute. Other EXT-X-DATERANGE tags with the same CLASS 849 attribute MUST NOT specify Date Ranges that overlap. 851 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT 852 contain DURATION or END-DATE attributes. 854 A Date Range with neither a DURATION, an END-DATE, or an END-ON- 855 NEXT=YES attribute has an unknown duration, even if it has a PLANNED- 856 DURATION. 858 If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain 859 at least one EXT-X-PROGRAM-DATE-TIME tag. 861 If a Playlist contains two EXT-X-DATERANGE tags with the same ID 862 attribute value, then any AttributeName that appears in both tags 863 MUST have the same AttributeValue. 865 If a Date Range contains both a DURATION attribute and an END-DATE 866 attribute, the value of the END-DATE attribute MUST be equal to the 867 value of the START-DATE attribute plus the value of the DURATION 868 attribute. 870 Clients SHOULD ignore EXT-X-DATERANGE tags with illegal syntax. 872 4.3.2.7.1. Mapping SCTE-35 into EXT-X-DATERANGE 874 Splice information carried in source media according to the SCTE-35 875 specification [SCTE35] MAY be represented in a Media Playlist using 876 EXT-X-DATERANGE tags. 878 Each SCTE-35 splice_info_section() containing a splice_null(), 879 splice_schedule(), bandwidth_reservation() or private_cmd() SHOULD be 880 represented by an EXT-X-DATERANGE tag with a SCTE35-CMD attribute 881 whose value is the big-endian binary representation of the 882 splice_info_section(), expressed as a hexadecimal-sequence. 884 A SCTE-35 splice out/in pair signaled by a pair of splice_insert() 885 commands SHOULD be represented by one or more EXT-X-DATERANGE tags 886 carrying the same ID attribute, which MUST be unique to that splice 887 out/in pair. The "out" splice_info_section() (with 888 out_of_network_indicator set to 1) MUST be placed in a SCTE35-OUT 889 attribute, with the same formatting as SCTE35-CMD. The "in" 890 splice_info_section() (with out_of_network_indicator set to 0) MUST 891 be placed in a SCTE35-IN attribute, with the same formatting as 892 SCTE35-CMD. 894 A SCTE-35 splice out/in pair signaled by a pair of time_signal() 895 commands, each carrying a single segmentation_descriptor(), SHOULD be 896 represented by one or more EXT-X-DATERANGE tags carrying the same ID 897 attribute, which MUST be unique to that splice out/in pair. The 898 "out" splice_info_section() MUST be placed in a SCTE35-OUT attribute; 899 the "in" splice_info_section() MUST be placed in a SCTE35-IN 900 attribute. 902 Different types of segmentation (as indicated by the 903 segmentation_type_id in the segmentation_descriptor() SHOULD be 904 represented by separate EXT-X-DATERANGE tags, even if two or more 905 segmentation_descriptor()s arrive in the same splice_info_section(). 906 In that case, each EXT-X-DATERANGE tag will have a SCTE35-OUT, 907 SCTE35-IN or SCTE35-CMD attribute whose value is the entire 908 splice_info_section(). 910 A SCTE-35 time_signal() command that does not signal a splice out or 911 in point SHOULD be represented by an EXT-X-DATERANGE tag with a 912 SCTE35-CMD attribute. 914 The START-DATE of an EXT-X-DATERANGE tag containing a SCTE35-OUT 915 attribute MUST be the date and time that corresponds to the program 916 time of that splice. 918 The START-DATE of an EXT-X-DATERANGE tag containing a SCTE35-CMD MUST 919 be the date and time specified by the splice_time() in the command, 920 or to the program time at which the command appeared in the source 921 stream if the command does not specify a splice_time(). 923 An EXT-X-DATERANGE tag containing a SCTE35-OUT attribute MAY contain 924 a PLANNED-DURATION attribute. Its value MUST be the planned duration 925 of the splice. 927 The DURATION of an EXT-X-DATERANGE tag containing a SCTE35-IN 928 attribute MUST be the actual (not planned) program duration between 929 the corresponding out-point and that in-point. 931 The END-DATE of an EXT-X-DATERANGE tag containing a SCTE35-IN 932 attribute MUST be the actual (not planned) program date and time of 933 that in-point. 935 If the actual end date and time is not known when a SCTE35-OUT 936 attribute is added to the Playlist, the DURATION attribute and the 937 END-TIME attribute MUST NOT be present; the actual end date of the 938 splice SHOULD be signaled by another EXT-X-DATERANGE tag once it has 939 been established. 941 A canceled splice SHOULD NOT appear in the Playlist as an 942 EXT-X-DATERANGE tag. 944 An EXT-X-DATERANGE tag announcing a splice SHOULD be added to a 945 Playlist at the same time as the last pre-splice Media Segment. 947 The ID attribute of an EXT-X-DATERANGE tag MAY contain a 948 splice_event_id and/or a segmentation_event_id, but it MUST be unique 949 in the the Playlist. If there is a possibility that a SCTE-35 id 950 will be reused, the ID attribute value MUST include disambiguation, 951 such as a date or sequence number. 953 4.3.3. Media Playlist Tags 955 Media Playlist tags describe global parameters of the Media Playlist. 956 There MUST NOT be more than one Media Playlist tag of each type in 957 any Media Playlist. 959 A Media Playlist Tag MUST NOT appear in a Master Playlist 961 4.3.3.1. EXT-X-TARGETDURATION 963 The EXT-X-TARGETDURATION tag specifies the maximum Media Segment 964 duration. The EXTINF duration of each Media Segment in the Playlist 965 file, when rounded to the nearest integer, MUST be less than or equal 966 to the target duration; longer segments can trigger playback stalls 967 or other errors. It applies to the entire Playlist file. Its format 968 is: 970 #EXT-X-TARGETDURATION:<s> 972 where s is a decimal-integer indicating the target duration in 973 seconds. The EXT-X-TARGETDURATION tag is REQUIRED. 975 4.3.3.2. EXT-X-MEDIA-SEQUENCE 977 The EXT-X-MEDIA-SEQUENCE tag indicates the Media Sequence Number of 978 the first Media Segment that appears in a Playlist file. Its format 979 is: 981 #EXT-X-MEDIA-SEQUENCE:<number> 983 where number is a decimal-integer. 985 If the Media Playlist file does not contain an EXT-X-MEDIA-SEQUENCE 986 tag then the Media Sequence Number of the first Media Segment in the 987 Media Playlist SHALL be considered to be 0. A client MUST NOT assume 988 that segments with the same Media Sequence Number in different Media 989 Playlists contain matching content - see Section 6.3.2. 991 A URI for a Media Segment is not required to contain its Media 992 Sequence Number. 994 See Section 6.2.1 and Section 6.3.5 for more information on setting 995 the EXT-X-MEDIA-SEQUENCE tag. 997 The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media 998 Segment in the Playlist. 1000 4.3.3.3. EXT-X-DISCONTINUITY-SEQUENCE 1002 The EXT-X-DISCONTINUITY-SEQUENCE tag allows synchronization between 1003 different Renditions of the same Variant Stream or different Variant 1004 Streams that have EXT-X-DISCONTINUITY tags in their Media Playlists. 1006 Its format is: 1008 #EXT-X-DISCONTINUITY-SEQUENCE:<number> 1010 where number is a decimal-integer. 1012 If the Media Playlist does not contain an EXT-X-DISCONTINUITY- 1013 SEQUENCE tag, then the Discontinuity Sequence Number of the first 1014 Media Segment in the Playlist SHALL be considered to be 0. 1016 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first 1017 Media Segment in the Playlist. 1019 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any 1020 EXT-X-DISCONTINUITY tag. 1022 See Section 6.2.1 and Section 6.2.2 for more information about 1023 setting the value of the EXT-X-DISCONTINUITY-SEQUENCE tag. 1025 4.3.3.4. EXT-X-ENDLIST 1027 The EXT-X-ENDLIST tag indicates that no more Media Segments will be 1028 added to the Media Playlist file. It MAY occur anywhere in the Media 1029 Playlist file. Its format is: 1031 #EXT-X-ENDLIST 1033 4.3.3.5. EXT-X-PLAYLIST-TYPE 1035 The EXT-X-PLAYLIST-TYPE tag provides mutability information about the 1036 Media Playlist file. It applies to the entire Media Playlist file. 1037 It is OPTIONAL. Its format is: 1039 #EXT-X-PLAYLIST-TYPE:<EVENT|VOD> 1041 Section 6.2.1 defines the implications of the EXT-X-PLAYLIST-TYPE 1042 tag. 1044 If the EXT-X-PLAYLIST-TYPE value is EVENT, Media Segments can only be 1045 added to the end of the Media Playlist. If the EXT-X-PLAYLIST-TYPE 1046 value is VOD, the Media Playlist cannot change. 1048 If the EXT-X-PLAYLIST-TYPE tag is omitted from a Media Playlist, the 1049 Playlist can be updated according to the rules in Section 6.2.1 with 1050 no additional restrictions. For example, a live Playlist 1051 (Section 6.2.2) MAY be updated to remove Media Segments in the order 1052 that they appeared. 1054 4.3.3.6. EXT-X-I-FRAMES-ONLY 1056 The EXT-X-I-FRAMES-ONLY tag indicates that each Media Segment in the 1057 Playlist describes a single I-frame. I-frames (or Intra frames) are 1058 encoded video frames whose encoding does not depend on any other 1059 frame. I-frame playlists can be used for trick play, such as fast 1060 forward, rapid reverse and scrubbing. 1062 The EXT-X-I-FRAMES-ONLY tag applies to the entire Playlist. Its 1063 format is: 1065 #EXT-X-I-FRAMES-ONLY 1067 In a Playlist with the EXT-X-I-FRAMES-ONLY tag, the Media Segment 1068 duration (EXTINF tag value) is the time between the presentation time 1069 of the I-frame in the Media Segment and the presentation time of the 1070 next I-frame in the Playlist, or the end of the presentation if it is 1071 the last I-frame in the Playlist. 1073 Media resources containing I-frame segments MUST begin with either a 1074 Media Initialization Section (Section 3) or be accompanied by an 1075 EXT-X-MAP tag indicating the Media Initialization Section so that 1076 clients can load and decode I-frame segments in any order. The byte 1077 range of an I-frame segment with an EXT-X-BYTERANGE tag applied to it 1078 (Section 4.3.2.2) MUST NOT include its Media Initialization Section; 1079 clients can assume that the Media Initialization Section is defined 1080 by EXT-X-MAP tag, or is located from the start of the resource to the 1081 offset of the first I-frame segment in that resource. 1083 Use of the EXT-X-I-FRAMES-ONLY REQUIRES a compatibility version 1084 number of 4 or greater. 1086 4.3.4. Master Playlist Tags 1088 Master Playlist tags define the Variant Streams, Renditions, and 1089 other global parameters of the presentation. 1091 Master Playlist Tags MUST NOT appear in a Media Playlist; clients 1092 MUST reject any Playlist that contains both a Master Playlist tag and 1093 either a Media Playlist tag or a Media Segment tag. 1095 4.3.4.1. EXT-X-MEDIA 1097 The EXT-X-MEDIA tag is used to relate Media Playlists that contain 1098 alternative Renditions (Section 4.3.4.2.1) of the same content. For 1099 example, three EXT-X-MEDIA tags can be used to identify audio-only 1100 Media Playlists that contain English, French and Spanish Renditions 1101 of the same presentation. Or two EXT-X-MEDIA tags can be used to 1102 identify video-only Media Playlists that show two different camera 1103 angles. 1105 Its format is: 1107 #EXT-X-MEDIA:<attribute-list> 1109 The following attributes are defined: 1111 TYPE 1113 The value is an enumerated-string; valid strings are AUDIO, VIDEO, 1114 SUBTITLES and CLOSED-CAPTIONS. This attribute is REQUIRED. 1116 In Transport Streams, Closed captions [CEA608] media is carried in 1117 the video stream. Therefore, an EXT-X-MEDIA tag with TYPE of 1118 CLOSED-CAPTION does not specify a Rendition; the closed caption 1119 media is present in the Media Segments of every video Rendition. 1121 URI 1123 The value is a quoted-string containing a URI that identifies the 1124 Media Playlist file. This attribute is OPTIONAL; see 1125 Section 4.3.4.2.1. If the TYPE is CLOSED-CAPTIONS, the URI 1126 attribute MUST NOT be present. 1128 GROUP-ID 1130 The value is a quoted-string which specifies the group to which 1131 the Rendition belongs. See Section 4.3.4.1.1. This attribute is 1132 REQUIRED. 1134 LANGUAGE 1136 The value is a quoted-string containing one of the standard Tags 1137 for Identifying Languages [RFC5646], which identifies the primary 1138 language used in the Rendition. This attribute is OPTIONAL. 1140 ASSOC-LANGUAGE 1142 The value is a quoted-string containing a language tag [RFC5646] 1143 that identifies a language that is associated with the Rendition. 1144 An associated language is often used in a different role than the 1145 language specified by the LANGUAGE attribute (e.g. written vs. 1146 spoken, or as a fallback dialect). This attribute is OPTIONAL. 1148 The LANGUAGE and ASSOC-LANGUAGE attributes can be used, for 1149 example, to link Norwegian renditions that use different spoken 1150 and written languages. 1152 NAME 1154 The value is a quoted-string containing a human-readable 1155 description of the Rendition. If the LANGUAGE attribute is 1156 present then this description SHOULD be in that language. This 1157 attribute is REQUIRED. 1159 DEFAULT 1161 The value is an enumerated-string; valid strings are YES and NO. 1162 If the value is YES, then the client SHOULD play this Rendition of 1163 the content in the absence of information from the user indicating 1164 a different choice. This attribute is OPTIONAL. Its absence 1165 indicates an implicit value of NO. 1167 AUTOSELECT 1169 The value is an enumerated-string; valid strings are YES and NO. 1170 This attribute is OPTIONAL. Its absence indicates an implicit 1171 value of NO. If the value is YES, then the client MAY choose to 1172 play this Rendition in the absence of explicit user preference 1173 because it matches the current playback environment, such as 1174 chosen system language. 1176 If the AUTOSELECT attribute is present, its value MUST be YES if 1177 the value of the DEFAULT attribute is YES. 1179 FORCED 1181 The value is an enumerated-string; valid strings are YES and NO. 1182 This attribute is OPTIONAL. Its absence indicates an implicit 1183 value of NO. The FORCED attribute MUST NOT be present unless the 1184 TYPE is SUBTITLES. 1186 A value of YES indicates that the Rendition contains content which 1187 is considered essential to play. When selecting a FORCED 1188 Rendition, a client SHOULD choose the one that best matches the 1189 current playback environment (e.g. language). 1191 A value of NO indicates that the Rendition contains content which 1192 is intended to be played in response to explicit user request. 1194 INSTREAM-ID 1196 The value is a quoted-string that specifies a Rendition within the 1197 segments in the Media Playlist. This attribute is REQUIRED if the 1198 TYPE attribute is CLOSED-CAPTIONS, in which case it MUST have one 1199 of the values: "CC1", "CC2", "CC3", "CC4", or "SERVICEn" where n 1200 MUST be an integer between 1 and 63 (e.g."SERVICE3" or 1201 "SERVICE42"). 1203 The values "CC1", "CC2", "CC3", and "CC4" identify a Line 21 Data 1204 Services channel [CEA608]. The "SERVICE" values identify a 1205 Digital Television Closed Captioning [CEA708] service block 1206 number. 1208 For all other TYPE values, the INSTREAM-ID MUST NOT be specified. 1210 CHARACTERISTICS 1212 The value is a quoted-string containing one or more Uniform Type 1213 Identifiers [UTI] separated by comma (,) characters. This 1214 attribute is OPTIONAL. Each UTI indicates an individual 1215 characteristic of the Rendition. 1217 A SUBTITLES Rendition MAY include the following characteristics: 1218 "public.accessibility.transcribes-spoken-dialog"; 1219 "public.accessibility.describes-music-and-sound"; "public.easy-to- 1220 read" (which indicates that the subtitles have been edited for 1221 ease of reading). 1223 An AUDIO Rendition MAY include the following characteristics: 1224 "public.accessibility.describes-video". 1226 The CHARACTERISTICS attribute MAY include private UTIs. 1228 CHANNELS 1230 The value is a quoted-string that specifies an ordered, 1231 "/"-separated list of parameters. If the TYPE attribute is AUDIO 1232 then the first parameter is a count of audio channels expressed as 1233 a decimal-integer, indicating the maximum number of independent, 1234 simultaneous audio channels present in any Media Segment in the 1235 Rendition. For example, an AC-3 5.1 rendition would have a 1236 CHANNELS="6" attribute. No other CHANNELS parameters are 1237 currently defined. 1239 All audio EXT-X-MEDIA tags SHOULD have a CHANNELS attribute. If a 1240 Master Playlist contains two renditions encoded with the same 1241 codec but a different number of channels, then the CHANNELS 1242 attribute is REQUIRED; otherwise it is OPTIONAL. 1244 4.3.4.1.1. Rendition Groups 1246 A set of one or more EXT-X-MEDIA tags with the same GROUP-ID value 1247 and the same TYPE value defines a Group of Renditions. Each member 1248 of the Group MUST be an alternative rendition of the same content; 1249 otherwise playback errors can occur. 1251 All EXT-X-MEDIA tags in a Playlist MUST meet the following 1252 constraints: 1254 o All EXT-X-MEDIA tags in the same Group MUST have different NAME 1255 attributes. 1257 o A Group MUST NOT have more than one member with a DEFAULT 1258 attribute of YES. 1260 o Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have 1261 a combination of LANGUAGE [RFC5646], ASSOC-LANGUAGE, FORCED, and 1262 CHARACTERISTICS attributes that is distinct from those of other 1263 AUTOSELECT=YES members of its Group. 1265 A Playlist MAY contain multiple Groups of the same TYPE in order to 1266 provide multiple encodings of that media type. If it does so, each 1267 Group of the same TYPE MUST have the same set of members, and each 1268 corresponding member MUST have identical attributes with the 1269 exception of the URI and CHANNELS attributes. 1271 Each member in a Group of Renditions MAY have a different sample 1272 format. For example, an English rendition can be encoded with AC-3 1273 5.1 while a Spanish rendition is encoded with AAC stereo. However, 1274 any EXT-X-STREAM-INF (Section 4.3.4.2) tag or EXT-X-I-FRAME-STREAM- 1275 INF (Section 4.3.4.3) tag which references such a Group MUST have a 1276 CODECS attribute that lists every sample format present in any 1277 Rendition in the Group, or client playback failures can occur. In 1278 the example above, the CODECS attribute would include 1279 "ac-3,mp4a.40.2". 1281 4.3.4.2. EXT-X-STREAM-INF 1283 The EXT-X-STREAM-INF tag specifies a Variant Stream, which is a set 1284 of Renditions which can be combined to play the presentation. The 1285 attributes of the tag provide information about the Variant Stream. 1287 The URI line that follows the EXT-X-STREAM-INF tag specifies a Media 1288 Playlist that carries a Rendition of the Variant Stream. The URI 1289 line is REQUIRED. Clients that do not support multiple video 1290 renditions SHOULD play this Rendition 1292 Its format is: 1294 #EXT-X-STREAM-INF:<attribute-list> 1295 <URI> 1297 The following attributes are defined: 1299 BANDWIDTH 1301 The value is a decimal-integer of bits per second. It represents 1302 the peak segment bit rate of the Variant Stream. 1304 If all the Media Segments in a Variant Stream have already been 1305 created, the BANDWIDTH value MUST be the largest sum of peak 1306 segment bit rates that is produced by any playable combination of 1307 Renditions. (For a Variant Stream with a single Media Playlist, 1308 this is just the peak segment bit rate of that Media Playlist.) 1309 An inaccurate value can cause playback stalls or prevent clients 1310 from playing the variant. 1312 If the Master Playlist is to be made available before all Media 1313 Segments in the presentation have been encoded, the BANDWIDTH 1314 value SHOULD be the BANDWIDTH value of a representative period of 1315 similar content, encoded using the same settings. 1317 Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. 1319 AVERAGE-BANDWIDTH 1321 The value is a decimal-integer of bits per second. It represents 1322 the average segment bit rate of the Variant Stream. 1324 If all the Media Segments in a Variant Stream have already been 1325 created, the AVERAGE-BANDWIDTH value MUST be the largest sum of 1326 average segment bit rates that is produced by any playable 1327 combination of Renditions. (For a Variant Stream with a single 1328 Media Playlist, this is just the average segment bit rate of that 1329 Media Playlist.) An inaccurate value can cause playback stalls or 1330 prevent clients from playing the variant. 1332 If the Master Playlist is to be made available before all Media 1333 Segments in the presentation have been encoded, the AVERAGE- 1334 BANDWIDTH value SHOULD be the AVERAGE-BANDWIDTH value of a 1335 representative period of similar content, encoded using the same 1336 settings. 1338 The AVERAGE-BANDWIDTH attribute is OPTIONAL. 1340 CODECS 1342 The value is a quoted-string containing a comma-separated list of 1343 formats, where each format specifies a media sample type that is 1344 present in one or more Renditions specified by the Variant Stream. 1345 Valid format identifiers are those in the ISO Base Media File 1346 Format Name Space defined by The 'Codecs' and 'Profiles' 1347 Parameters for "Bucket" Media Types [RFC6381]. 1349 For example, a stream containing AAC-LC audio and H.264 Main 1350 Profile Level 3.0 video would have a CODECS value of 1351 "mp4a.40.2,avc1.4d401e". 1353 Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. 1355 RESOLUTION 1357 The value is a decimal-resolution describing the optimal pixel 1358 resolution at which to display all the video in the Variant 1359 Stream. 1361 The RESOLUTION attribute is OPTIONAL but is recommended if the 1362 Variant Stream includes video. 1364 FRAME-RATE 1365 The value is a decimal-floating-point describing the maximum frame 1366 rate for all the video in the Variant Stream, rounded to 3 decimal 1367 places. 1369 The FRAME-RATE attribute is OPTIONAL but is recommended if the 1370 Variant Stream includes video. The FRAME-RATE attribute SHOULD be 1371 included if any video in a Variant Stream exceeds 30 frames per 1372 second. 1374 HDCP-LEVEL 1376 The value is an enumerated-string; valid strings are TYPE-0 and 1377 NONE. This attribute is advisory; a value of TYPE-0 indicates 1378 that the Variant Stream could fail to play unless the output is 1379 protected by HDCP Type 0 [HDCP] or equivalent. A value of NONE 1380 indicates that the content does not require output copy 1381 protection. 1383 Encrypted Variant Streams with different HDCP levels SHOULD use 1384 different media encryption keys. 1386 The HDCP-LEVEL attribute is OPTIONAL. It SHOULD be present if any 1387 content in the Variant Stream will fail to play without HDCP. 1388 Clients without output copy protection SHOULD NOT load a Variant 1389 Stream with an HDCP-LEVEL attribute unless its value is NONE. 1391 AUDIO 1393 The value is a quoted-string. It MUST match the value of the 1394 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1395 Playlist whose TYPE attribute is AUDIO. It indicates the set of 1396 audio Renditions that SHOULD be used when playing the 1397 presentation. See Section 4.3.4.2.1. 1399 The AUDIO attribute is OPTIONAL. 1401 VIDEO 1403 The value is a quoted-string. It MUST match the value of the 1404 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1405 Playlist whose TYPE attribute is VIDEO. It indicates the set of 1406 video Renditions that SHOULD be used when playing the 1407 presentation. See Section 4.3.4.2.1. 1409 The VIDEO attribute is OPTIONAL. 1411 SUBTITLES 1412 The value is a quoted-string. It MUST match the value of the 1413 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1414 Playlist whose TYPE attribute is SUBTITLES. It indicates the set 1415 of subtitle Renditions that can be used when playing the 1416 presentation. See Section 4.3.4.2.1. 1418 The SUBTITLES attribute is OPTIONAL. 1420 CLOSED-CAPTIONS 1422 The value can be either a quoted-string or an enumerated-string 1423 with the value NONE. If the value is a quoted-string, it MUST 1424 match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag 1425 elsewhere in the Playlist whose TYPE attribute is CLOSED-CAPTIONS, 1426 and indicates the set of closed-caption Renditions that can be 1427 used when playing the presentation. See Section 4.3.4.2.1. 1429 If the value is the enumerated-string value NONE, all EXT-X 1430 -STREAM-INF tags MUST have this attribute with a value of NONE, 1431 indicating that there are no closed captions in any Variant Stream 1432 in the Master Playlist. Having closed captions in one Variant 1433 Stream but not another can trigger playback inconsistencies. 1435 The CLOSED-CAPTIONS attribute is OPTIONAL. 1437 4.3.4.2.1. Alternative Renditions 1439 When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, SUBTITLES, or 1440 CLOSED-CAPTIONS attribute, it indicates that alternative Renditions 1441 of the content are available for playback of that Variant Stream. 1443 When defining alternative Renditions, the following constraints MUST 1444 be met to prevent client playback errors: 1446 o All playable combinations of Renditions associated with an EXT-X 1447 -STREAM-INF tag MUST have an aggregate bandwidth less than or 1448 equal to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. 1450 o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a 1451 VIDEO attribute, then every alternative video Rendition MUST have 1452 an optimal display resolution matching the value of the RESOLUTION 1453 attribute. 1455 o Every alternative Rendition associated with an EXT-X-STREAM-INF 1456 tag MUST meet the constraints for a Variant Stream described in 1457 Section 6.2.4. 1459 The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media 1460 type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. 1461 If the media type is VIDEO or AUDIO, a missing URI attribute 1462 indicates that the media data for this Rendition is included in the 1463 Media Playlist of any EXT-X-STREAM-INF tag referencing this 1464 EXT-X-MEDIA tag. If the media TYPE is AUDIO and the URI attribute is 1465 missing, clients MUST assume that the audio data for this Rendition 1466 is present in every video Rendition specified by the EXT-X-STREAM-INF 1467 tag. 1469 The URI attribute of the EXT-X-MEDIA tag MUST NOT be included if the 1470 media type is CLOSED-CAPTIONS. 1472 4.3.4.3. EXT-X-I-FRAME-STREAM-INF 1474 The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file 1475 containing the I-frames of a multimedia presentation. It stands 1476 alone, in that it does not apply to a particular URI in the Master 1477 Playlist. Its format is: 1479 #EXT-X-I-FRAME-STREAM-INF:<attribute-list> 1481 All attributes defined for the EXT-X-STREAM-INF tag (Section 4.3.4.2) 1482 are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the 1483 FRAME-RATE, AUDIO, SUBTITLES and CLOSED-CAPTIONS attributes. In 1484 addition, the following attribute is defined: 1486 URI 1488 The value is a quoted-string containing a URI that identifies the 1489 I-frame Media Playlist file. That Playlist file MUST contain an 1490 EXT-X-I-FRAMES-ONLY tag. 1492 Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute 1493 and a URI attribute. 1495 The provisions in Section 4.3.4.2.1 also apply to EXT-X-I-FRAME- 1496 STREAM-INF tags with a VIDEO attribute. 1498 A Master Playlist that specifies alternative VIDEO Renditions and 1499 I-frame Playlists SHOULD include an alternative I-frame VIDEO 1500 Rendition for each regular VIDEO Rendition, with the same NAME and 1501 LANGUAGE attributes. 1503 4.3.4.4. EXT-X-SESSION-DATA 1505 The EXT-X-SESSION-DATA tag allows arbitrary session data to be 1506 carried in a Master Playlist. 1508 Its format is: 1510 #EXT-X-SESSION-DATA:<attribute-list> 1512 The following attributes are defined: 1514 DATA-ID 1516 The value of DATA-ID is a quoted-string which identifies that data 1517 value. The DATA-ID SHOULD conform to a reverse DNS naming 1518 convention, such as "com.example.movie.title"; however, there is 1519 no central registration authority, so Playlist authors SHOULD take 1520 care to choose a value which is unlikely to collide with others. 1521 This attribute is REQUIRED. 1523 VALUE 1525 VALUE is a quoted-string. It contains the data identified by 1526 DATA-ID. If the LANGUAGE is specified, VALUE SHOULD contain a 1527 human-readable string written in the specified language. 1529 URI 1531 The value is a quoted-string containing a URI. The resource 1532 identified by the URI MUST be formatted as JSON [RFC7159]; 1533 otherwise, clients may fail to interpret the resource. 1535 LANGUAGE 1537 The value is a quoted-string containing a language tag [RFC5646] 1538 that identifies the language of the VALUE. This attribute is 1539 OPTIONAL. 1541 Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI 1542 attribute, but not both. 1544 A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same 1545 DATA-ID attribute. A Playlist MUST NOT contain more than one EXT-X 1546 -SESSION-DATA tag with the same DATA-ID attribute and the same 1547 LANGUAGE attribute. 1549 4.3.4.5. EXT-X-SESSION-KEY 1551 The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists 1552 to be specified in a Master Playlist. This allows the client to 1553 preload these keys without having to read the Media Playlist(s) 1554 first. 1556 Its format is: 1558 #EXT-X-SESSION-KEY:<attribute-list> 1560 All attributes defined for the EXT-X-KEY tag (Section 4.3.2.4) are 1561 also defined for the EXT-X-SESSION-KEY, except that the value of the 1562 METHOD attribute MUST NOT be NONE. If an EXT-X-SESSION-KEY is used, 1563 the values of the METHOD, KEYFORMAT and KEYFORMATVERSIONS attributes 1564 MUST match any EXT-X-KEY with the same URI value. 1566 EXT-X-SESSION-KEY tags SHOULD be added if multiple Variant Streams or 1567 Renditions use the same encryption keys and formats. A EXT-X 1568 -SESSION-KEY tag is not associated with any particular Media 1569 Playlist. 1571 A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY 1572 tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS 1573 attribute values. 1575 The EXT-X-SESSION-KEY tag is optional. 1577 4.3.5. Media or Master Playlist Tags 1579 The tags in this section can appear in either Master Playlists or 1580 Media Playlists. If one of these tags appears in a Master Playlist, 1581 it SHOULD NOT appear in any Media Playlist referenced by that Master 1582 Playlist. A tag that appears in both MUST have the same value; 1583 otherwise, clients SHOULD ignore the value in the Media Playlist(s). 1585 These tags MUST NOT appear more than once in a Playlist. If a tag 1586 appears more than once, clients MUST reject the playlist. 1588 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS 1590 The EXT-X-INDEPENDENT-SEGMENTS tag indicates that all media samples 1591 in a Media Segment can be decoded without information from other 1592 segments. It applies to every Media Segment in the Playlist. 1594 Its format is: 1596 #EXT-X-INDEPENDENT-SEGMENTS 1597 If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master Playlist, 1598 it applies to every Media Segment in every Media Playlist in the 1599 Master Playlist. 1601 4.3.5.2. EXT-X-START 1603 The EXT-X-START tag indicates a preferred point at which to start 1604 playing a Playlist. By default, clients SHOULD start playback at 1605 this point when beginning a playback session. This tag is OPTIONAL. 1607 Its format is: 1609 #EXT-X-START:<attribute-list> 1611 The following attributes are defined: 1613 TIME-OFFSET 1615 The value of TIME-OFFSET is a signed-decimal-floating-point number 1616 of seconds. A positive number indicates a time offset from the 1617 beginning of the Playlist. A negative number indicates a negative 1618 time offset from the end of the last Media Segment in the 1619 Playlist. This attribute is REQUIRED. 1621 The absolute value of TIME-OFFSET SHOULD NOT be larger than the 1622 Playlist duration. If the absolute value of TIME-OFFSET exceeds 1623 the duration of the Playlist, it indicates either the end of the 1624 Playlist (if positive) or the beginning of the Playlist (if 1625 negative). 1627 If the Playlist does not contain the EXT-X-ENDLIST tag, the TIME- 1628 OFFSET SHOULD NOT be within three target durations of the end of 1629 the Playlist file. 1631 PRECISE 1633 The value is an enumerated-string; valid strings are YES and NO. 1634 If the value is YES, clients SHOULD start playback at the Media 1635 Segment containing the TIME-OFFSET, but SHOULD NOT render media 1636 samples in that segment whose presentation times are prior to the 1637 TIME-OFFSET. If the value is NO, clients SHOULD attempt to render 1638 every media sample in that segment. This attribute is OPTIONAL. 1639 If it is missing, its value should be treated as NO. 1641 5. Key files 1643 5.1. Structure of Key files 1645 An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key 1646 file contains a cipher key that can decrypt Media Segments in the 1647 Playlist. 1649 [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an 1650 EXT-X-KEY tag is "identity", the Key file is a single packed array of 1651 16 octets in binary format. 1653 5.2. IV for [AES_128] 1655 [AES_128] REQUIRES the same 16-octet Initialization Vector (IV) to be 1656 supplied when encrypting and decrypting. Varying this IV increases 1657 the strength of the cipher. 1659 An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" 1660 specifies an Initialization Vector that can be used when decrypting 1661 Media Segments encrypted with that Key file. IV values for AES-128 1662 are 128-bit numbers. 1664 An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an 1665 IV attribute indicates that the Media Sequence Number is to be used 1666 as the IV when decrypting a Media Segment, by putting its big-endian 1667 binary representation into a 16-octet (128-bit) buffer and padding 1668 (on the left) with zeros. 1670 6. Client/Server Responsibilities 1672 6.1. Introduction 1674 This section describes how the server generates the Playlist and 1675 Media Segments and how the client should download them for playback. 1677 6.2. Server Responsibilities 1679 6.2.1. General Server Responsibilities 1681 The production of the source media is outside the scope of this 1682 document, which simply presumes a source of continuous encoded media 1683 containing the presentation. 1685 The server MUST divide the source media into individual Media 1686 Segments whose duration is less than or equal to a constant target 1687 duration. Segments that are longer than the planned target duration 1688 can trigger playback stalls and other errors. 1690 The server SHOULD attempt to divide the source media at points that 1691 support effective decode of individual Media Segments, e.g. on packet 1692 and key frame boundaries. 1694 The server MUST create a URI for every Media Segment that enables its 1695 clients to obtain the segment data. If a server supports partial 1696 loading of resources (e.g. via HTTP Range requests), it MAY specify 1697 segments as sub-ranges of larger resources using the EXT-X-BYTERANGE 1698 tag. 1700 Any Media Segment that is specified in a Playlist loaded by a client 1701 MUST be available for immediate download, or playback errors can 1702 occur. Once download starts, its transfer rate SHOULD NOT be 1703 constrained by the segment production process. 1705 HTTP servers SHOULD transfer text files - such as Playlists and 1706 WebVTT segments - using the "gzip" Content-Encoding if the client 1707 indicates that it is prepared to accept it. 1709 The server must create a Media Playlist file (Section 4) that 1710 contains a URI for each Media Segment that the server wishes to make 1711 available, in the order in which they are to be played. 1713 The value of the EXT-X-VERSION tag (Section 4.3.1.2) SHOULD NOT be 1714 greater than what is required for the tags and attributes in the 1715 Playlist - see Section 7. 1717 Changes to the Playlist file MUST be made atomically from the point 1718 of view of the clients, or playback errors MAY occur. 1720 The server MUST NOT change the Media Playlist file, except to: 1722 Append lines to it (Section 6.2.1). 1724 Remove Media Segment URIs from the Playlist in the order that they 1725 appear, along with any tags that apply only to those segments 1726 (Section 6.2.2). 1728 Increment the value of the EXT-X-MEDIA-SEQUENCE or EXT-X 1729 -DISCONTINUITY-SEQUENCE tags (Section 6.2.2). 1731 Add an EXT-X-ENDLIST tag to the Playlist (Section 6.2.1). 1733 A Media Playlist has further constraints on its updates if it 1734 contains an EXT-X-PLAYLIST-TYPE tag. An EXT-X-PLAYLIST-TYPE tag with 1735 a value of VOD indicates that the Playlist file MUST NOT change. An 1736 EXT-X-PLAYLIST-TYPE tag with a value of EVENT indicates that the 1737 server MUST NOT change or delete any part of the Playlist file; it 1738 MAY append lines to it. 1740 The value of the EXT-X-TARGETDURATION tag in the Media Playlist MUST 1741 NOT change. A typical target duration is 10 seconds. 1743 Playlist changes other than those allowed here can trigger playback 1744 errors and inconsistent client behavior. 1746 Each Media Segment in a Media Playlist has an integer Discontinuity 1747 Sequence Number. The Discontinuity Sequence Number can be used in 1748 addition to the timestamps within the media to synchronize Media 1749 Segments across different Renditions. 1751 A segment's Discontinuity Sequence Number is the value of the EXT-X 1752 -DISCONTINUITY-SEQUENCE tag (or zero if none) plus the number of 1753 EXT-X-DISCONTINUITY tags in the Playlist preceding the URI line of 1754 the segment. 1756 The server MAY associate an absolute date and time with a Media 1757 Segment by applying an EXT-X-PROGRAM-DATE-TIME tag to it. This 1758 defines an informative mapping of the (wall-clock) date and time 1759 specified by the tag to the first media timestamp in the segment, 1760 which may be used as a basis for seeking, for display, or for other 1761 purposes. If a server provides this mapping, it SHOULD apply an 1762 EXT-X-PROGRAM-DATE-TIME tag to every segment that has an 1763 EXT-X-DISCONTINUITY tag applied to it. 1765 The Server MUST NOT add any EXT-X-PROGRAM-DATE-TIME tag to a Playlist 1766 that would cause the mapping between program date and Media Segment 1767 to become ambiguous. 1769 The server MUST NOT remove an EXT-X-DATERANGE tag from a Playlist if 1770 any date in the range maps to a Media Segment in the Playlist. 1772 The server MUST NOT reuse the ID attribute value of an 1773 EXT-X-DATERANGE tag for any new Date Range in the same Playlist. 1775 Once the Following Range of a Date Range with an END-ON-NEXT=YES 1776 attribute is added to a Playlist, the Server MUST NOT subsequently 1777 add a Date Range with the same CLASS attribute whose START-DATE is 1778 between that of the END-ON-NEXT=YES range and its Following Range. 1780 For Date Ranges with a PLANNED-DURATION attribute, the Server SHOULD 1781 signal the actual end of the range once it has been established. It 1782 can do so by adding another EXT-X-DATERANGE tag with the same ID 1783 attribute value and either a DURATION or an END-DATE attribute or, if 1784 the Date Range has an END-ON-NEXT=YES attribute, by adding a 1785 Following Range. 1787 If the Media Playlist contains the final Media Segment of the 1788 presentation then the Playlist file MUST contain the EXT-X-ENDLIST 1789 tag; this allows clients to minimize unproductive Playlist reloads. 1791 If a Media Playlist does not contain the EXT-X-ENDLIST tag, the 1792 server MUST make a new version of the Playlist file available that 1793 contains at least one new Media Segment. It MUST be made available 1794 relative to the time that the previous version of the Playlist file 1795 was made available: no earlier than one-half the target duration 1796 after that time, and no later than 1.5 times the target duration 1797 after that time. This allows clients to utilize the network 1798 efficiently. 1800 If the server wishes to remove an entire presentation, it SHOULD 1801 provide a clear indication to clients that the Playlist file is no 1802 longer available (e.g. with an HTTP 404 or 410 response). It MUST 1803 ensure that all Media Segments in the Playlist file remain available 1804 to clients for at least the duration of the Playlist file at the time 1805 of removal to prevent interruption of in-progress playback. 1807 6.2.2. Live Playlists 1809 The server MAY limit the availability of Media Segments by removing 1810 Media Segments from the Playlist file (Section 6.2.1). If Media 1811 Segments are to be removed, the Playlist file MUST contain an EXT-X 1812 -MEDIA-SEQUENCE tag. Its value MUST be incremented by 1 for every 1813 Media Segment that is removed from the Playlist file; it MUST NOT 1814 decrease or wrap. Clients can malfunction if each Media Segment does 1815 not have a consistent, unique Media Sequence Number. 1817 Media Segments MUST be removed from the Playlist file in the order 1818 that they appear in the Playlist; otherwise, client playback can 1819 malfunction. 1821 The server MUST NOT remove a Media Segment from a Playlist file 1822 without an EXT-X-ENDLIST tag if that would produce a Playlist whose 1823 duration is less than three times the target duration. Doing so can 1824 trigger playback stalls. 1826 When the server removes a Media Segment URI from the Playlist, the 1827 corresponding Media Segment MUST remain available to clients for a 1828 period of time equal to the duration of the segment plus the duration 1829 of the longest Playlist file distributed by the server containing 1830 that segment. Removing a Media Segment earlier than that can 1831 interrupt in-progress playback. 1833 If the server wishes to remove segments from a Media Playlist 1834 containing an EXT-X-DISCONTINUITY tag, the Media Playlist MUST 1835 contain an EXT-X-DISCONTINUITY-SEQUENCE tag. Without the EXT-X 1836 -DISCONTINUITY-SEQUENCE tag, it can be impossible for a client to 1837 locate corresponding segments between Renditions. 1839 If the server removes an EXT-X-DISCONTINUITY tag from the Media 1840 Playlist, it MUST increment the value of the EXT-X-DISCONTINUITY- 1841 SEQUENCE tag so that the Discontinuity Sequence Numbers of the 1842 segments still in the Media Playlist remain unchanged. The value of 1843 the EXT-X-DISCONTINUITY-SEQUENCE tag MUST NOT decrease or wrap. 1844 Clients can malfunction if each Media Segment does not have a 1845 consistent Discontinuity Sequence Number. 1847 If a server plans to remove a Media Segment after it is delivered to 1848 clients over HTTP, it SHOULD ensure that the HTTP response contains 1849 an Expires header that reflects the planned time-to-live. 1851 A Live Playlist MUST NOT contain the EXT-X-PLAYLIST-TYPE tag, as no 1852 value of that tag allows Media Segments to be removed. 1854 6.2.3. Encrypting Media Segments 1856 Media Segments MAY be encrypted. Every encrypted Media Segment MUST 1857 have an EXT-X-KEY tag (Section 4.3.2.4) applied to it with a URI that 1858 the client can use to obtain a Key file (Section 5) containing the 1859 decryption key. 1861 A Media Segment can only be encrypted with one encryption METHOD, 1862 using one encryption key and IV. However, a server MAY offer 1863 multiple ways to retrieve that key by providing multiple EXT-X-KEY 1864 tags, each with a different KEYFORMAT attribute value. 1866 The server MAY set the HTTP Expires header in the key response to 1867 indicate the duration for which the key can be cached. 1869 If an encrypted Media Segment is followed by one or more unencrypted 1870 Media Segments in the Playlist, the unencrypted Media Segments MUST 1871 have an EXT-X-KEY tag whose METHOD is NONE applied to them. 1872 Otherwise, the client will misinterpret those segments as encrypted. 1874 If the encryption METHOD is AES-128 and the Playlist does not contain 1875 the EXT-X-I-FRAMES-ONLY tag, AES encryption as described in 1876 Section 4.3.2.4 SHALL be applied to individual Media Segments. 1878 If the encryption METHOD is AES-128 and the Playlist contains an 1879 EXT-X-I-FRAMES-ONLY tag, the entire resource MUST be encrypted using 1880 AES-128 CBC with PKCS7 padding [RFC5652]. Encryption MAY be 1881 restarted on 16-byte block boundaries, unless the first block 1882 contains an I-frame. The IV used for encryption MUST be either the 1883 Media Sequence Number of the Media Segment or the value of the IV 1884 attribute of the EXT-X-KEY tag, as described in Section 5.2. These 1885 constraints allow a client to load and decrypt individual I-frames 1886 specified as sub-ranges of regular encrypted Media Segments, and 1887 their Media Initialization Sections. 1889 If the encryption METHOD is SAMPLE-AES, media samples MAY be 1890 encrypted prior to encapsulation in a Media Segment. 1892 The server MUST NOT remove an EXT-X-KEY tag from the Playlist file if 1893 it applies to any Media Segment in the Playlist file, or clients who 1894 subsequently load that Playlist will be unable to decrypt those Media 1895 Segments. 1897 6.2.4. Providing Variant Streams 1899 A server MAY offer multiple Media Playlist files to provide different 1900 encodings of the same presentation. If it does so it SHOULD provide 1901 a Master Playlist file that lists each Variant Stream to allow 1902 clients to switch between encodings dynamically. 1904 Master Playlists describe regular Variant Streams with EXT-X-STREAM- 1905 INF tags and I-frame Variant Streams with EXT-X-I-FRAME-STREAM-INF 1906 tags. 1908 If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains 1909 the CODECS attribute, the attribute value MUST include every media 1910 format [RFC6381] present in any Media Segment in any of the 1911 Renditions specified by the Variant Stream. 1913 The server MUST meet the following constraints when producing Variant 1914 Streams in order to allow clients to switch between them seamlessly: 1916 Each Variant Stream MUST present the same content. 1918 Matching content in Variant Streams MUST have matching timestamps. 1919 This allows clients to synchronize the media. 1921 Matching content in Variant Streams MUST have matching 1922 Discontinuity Sequence Numbers - see Section 4.3.3.3. 1924 Each Media Playlist in each Variant Stream MUST have the same 1925 target duration. The only exceptions are SUBTITLES Renditions and 1926 Media Playlists containing an EXT-X-I-FRAMES-ONLY tag, which MAY 1927 have different target durations if they have an EXT-X-PLAYLIST- 1928 TYPE of VOD. 1930 Content that appears in a Media Playlist of one Variant Stream but 1931 not in another MUST appear either at the beginning or at the end 1932 of the Media Playlist file and MUST NOT be longer than the target 1933 duration. 1935 If any Media Playlists have an EXT-X-PLAYLIST-TYPE tag, all Media 1936 Playlists MUST have the EXT-X-PLAYLIST-TYPE tag with the same 1937 value. 1939 If the Playlist contains an EXT-X-PLAYLIST-TYPE tag with the value 1940 of VOD, the first segment of every Media Playlist in every Variant 1941 Stream MUST start at the same media timestamp. 1943 If any Media Playlist in a Master Playlist contains an EXT-X 1944 -PROGRAM-DATE-TIME tag, then all Media Playlists in that Master 1945 Playlist MUST contain EXT-X-PROGRAM-DATE-TIME tags with consistent 1946 mappings of date and time to media timestamps. 1948 Each Variant Stream MUST contain the same set of Date Ranges, each 1949 one identified by EXT-X-DATERANGE tag(s) with the same ID 1950 attribute value and containing the same set of attributes / value 1951 pairs. 1953 In addition, for broadest compatibility, Variant Streams SHOULD 1954 contain the same encoded audio bitstream. This allows clients to 1955 switch between Variant Streams without audible glitching. 1957 The rules for Variant Streams also apply to alternative Renditions - 1958 see Section 4.3.4.2.1. 1960 6.3. Client Responsibilities 1962 6.3.1. General Client Responsibilities 1964 How the client obtains the URI to the Playlist file is outside the 1965 scope of this document; it is presumed to have done so. 1967 The client obtains the Playlist file from the URI. If the Playlist 1968 file so obtained is a Master Playlist, the client can select a 1969 Variant Stream to load from the Master Playlist. 1971 Clients MUST ensure that loaded Playlists comply with Section 4 and 1972 that the EXT-X-VERSION tag, if present, specifies a protocol version 1973 supported by the client; if either check fails, the client MUST NOT 1974 attempt to use the Playlist, or unintended behavior could occur. 1976 If any URI element in a Playlist contains an URI scheme that the 1977 client cannot handle, the client MUST stop playback. All clients 1978 MUST support HTTP schemes. 1980 To support forward compatibility, when parsing Playlists, Clients 1981 MUST: 1983 o ignore any unrecognized tags. 1985 o ignore any Attribute/value pair with an unrecognized 1986 AttributeName. 1988 o ignore any tag containing an attribute/value pair of type 1989 enumerated-string whose AttributeName is recognized but whose 1990 AttributeValue is not recognized, unless the definition of the 1991 attribute says otherwise. 1993 Algorithms used by the client to switch between Variant Streams are 1994 beyond the scope of this document. 1996 6.3.2. Loading the Media Playlist file 1998 Every time a Media Playlist is loaded or reloaded from a Playlist 1999 URI, the client MUST determine the next Media Segment to load, as 2000 described in Section 6.3.5, if it intends to play the presentation 2001 normally (i.e., in playlist order at the nominal playback rate). 2003 If the Media Playlist contains the EXT-X-MEDIA-SEQUENCE tag, the 2004 client SHOULD assume that each Media Segment in it will become 2005 unavailable at the time that the Playlist file was loaded plus the 2006 duration of the Playlist file. 2008 A client MAY use the segment Media Sequence Number to track the 2009 location of a Media Segment within a Playlist when the Playlist is 2010 reloaded. 2012 A client MUST NOT assume that segments with the same Media Sequence 2013 Number in different Variant Streams or Renditions have the same 2014 position in the presentation; Playlists MAY have independent Media 2015 Sequence Numbers. Instead, a client MUST use the relative position 2016 of each segment on the Playlist timeline and its Discontinuity 2017 Sequence Number to locate corresponding segments. 2019 A client MUST load the Media Playlist file of every Rendition 2020 selected for playback in order to locate the media specific to that 2021 Rendition. But, to prevent unnecessary load on the server, it SHOULD 2022 NOT load the Playlist file of any other Rendition. 2024 For some Variant Streams, it is possible to select Renditions that do 2025 not include the Rendition specified by the EXT-X-STREAM-INF tag. As 2026 noted above, the client SHOULD NOT load that Rendition in those 2027 cases. 2029 6.3.3. Playing the Media Playlist file 2031 The client SHALL choose which Media Segment to play first from the 2032 Media Playlist when playback starts. If the EXT-X-ENDLIST tag is not 2033 present and the client intends to play the media normally, the client 2034 SHOULD NOT choose a segment which starts less than three target 2035 durations from the end of the Playlist file. Doing so can trigger 2036 playback stalls. 2038 Normal playback can be achieved by playing the Media Segments in the 2039 order that they appear in the Playlist. The client MAY present the 2040 available media in any way it wishes, including normal playback, 2041 random access, and trick modes. 2043 The encoding parameters for samples in a Media Segment and across 2044 multiple Media Segments in a Media Playlist SHOULD remain consistent. 2045 However, clients SHOULD deal with encoding changes as they are 2046 encountered, for example by scaling video content to accommodate a 2047 resolution change. If the Variant Stream includes a RESOLUTION 2048 attribute, clients SHOULD display all video within a rectangle with 2049 the same proportions as that resolution. 2051 Clients SHOULD be prepared to handle multiple tracks of a particular 2052 type (e.g. audio or video). A client with no other preference SHOULD 2053 choose the track with the lowest numerical track identifier that it 2054 can play. 2056 Clients SHOULD ignore private streams inside Transport Streams that 2057 they do not recognize. Private streams can be used to support 2058 different devices with the same stream, although stream authors 2059 SHOULD be sensitive to the additional network load that this imposes. 2061 The client MUST be prepared to reset its parser(s) and decoder(s) 2062 before playing a Media Segment that has an EXT-X-DISCONTINUITY tag 2063 applied to it, otherwise playback errors can occur. 2065 The client SHOULD attempt to load Media Segments in advance of when 2066 they will be required for uninterrupted playback to compensate for 2067 temporary variations in latency and throughput. 2069 The client MAY use the value of the EXT-X-PROGRAM-DATE-TIME tag to 2070 display the program origination time to the user. If the value 2071 includes time zone information, the client SHALL take it into 2072 account; if it does not the client MAY assume the time to be local. 2074 Note that dates in Playlists can refer to when the content was 2075 produced (or to other times), which have no relation to the time of 2076 playback. 2078 If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after 2079 one or more media segment URIs, the client SHOULD extrapolate 2080 backward from that tag (using EXTINF durations and/or media 2081 timestamps) to associate dates with those segments. To associate a 2082 date with any other media segment that does not have an EXT-X 2083 -PROGRAM-DATE-TIME tag applied to it directly , the client SHOULD 2084 extrapolate forward from the last EXT-X-PROGRAM-DATE-TIME tag 2085 appearing before that segment in the Playlist. 2087 6.3.4. Reloading the Media Playlist file 2089 The client MUST periodically reload a Media Playlist file to learn 2090 what media is currently available, unless it contains an EXT-X 2091 -PLAYLIST-TYPE tag with a value of VOD, or a value of EVENT and the 2092 EXT-X-ENDLIST tag is also present. 2094 However the client MUST NOT attempt to reload the Playlist file more 2095 frequently than specified by this section, in order to limit the 2096 collective load on the server. 2098 When a client loads a Playlist file for the first time or reloads a 2099 Playlist file and finds that it has changed since the last time it 2100 was loaded, the client MUST wait for at least the target duration 2101 before attempting to reload the Playlist file again, measured from 2102 the last time the client began loading the Playlist file. 2104 If the client reloads a Playlist file and finds that it has not 2105 changed then it MUST wait for a period of one-half the target 2106 duration before retrying. 2108 After reloading a Media Playlist, the client SHOULD verify that each 2109 Media Segment in it has the same URI (and byte range, if specified) 2110 as the Media Segment with the same Media Sequence Number in the 2111 previous Media Playlist. It SHOULD halt playback if it does not, as 2112 this normally indicates a server error. 2114 In order to reduce server load, the client SHOULD NOT reload the 2115 Playlist files of Variant Streams or alternate Renditions that are 2116 not currently being played. If it decides to switch playback to a 2117 different Variant Stream, it SHOULD stop reloading the Playlist of 2118 the old Variant Stream and begin loading the Playlist of the new 2119 Variant Stream. It can use the EXTINF durations and the constraints 2120 in Section 6.2.4 to determine the approximate location of 2121 corresponding media. Once media from the new Variant Stream has been 2122 loaded, the timestamps in the Media Segments can be used to 2123 synchronize the old and new timelines precisely. 2125 A client MUST NOT attempt to use the Media Sequence Number to 2126 synchronize between streams - see Section 6.3.2. 2128 6.3.5. Determining the next segment to load 2130 The client MUST examine the Media Playlist file every time it is 2131 loaded or reloaded to determine the next Media Segment to load, as 2132 the set of available media MAY have changed. 2134 The first segment to load is generally the segment that the client 2135 has chosen to play first - see Section 6.3.3. 2137 In order to play the presentation normally, the next Media Segment to 2138 load is the one with the lowest Media Sequence Number that is greater 2139 than the Media Sequence Number of the last Media Segment loaded. 2141 6.3.6. Decrypting encrypted Media Segments 2143 If a Media Playlist file contains an EXT-X-KEY tag that specifies a 2144 Key file URI, the client can obtain that Key file and use the key 2145 inside it to decrypt all Media Segments to which that EXT-X-KEY tag 2146 applies. 2148 A client MUST ignore any EXT-X-KEY tag with an unsupported or 2149 unrecognized KEYFORMAT attribute, to allow for cross-device 2150 addressibility. If the Playlist contains a Media Segment to which 2151 only EXT-X-KEY tags with unrecognized or unsupported KEYFORMAT 2152 attributes are applied, playback SHOULD fail. 2154 A client MUST NOT attempt to decrypt any segments whose EXT-X-KEY tag 2155 has a METHOD attribute that it does not recognize. 2157 If the encryption METHOD is AES-128, AES-128 CBC decryption SHALL be 2158 applied to individual Media Segments, whose encryption format is 2159 described in Section 4.3.2.4. 2161 If the encryption METHOD is AES-128 and the Media Segment is part of 2162 an I-frame playlist (Section 4.3.3.6) and it has an EXT-X-BYTERANGE 2163 tag applied to it, special care needs to be taken in loading and 2164 decrypting the segment, because the resource identified by the URI is 2165 encrypted in 16-byte blocks from the start of the resource. 2167 The decrypted I-frame can be recovered by first widening its byte 2168 range, as specified by the EXT-X-BYTERANGE tag, so that it starts and 2169 ends on 16-byte boundaries from the start of the resource. 2171 Next, the byte range is widened further to include a 16-byte block at 2172 the beginning of the range. This 16-byte block allows the correct IV 2173 for the following block to be calculated. 2175 The widened byte range can then be loaded and decrypted with AES-128 2176 CBC using an arbitrary IV. The number of bytes added to the 2177 beginning and the end of the original byte range are discarded from 2178 the decrypted bytes; what remains is the decrypted I-frame. 2180 If the encryption METHOD is SAMPLE-AES, AES-128 decryption SHALL be 2181 applied to encrypted media samples within the Media Segment. 2183 An EXT-X-KEY tag with a METHOD of NONE indicates that the Media 2184 Segments it applies to are not encrypted. 2186 7. Protocol version compatibility 2188 Protocol compatibility is specified by the EXT-X-VERSION tag. A 2189 Playlist that contains tags or attributes that are not compatible 2190 with protocol version 1 MUST include an EXT-X-VERSION tag. 2192 A client MUST NOT attempt playback if it does not support the 2193 protocol version specified by the EXT-X-VERSION tag, or unintended 2194 behavior could occur. 2196 A Media Playlist MUST indicate a EXT-X-VERSION of 2 or higher if it 2197 contains: 2199 o The IV attribute of the EXT-X-KEY tag. 2201 A Media Playlist MUST indicate a EXT-X-VERSION of 3 or higher if it 2202 contains: 2204 o Floating-point EXTINF duration values. 2206 A Media Playlist MUST indicate a EXT-X-VERSION of 4 or higher if it 2207 contains: 2209 o The EXT-X-BYTERANGE tag. 2211 o The EXT-X-I-FRAMES-ONLY tag. 2213 A Media Playlist MUST indicate a EXT-X-VERSION of 5 or higher if it 2214 contains: 2216 o The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY 2217 tag. 2219 o The EXT-X-MAP tag. 2221 A Media Playlist MUST indicate a EXT-X-VERSION of 6 or higher if it 2222 contains: 2224 o The EXT-X-MAP tag in a Media Playlist that does not contain 2225 EXT-X-I-FRAMES-ONLY. 2227 A Master Playlist MUST indicate a EXT-X-VERSION of 7 or higher if it 2228 contains: 2230 o "SERVICE" values for the INSTREAM-ID attribute of the EXT-X-MEDIA 2231 tag. 2233 The EXT-X-MEDIA tag and the AUDIO, VIDEO and SUBTITLES attributes of 2234 the EXT-X-STREAM-INF tag are backward compatible to protocol version 2235 1, but playback on older clients may not be desirable. A server MAY 2236 consider indicating a EXT-X-VERSION of 4 or higher in the Master 2237 Playlist but is not required to do so. 2239 The PROGRAM-ID attribute of the EXT-X-STREAM-INF and the EXT-X-I 2240 -FRAME-STREAM-INF tags was removed in protocol version 6. 2242 The EXT-X-ALLOW-CACHE tag was removed in protocol version 7. 2244 8. Playlist Examples 2246 8.1. Simple Media Playlist 2248 #EXTM3U 2249 #EXT-X-TARGETDURATION:10 2250 #EXT-X-VERSION:3 2251 #EXTINF:9.009, 2252 http://media.example.com/first.ts 2253 #EXTINF:9.009, 2254 http://media.example.com/second.ts 2255 #EXTINF:3.003, 2256 http://media.example.com/third.ts 2257 #EXT-X-ENDLIST 2259 8.2. Live Media Playlist, using HTTPS 2260 #EXTM3U 2261 #EXT-X-VERSION:3 2262 #EXT-X-TARGETDURATION:8 2263 #EXT-X-MEDIA-SEQUENCE:2680 2265 #EXTINF:7.975, 2266 https://priv.example.com/fileSequence2680.ts 2267 #EXTINF:7.941, 2268 https://priv.example.com/fileSequence2681.ts 2269 #EXTINF:7.975, 2270 https://priv.example.com/fileSequence2682.ts 2272 8.3. Playlist with encrypted Media Segments 2274 #EXTM3U 2275 #EXT-X-VERSION:3 2276 #EXT-X-MEDIA-SEQUENCE:7794 2277 #EXT-X-TARGETDURATION:15 2279 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" 2281 #EXTINF:2.833, 2282 http://media.example.com/fileSequence52-A.ts 2283 #EXTINF:15.0, 2284 http://media.example.com/fileSequence52-B.ts 2285 #EXTINF:13.333, 2286 http://media.example.com/fileSequence52-C.ts 2288 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" 2290 #EXTINF:15.0, 2291 http://media.example.com/fileSequence53-A.ts 2293 8.4. Master Playlist 2295 #EXTM3U 2296 #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000 2297 http://example.com/low.m3u8 2298 #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000 2299 http://example.com/mid.m3u8 2300 #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000 2301 http://example.com/hi.m3u8 2302 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 2303 http://example.com/audio-only.m3u8 2305 8.5. Master Playlist with I-Frames 2307 #EXTM3U 2308 #EXT-X-STREAM-INF:BANDWIDTH=1280000 2309 low/audio-video.m3u8 2310 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=86000,URI="low/iframe.m3u8" 2311 #EXT-X-STREAM-INF:BANDWIDTH=2560000 2312 mid/audio-video.m3u8 2313 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=150000,URI="mid/iframe.m3u8" 2314 #EXT-X-STREAM-INF:BANDWIDTH=7680000 2315 hi/audio-video.m3u8 2316 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=550000,URI="hi/iframe.m3u8" 2317 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 2318 audio-only.m3u8 2320 8.6. Master Playlist with Alternative audio 2322 In this example, the CODECS attributes have been condensed for space. 2323 A '\' is used to indicate that the tag continues on the following 2324 line with whitespace removed: 2326 #EXTM3U 2327 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \ 2328 DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \ 2329 URI="main/english-audio.m3u8" 2330 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \ 2331 DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \ 2332 URI="main/german-audio.m3u8" 2333 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", \ 2334 DEFAULT=NO,AUTOSELECT=NO,LANGUAGE="en", \ 2335 URI="commentary/audio-only.m3u8" 2336 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac" 2337 low/video-only.m3u8 2338 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac" 2339 mid/video-only.m3u8 2340 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac" 2341 hi/video-only.m3u8 2342 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac" 2343 main/english-audio.m3u8 2345 8.7. Master Playlist with Alternative video 2347 This example shows 3 different video Renditions (Main, Centerfield 2348 and Dugout), and 3 different Variant Streams (low, mid and high). In 2349 this example, clients that did not support the EXT-X-MEDIA tag and 2350 the VIDEO attribute of the EXT-X-STREAM-INF tag would only be able to 2351 play the video Rendition "Main". 2353 Since the EXT-X-STREAM-INF tag has no AUDIO attribute, all video 2354 Renditions would be required to contain the audio. 2356 In this example, the CODECS attributes have been condensed for space. 2357 A '\' is used to indicate that the tag continues on the following 2358 line with whitespace removed: 2360 #EXTM3U 2361 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main", \ 2362 DEFAULT=YES,URI="low/main/audio-video.m3u8" 2363 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield", \ 2364 DEFAULT=NO,URI="low/centerfield/audio-video.m3u8" 2365 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Dugout", \ 2366 DEFAULT=NO,URI="low/dugout/audio-video.m3u8" 2368 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",VIDEO="low" 2369 low/main/audio-video.m3u8 2371 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Main", \ 2372 DEFAULT=YES,URI="mid/main/audio-video.m3u8" 2373 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Centerfield", \ 2374 DEFAULT=NO,URI="mid/centerfield/audio-video.m3u8" 2375 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Dugout", \ 2376 DEFAULT=NO,URI="mid/dugout/audio-video.m3u8" 2378 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",VIDEO="mid" 2379 mid/main/audio-video.m3u8 2381 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Main", \ 2382 DEFAULT=YES,URI="hi/main/audio-video.m3u8" 2383 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Centerfield", \ 2384 DEFAULT=NO,URI="hi/centerfield/audio-video.m3u8" 2385 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Dugout", \ 2386 DEFAULT=NO,URI="hi/dugout/audio-video.m3u8" 2388 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",VIDEO="hi" 2389 hi/main/audio-video.m3u8 2391 8.8. Session Data in a Master Playlist 2393 In this example, only the EXT-X-SESSION-DATA is shown: 2395 #EXT-X-SESSION-DATA:DATA-ID="com.example.lyrics",URI="lyrics.json" 2397 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="en", \ 2398 VALUE="This is an example" 2399 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="es", \ 2400 VALUE="Este es un ejemplo" 2402 8.9. CHARACTERISTICS attribute containing multiple characteristics 2404 Certain characteristics are valid in combination, as in: 2406 CHARACTERISTICS= 2407 "public.accessibility.transcribes-spoken-dialog,public.easy-to-read" 2409 8.10. EXT-X-DATERANGE carrying SCTE-35 tags 2411 This example shows two EXT-X-DATERANGE tags that describe a single 2412 Date Range, with a SCTE-35 "out" splice_insert() command that is 2413 subsequently updated with an SCTE-35 "in" splice_insert() command. 2415 #EXTM3U 2416 ... 2417 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11: 2418 15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF0 2419 00014056FFFFFF000E011622DCAFF000052636200000000000A0008029896F50 2420 000008700000000 2422 ... Media Segment declarations for 60s worth of media 2424 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",DURATION=59.993,SCTE35-IN= 2425 0xFC002A0000000000FF00000F056FFFFFF000401162802E6100000000000A00 2426 08029896F50000008700000000 2427 ... 2429 9. Contributors 2431 Significant contributions to the design of this protocol were made by 2432 Jim Batson, David Biderman, Bill May, Roger Pantos, Alan Tseng, and 2433 Eryk Vershen. Stuart Cheshire helped edit the specification. 2435 10. IANA Considerations 2437 This memo requests that the following MIME type [RFC2046] be 2438 registered with the IANA: 2440 Type name: "application" 2442 Subtype name: "vnd.apple.mpegurl" 2443 Required parameters: (none) 2445 Optional parameters: (none) 2447 Encoding considerations: encoded as UTF-8, which is 8-bit text. This 2448 media type may require encoding on transports not capable of handling 2449 8-bit text. See Section 4 for more information. 2451 Security considerations: See Section 11. 2453 Compression: this media type does not employ compression. 2455 Interoperability considerations: There are no byte-ordering issues, 2456 since files are 8-bit text. Applications could encounter 2457 unrecognized tags, which SHOULD be ignored. 2459 Published specification: see Section 4. 2461 Applications that use this media type: Multimedia applications such 2462 as the iPhone media player in iOS 3.0 and later and QuickTime Player 2463 in Mac OS X version 10.6 and later. 2465 Additional information: files begin with the magic number #EXTM3U. 2466 Filenames normally end with .m3u8 or .m3u (see Section 4). No 2467 Macintosh file type codes have been registered. 2469 Fragment Identifiers: no Fragment Identifiers are defined for this 2470 media type. 2472 Person & email address to contact for further information: David 2473 Singer, singer AT apple.com. 2475 Intended usage: LIMITED USE 2477 Restrictions on usage: (none) 2479 Author: Roger Pantos 2481 Change Controller: David Singer 2483 11. Security Considerations 2485 Since the protocol generally uses HTTP to transfer data, most of the 2486 same security considerations apply. See section 15 of HTTP 2487 [RFC7230]. 2489 Media file parsers are typically subject to "fuzzing" attacks. 2490 Implementors SHOULD pay particular attention to code that will parse 2491 data received from a server and ensure that all possible inputs are 2492 handled correctly. 2494 Playlist files contain URIs, which clients will use to make network 2495 requests of arbitrary entities. Clients SHOULD range-check responses 2496 to prevent buffer overflows. See also the Security Considerations 2497 section of Uniform Resource Identifier (URI): Generic Syntax 2498 [RFC3986]. 2500 Apart from URL resolution, this format does not employ any form of 2501 active content. 2503 Clients SHOULD limit each playback session to a reasonable number of 2504 concurrent downloads (e.g. 4) to avoid contributing to denial-of- 2505 service attacks. 2507 HTTP requests often include session state ("cookies"), which may 2508 contain private user data. Implementations MUST follow cookie 2509 restriction and expiry rules specified by HTTP State Management 2510 Mechanism [RFC6265] to protect themselves from attack. See also the 2511 Security Considerations section of that document, and Use of HTTP 2512 State Management [RFC2964]. 2514 Encryption keys are specified by URI. The delivery of these keys 2515 SHOULD be secured by a mechanism such as HTTP Over TLS [RFC2818] 2516 (formerly SSL) in conjunction with a secure realm or a session token. 2518 12. References 2520 12.1. Normative References 2522 [AC_3] Advanced Television Systems Committee, "ATSC Standard: 2523 A/52:2010: Digital Audio Compression (AC-3) (E-AC-3) 2524 Standard", November 2010, <http://atsc.org/wp-content/ 2525 uploads/2015/03/A52-201212-17.pdf>. 2527 [AES_128] U.S. Department of Commerce/National Institute of 2528 Standards and Technology, "Advanced Encryption Standard 2529 (AES), FIPS PUB 197", November 2001, <http://csrc.nist 2530 .gov/publications/fips/fips197/fips-197.pdf>. 2532 [CEA608] Consumer Electronics Association, "CEA-608-E: Line 21 Data 2533 Services", April 2008, <http://www.ce.org/Standards/ 2534 Standard-Listings/R4-3-Television-Data-Systems 2535 -Subcommittee/Line-21-Data-Service.aspx>. 2537 [CEA708] Consumer Electronics Association, "CEA-708-E (ANSI): 2538 Digital Television (DTV) Closed Captioning", August 2013, 2539 <http://www.ce.org/Standards/Standard-Listings/ 2540 R4-3-Television-Data-Systems-Subcommittee/CEA-708-D.aspx>. 2542 [COMMON_ENC] 2543 International Organization for Standardization, "ISO/IEC 2544 23001-7:2016; Information technology -- MPEG systems 2545 technologies -- Part 7: Common encryption in ISO base 2546 media file format files", February 2016, <http://www.iso 2547 .org/iso/catalogue_detail.htm?csnumber=68042>. 2549 [HDCP] Digital Content Protection LLC, "High-bandwidth Digital 2550 Content Protection System - Mapping HDCP to HDMI", 2551 February 2013, <http://www.digital-cp.com/sites/default/ 2552 files/specifications/ 2553 HDCP%20on%20HDMI%20Specification%20Rev2_2_Final1.pdf>. 2555 [H_264] International Telecommunications Union, "Advanced video 2556 coding for generic audiovisual services", January 2012, 2557 <http://www.itu.int/rec/T-REC-H.264>. 2559 [ISOBMFF] International Organization for Standardization, "ISO/IEC 2560 14496-12:2015; Information technology -- Coding of audio- 2561 visual objects -- Part 12: ISO base media file format", 2562 December 2015, <http://www.iso.org/iso/ 2563 catalogue_detail.htm?csnumber=68960>. 2565 [ISO_13818] 2566 International Organization for Standardization, "ISO/IEC 2567 International Standard 13818; Generic coding of moving 2568 pictures and associated audio information", October 2007, 2569 <http://www.iso.org/iso/catalogue_detail?csnumber=44169>. 2571 [ISO_13818_3] 2572 International Organization for Standardization, "ISO/IEC 2573 International Standard 13818-3:1998; Generic coding of 2574 moving pictures and associated audio information - Part 3: 2575 Audio", April 1998, <http://www.iso.org/iso/home/store/ 2576 catalogue_tc/catalogue_detail.htm?csnumber=26797>. 2578 [ISO_13818_7] 2579 International Organization for Standardization, "ISO/IEC 2580 International Standard 13818-3:2006; Generic coding of 2581 moving pictures and associated audio information - Part 7: 2582 Advanced Audio Coding (AAC)", January 2006, 2583 <http://www.iso.org/iso/home/store/catalogue_tc/ 2584 catalogue_detail.htm?csnumber=43345>. 2586 [ISO_14496] 2587 International Organization for Standardization, "ISO/IEC 2588 14496-3:2009 Information technology -- Coding of audio- 2589 visual objects -- Part 3: Audio", 2009, 2590 <http://www.iso.org/iso/catalogue_detail?csnumber=53943>. 2592 [ISO_8601] 2593 International Organization for Standardization, "ISO/IEC 2594 International Standard 8601:2004; Data elements and 2595 interchange formats -- Information interchange -- 2596 Representation of dates and times", December 2004, 2597 <http://www.iso.org/iso/catalogue_detail?csnumber=40874>. 2599 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2600 Extensions (MIME) Part Two: Media Types", RFC 2046, 2601 November 1996. 2603 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2604 Requirement Levels", BCP 14, RFC 2119, March 1997. 2606 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 2608 [RFC2964] Moore, K. and N. Freed, "Use of HTTP State Management", 2609 BCP 44, RFC 2964, October 2000. 2611 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2612 10646", STD 63, RFC 3629, November 2003. 2614 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2615 Resource Identifier (URI): Generic Syntax", STD 66, RFC 2616 3986, January 2005. 2618 [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying 2619 Languages", BCP 47, RFC 5646, September 2009. 2621 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 2622 RFC 5652, September 2009. 2624 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2625 April 2011. 2627 [RFC6381] Gellens, R., Singer, D., and P. Frojdh, "The 'Codecs' and 2628 'Profiles' Parameters for "Bucket" Media Types", RFC 6381, 2629 August 2011. 2631 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 2632 Interchange Format", RFC 7159, March 2014. 2634 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2635 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 2636 7230, DOI 10.17487/RFC7230, June 2014, 2637 <http://www.rfc-editor.org/info/rfc7230>. 2639 [SCTE35] Society of Cable Telecommunications Engineers, "SCTE-35 2640 (ANSI/SCTE): Digital Program Insertion Cueing Message for 2641 Cable", August 2014, <http://www.scte.org/documents/pdf/ 2642 Standards/ANSI_SCTE%2035%202014.pdf>. 2644 [US_ASCII] 2645 American National Standards Institute, "ANSI X3.4-1986, 2646 Information Systems -- Coded Character Sets 7-Bit American 2647 National Standard Code for Information Interchange (7-Bit 2648 ASCII)", December 1986. 2650 [WebVTT] World Wide Web Consortium (W3C), "WebVTT: The Web Video 2651 Text Tracks Format", July 2013, 2652 <http://dev.w3.org/html5/webvtt/>. 2654 12.2. Informative References 2656 [ID3] ID3.org, "The ID3 audio file data tagging format", 2657 <http://www.id3.org/Developer_Information>. 2659 [M3U] Nullsoft, Inc., "The M3U Playlist format, originally 2660 invented for the Winamp media player", 2661 <http://wikipedia.org/wiki/M3U>. 2663 [SampleEnc] 2664 Apple Inc., "MPEG-2 Stream Encryption Format for HTTP Live 2665 Streaming", <https://developer.apple.com/library/ios/ 2666 documentation/AudioVideo/Conceptual/ 2667 HLS_Sample_Encryption/>. 2669 [UTI] Apple Inc., "Uniform Type Identifier", 2670 <http://developer.apple.com/library/ios/#documentation/ 2671 general/conceptual/DevPedia-CocoaCore/ 2672 UniformTypeIdentifier.html>. 2674 Authors' Addresses 2676 Roger Pantos (editor) 2677 Apple Inc. 2678 Cupertino, California 2679 United States 2681 Email: http-live-streaming-review@group.apple.com 2682 William May, Jr. 2683 Major League Baseball Advanced Media 2684 New York, New York 2685 United States 2687 Email: bill.may@mlb.com