idnits 2.17.1 draft-pantos-http-live-streaming-11.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 (April 16, 2013) is 4021 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 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Informational R. Pantos, Ed. 3 Internet-Draft W. May 4 Intended status: Informational Apple Inc. 5 Expires: October 18, 2013 April 16, 2013 7 HTTP Live Streaming 8 draft-pantos-http-live-streaming-11 10 Abstract 12 This document describes a protocol for transferring unbounded streams 13 of multimedia data. It specifies the data format of the files and 14 the actions to be taken by the server (sender) and the clients 15 (receivers) of the streams. It describes version 5 of this protocol. 17 Status of this Memo 19 This Internet-Draft is submitted in full conformance with the 20 provisions of BCP 78 and BCP 79. This document may not be modified, 21 and derivative works of it may not be created, and it may not be 22 published except as an Internet-Draft. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on October 18, 2013. 36 Copyright Notice 38 Copyright (c) 2013 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. 48 This Informational Internet Draft is submitted as an RFC Editor 49 Contribution and/or non-IETF Document (not as a Contribution, IETF 50 Contribution, nor IETF Document) in accordance with BCP 78 and BCP 51 79. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 56 2. Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 57 3. The Playlist file . . . . . . . . . . . . . . . . . . . . . . 4 58 3.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 4 59 3.2. Attribute Lists . . . . . . . . . . . . . . . . . . . . . 5 60 3.3. Standard Tags . . . . . . . . . . . . . . . . . . . . . . 6 61 3.3.1. EXTM3U . . . . . . . . . . . . . . . . . . . . . . . . 6 62 3.3.2. EXTINF . . . . . . . . . . . . . . . . . . . . . . . . 6 63 3.4. New Tags . . . . . . . . . . . . . . . . . . . . . . . . . 7 64 3.4.1. EXT-X-BYTERANGE . . . . . . . . . . . . . . . . . . . 7 65 3.4.2. EXT-X-TARGETDURATION . . . . . . . . . . . . . . . . . 7 66 3.4.3. EXT-X-MEDIA-SEQUENCE . . . . . . . . . . . . . . . . . 8 67 3.4.4. EXT-X-KEY . . . . . . . . . . . . . . . . . . . . . . 8 68 3.4.5. EXT-X-PROGRAM-DATE-TIME . . . . . . . . . . . . . . . 10 69 3.4.6. EXT-X-ALLOW-CACHE . . . . . . . . . . . . . . . . . . 10 70 3.4.7. EXT-X-PLAYLIST-TYPE . . . . . . . . . . . . . . . . . 10 71 3.4.8. EXT-X-ENDLIST . . . . . . . . . . . . . . . . . . . . 11 72 3.4.9. EXT-X-MEDIA . . . . . . . . . . . . . . . . . . . . . 11 73 3.4.9.1. Rendition Groups . . . . . . . . . . . . . . . . . 13 74 3.4.10. EXT-X-STREAM-INF . . . . . . . . . . . . . . . . . . . 14 75 3.4.10.1. Alternative Renditions . . . . . . . . . . . . . . 15 76 3.4.11. EXT-X-DISCONTINUITY . . . . . . . . . . . . . . . . . 16 77 3.4.12. EXT-X-I-FRAMES-ONLY . . . . . . . . . . . . . . . . . 16 78 3.4.13. EXT-X-MAP . . . . . . . . . . . . . . . . . . . . . . 17 79 3.4.14. EXT-X-I-FRAME-STREAM-INF . . . . . . . . . . . . . . . 17 80 3.4.15. EXT-X-VERSION . . . . . . . . . . . . . . . . . . . . 18 81 4. Media segments . . . . . . . . . . . . . . . . . . . . . . . . 19 82 5. Key files . . . . . . . . . . . . . . . . . . . . . . . . . . 20 83 5.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 20 84 5.2. IV for [AES_128] . . . . . . . . . . . . . . . . . . . . . 20 85 6. Client/Server Actions . . . . . . . . . . . . . . . . . . . . 20 86 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 20 87 6.2. Server Process . . . . . . . . . . . . . . . . . . . . . . 21 88 6.2.1. Introduction . . . . . . . . . . . . . . . . . . . . . 21 89 6.2.2. Sliding Window Playlists . . . . . . . . . . . . . . . 23 90 6.2.3. Encrypting media segments . . . . . . . . . . . . . . 23 91 6.2.4. Providing variant streams . . . . . . . . . . . . . . 24 92 6.3. Client Process . . . . . . . . . . . . . . . . . . . . . . 25 93 6.3.1. Introduction . . . . . . . . . . . . . . . . . . . . . 25 94 6.3.2. Loading the Playlist file . . . . . . . . . . . . . . 25 95 6.3.3. Playing the Playlist file . . . . . . . . . . . . . . 26 96 6.3.4. Reloading the Playlist file . . . . . . . . . . . . . 27 97 6.3.5. Determining the next segment to load . . . . . . . . . 27 98 6.3.6. Decrypting encrypted media segments . . . . . . . . . 28 99 7. Protocol version compatibility . . . . . . . . . . . . . . . . 29 100 8. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 101 8.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 29 102 8.2. Simple Media Playlist file . . . . . . . . . . . . . . . . 29 103 8.3. Sliding Window Media Playlist, using HTTPS . . . . . . . . 30 104 8.4. Playlist file with encrypted media segments . . . . . . . 30 105 8.5. Master Playlist file . . . . . . . . . . . . . . . . . . . 30 106 8.6. Master Playlist with I-Frames . . . . . . . . . . . . . . 31 107 8.7. Master Playlist with Alternative audio . . . . . . . . . . 31 108 8.8. Master Playlist with Alternative video . . . . . . . . . . 31 109 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . . 32 110 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 111 11. Security Considerations . . . . . . . . . . . . . . . . . . . 33 112 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 34 113 12.1. Normative References . . . . . . . . . . . . . . . . . . . 34 114 12.2. Informative References . . . . . . . . . . . . . . . . . . 36 115 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 36 117 1. Introduction 119 This document describes a protocol for transferring unbounded streams 120 of multimedia data. The protocol supports the encryption of media 121 data and the provision of alternate versions (e.g. bitrates) of a 122 stream. Media data can be transferred soon after it is created, 123 allowing it to be played in near real-time. Data is usually carried 124 over HTTP [RFC2616]. 126 External references that describe related standards such as HTTP are 127 listed in Section 11. 129 2. Summary 131 A multimedia presentation is specified by a URI [RFC3986] to a 132 Playlist file, which is an ordered list of media URIs and 133 informational tags. The URIs and their associated tags specify a 134 series of media segments. 136 To play the stream, the client first obtains the Playlist file and 137 then obtains and plays each media segment in the Playlist. It 138 reloads the Playlist file as described in this document to discover 139 additional segments. 141 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 142 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 143 document are to be interpreted as described in RFC 2119 [RFC2119]. 145 3. The Playlist file 147 3.1. Introduction 149 Playlists MUST be Extended M3U Playlist files [M3U]. This document 150 extends the M3U file format further by defining additional tags. 152 An M3U Playlist is a text file that consists of individual lines. 153 Lines are terminated by either a single LF character or a CR 154 character followed by an LF character. Each line is a URI, blank, or 155 starts with the character '#'. Blank lines are ignored. White space 156 MUST NOT be present, except for elements in which it is explicitly 157 specified. 159 A URI line identifies a media segment or a Playlist file (see 160 Section 3.4.10). Each media segment is specified by a media URI and 161 the tags that apply to it. 163 A Playlist is known as a Media Playlist if all URI lines in the 164 Playlist identify media segments. A Playlist is know as a Master 165 Playlist if all URI lines in the Playlist identify Media Playlists. 167 Lines that start with the character '#' are either comments or tags. 169 Tags begin with #EXT. All other lines that begin with '#' are 170 comments and SHOULD be ignored. 172 A URI in a Playlist, whether it is a URI line or part of a tag, MAY 173 be relative. Relative URIs MUST be resolved against the URI of the 174 Playlist file that contains it. 176 The duration of a Media Playlist file is the sum of the durations of 177 the media segments within it. 179 Playlist files whose names end in .m3u8 and/or have the HTTP Content- 180 Type "application/vnd.apple.mpegurl" are encoded in UTF-8 [RFC3629]. 181 Files whose names end with .m3u and/or have the HTTP Content-Type 182 [RFC2616] "audio/mpegurl" are encoded in US-ASCII [US_ASCII]. 184 Playlist files MUST have names that end in .m3u8 and/or have the 185 Content-Type "application/vnd.apple.mpegurl" (if transferred over 186 HTTP), or have names that end in .m3u and/or have the HTTP Content- 187 Type type "audio/mpegurl" (for compatibility). 189 3.2. Attribute Lists 191 Certain extended M3U tags have values which are Attribute Lists. An 192 Attribute List is a comma-separated list of attribute/value pairs 193 with no whitespace. 195 An attribute/value pair has the following syntax: 197 AttributeName=AttributeValue 199 An AttributeName is an unquoted string containing characters from the 200 set [A..Z] and '-'. 202 An AttributeValue is one of the following: 204 o decimal-integer: an unquoted string of characters from the set 205 [0..9] expressing an integer in base-10 arithmetic. 207 o hexadecimal-integer: an unquoted string of characters from the set 208 [0..9] and [A..F] that is prefixed with 0x or 0X and which 209 expresses an integer in base-16 arithmetic. 211 o decimal-floating-point: an unquoted string of characters from the 212 set [0..9] and '.' which expresses a floating-point number in 213 decimal positional notation. 215 o quoted-string: a string of characters within a pair of double- 216 quotes ("), including Uniform Type Identifiers [UTI]. The set of 217 characters allowed in the string and any rules for escaping 218 special characters are specified by the Attribute definition, but 219 any double-quote (") character and any carriage-return or linefeed 220 will always be replaced by an escape sequence. 222 o enumerated-string: an unquoted character string from a set which 223 is explicitly defined by the Attribute. An enumerated-string will 224 never contain double-quotes ("), commas (,), or whitespace. 226 o decimal-resolution: two decimal-integers separated by the "x" 227 character. The first integer is a horizontal pixel dimension 228 (width); the second is a vertical pixel dimension (height). 230 The type of the AttributeValue for a given AttributeName is specified 231 by the Attribute definition. 233 A given AttributeName MUST NOT appear more than once in a given 234 Attribute List. 236 An Attribute/value pair with an unrecognized AttributeName MUST be 237 ignored by the client. 239 Any tag containing an attribute/value pair of type enumerated-string 240 whose AttributeName is recognized but whose AttributeValue is not 241 recognized MUST be ignored by the client. 243 3.3. Standard Tags 245 3.3.1. EXTM3U 247 An Extended M3U file is distinguished from a basic M3U file by its 248 first line, which MUST be the tag #EXTM3U. 250 3.3.2. EXTINF 252 The EXTINF tag specifies the duration of a media segment. It applies 253 only to the media segment that follows it. Each media segment MUST 254 be preceded by an EXTINF tag. Its format is: 256 #EXTINF:, 258 "duration" is an integer or floating-point number in decimal 259 positional notation that specifies the duration of the media segment 260 in seconds. Durations that are reported as integers SHOULD be 261 rounded to the nearest integer. Durations MUST be integers if the 262 protocol version of the Playlist file is less than 3. The remainder 263 of the line following the comma is an optional human-readable 264 informative title of the media segment. 266 3.4. New Tags 268 This document defines the following new tags: EXT-X-BYTERANGE, EXT-X- 269 TARGETDURATION, EXT-X-MEDIA-SEQUENCE, EXT-X-KEY, EXT-X-PROGRAM-DATE- 270 TIME, EXT-X-ALLOW-CACHE, EXT-X-PLAYLIST-TYPE, EXT-X-STREAM-INF, EXT- 271 X-I-FRAME-STREAM-INF, EXT-X-I-FRAMES-ONLY, EXT-X-MEDIA, EXT-X- 272 ENDLIST, EXT-X-DISCONTINUITY, and EXT-X-VERSION. 274 3.4.1. EXT-X-BYTERANGE 276 The EXT-X-BYTERANGE tag indicates that a media segment is a sub-range 277 of the resource identified by its media URI. It applies only to the 278 next media URI that follows it in the Playlist. Its format is: 280 #EXT-X-BYTERANGE:<n>[@o] 282 where n is a decimal-integer indicating the length of the sub-range 283 in bytes. If present, o is a decimal-integer indicating the start of 284 the sub-range, as a byte offset from the beginning of the resource. 285 If o is not present, the sub-range begins at the next byte following 286 the sub-range of the previous media segment. 288 If o is not present, a previous media segment MUST appear in the 289 Playlist file and MUST be a sub-range of the same media resource. 291 A media URI with no EXT-X-BYTERANGE tag applied to it specifies a 292 media segment that consists of the entire resource. 294 The EXT-X-BYTERANGE tag appeared in version 4 of the protocol. 296 3.4.2. EXT-X-TARGETDURATION 298 The EXT-X-TARGETDURATION tag specifies the maximum media segment 299 duration. The EXTINF duration of each media segment in the Playlist 300 file MUST be less than or equal to the target duration. This tag 301 MUST appear once in a Media Playlist file. It applies to the entire 302 Playlist file. Its format is: 304 #EXT-X-TARGETDURATION:<s> 306 where s is an integer indicating the target duration in seconds. 308 3.4.3. EXT-X-MEDIA-SEQUENCE 310 Each media segment in a Playlist has a unique integer sequence 311 number. The sequence number of a segment is equal to the sequence 312 number of the segment that preceded it plus one. The EXT-X-MEDIA- 313 SEQUENCE tag indicates the sequence number of the first segment that 314 appears in a Playlist file. Its format is: 316 #EXT-X-MEDIA-SEQUENCE:<number> 318 A Media Playlist file MUST NOT contain more than one EXT-X-MEDIA- 319 SEQUENCE tag. If the Media Playlist file does not contain an EXT-X- 320 MEDIA-SEQUENCE tag then the sequence number of the first segment in 321 the playlist SHALL be considered to be 0. A client MUST NOT assume 322 that segments with the same sequence number in different variants or 323 renditions contain matching content. 325 A media URI is not required to contain its sequence number. 327 See Section 6.3.2 and Section 6.3.5 for information on handling the 328 EXT-X-MEDIA-SEQUENCE tag. 330 3.4.4. EXT-X-KEY 332 Media segments MAY be encrypted. The EXT-X-KEY tag specifies how to 333 decrypt them. It applies to every media segment that appears between 334 it and the next EXT-X-KEY tag in the Playlist file with the same 335 KEYFORMAT attribute (or the end of the Playlist file). Two or more 336 EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to the 337 same media segment, in which case they MUST resolve to the same key. 338 Its format is: 340 #EXT-X-KEY:<attribute-list> 342 The following attributes are defined: 344 METHOD 346 The value is an enumerated-string that specifies the encryption 347 method. This attribute is mandatory. 349 The methods defined are: NONE, AES-128, and SAMPLE-AES. 351 An encryption method of NONE means that media segments are not 352 encrypted. If the encryption method is NONE, the following 353 attributes MUST NOT be present: URI; IV; KEYFORMAT; 354 KEYFORMATVERSIONS. 356 An encryption method of AES-128 means that media segments are 357 completely encrypted using the Advanced Encryption Standard [AES_128] 358 with a 128-bit key and PKCS7 padding [RFC5652]. If the encryption 359 method is AES-128, the URI attribute MUST be present. The IV 360 attribute MAY be present; see Section 5.2. 362 An encryption method of SAMPLE-AES means that the media segments 363 contain elementary streams of audio, video, or other samples that are 364 encrypted using the Advanced Encryption Standard [AES_128]. How an 365 elementary stream is encrypted depends on the media encoding. The 366 encryption format for H.264 [H_264], AAC [ISO_14496] and AC-3 [AC_3] 367 elementary streams is described by [SampleEnc]. The IV attribute MAY 368 be present; see Section 5.2. 370 URI 372 The value is a quoted-string containing a URI [RFC3986] that 373 specifies how to obtain the key. This attribute is mandatory unless 374 the METHOD is NONE. 376 IV 378 The value is a hexadecimal-integer that specifies the Initialization 379 Vector to be used with the key. The IV attribute appeared in 380 protocol version 2. 382 KEYFORMAT 384 The value is a quoted-string that specifies how the key is 385 represented in the resource identified by the URI; see Section 5 for 386 more detail. This attribute is optional; its absence indicates, an 387 implicit value of "identity". The KEYFORMAT attribute appeared in 388 protocol version 5. 390 KEYFORMATVERSIONS 392 The value is a quoted-string containing one or more positive integers 393 separated by the "/" character (for example, "1/3"). If more than 394 one version of a particular KEYFORMAT is defined, this attribute can 395 be used to indicate which version(s) this instance complies with. 396 This attribute is optional; if it is not present, its value is 397 considered to be "1". The KEYFORMATVERSIONS attribute appeared in 398 protocol version 5. 400 If the Media Playlist file does not contain an EXT-X-KEY tag then 401 media segments are not encrypted. 403 See Section 5 for the format of the key file, and Section 5.2, 404 Section 6.2.3 and Section 6.3.6 for additional information on media 405 segment encryption. 407 3.4.5. EXT-X-PROGRAM-DATE-TIME 409 The EXT-X-PROGRAM-DATE-TIME tag associates the first sample of a 410 media segment with an absolute date and/or time. It applies only to 411 the next media segment. 413 The date/time representation is ISO/IEC 8601:2004 [ISO_8601] and 414 SHOULD indicate a time zone: 416 #EXT-X-PROGRAM-DATE-TIME:<YYYY-MM-DDThh:mm:ssZ> 418 For example: 420 #EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031+08:00 422 See Section 6.2.1 and Section 6.3.3 for more information on the EXT- 423 X-PROGRAM-DATE-TIME tag. 425 3.4.6. EXT-X-ALLOW-CACHE 427 The EXT-X-ALLOW-CACHE tag indicates whether the client MAY or MUST 428 NOT cache downloaded media segments for later replay. It MAY occur 429 anywhere in a Media Playlist file; it MUST NOT occur more than once. 430 The EXT-X-ALLOW-CACHE tag applies to all segments in the playlist. 431 Its format is: 433 #EXT-X-ALLOW-CACHE:<YES|NO> 435 See Section 6.3.3 for more information on the EXT-X-ALLOW-CACHE tag. 437 3.4.7. EXT-X-PLAYLIST-TYPE 439 The EXT-X-PLAYLIST-TYPE tag provides mutability information about the 440 Playlist file. It applies to the entire Playlist file. It is 441 optional. Its format is: 443 #EXT-X-PLAYLIST-TYPE:<EVENT|VOD> 445 Section 6.2.1 defines the implications of the EXT-X-PLAYLIST-TYPE 446 tag. 448 3.4.8. EXT-X-ENDLIST 450 The EXT-X-ENDLIST tag indicates that no more media segments will be 451 added to the Media Playlist file. It MAY occur anywhere in the 452 Playlist file; it MUST NOT occur more than once. Its format is: 454 #EXT-X-ENDLIST 456 3.4.9. EXT-X-MEDIA 458 The EXT-X-MEDIA tag is used to relate Media Playlists that contain 459 alternative renditions of the same content. For example, three EXT- 460 X-MEDIA tags can be used to identify audio-only Media Playlists that 461 contain English, French and Spanish renditions of the same 462 presentation. Or two EXT-X-MEDIA tags can be used to identify video- 463 only Media Playlists that show two different camera angles. 465 The EXT-X-MEDIA tag stands alone, in that it does not apply to a 466 particular URI in the Master Playlist. Its format is: 468 #EXT-X-MEDIA:<attribute-list> 470 The following attributes are defined: 472 URI 474 The value is a quoted-string containing a URI that identifies the 475 Playlist file. This attribute is optional; see Section 3.4.10.1. 477 TYPE 479 The value is enumerated-string; valid strings are AUDIO, VIDEO and 480 SUBTITLES. If the value is AUDIO, the Playlist described by the tag 481 MUST contain audio media. If the value is VIDEO, the Playlist MUST 482 contain video media. If the value is SUBTITLES, the Playlist MUST 483 contain subtitle media. 485 GROUP-ID 487 The value is a quoted-string identifying a mutually-exclusive group 488 of renditions. The presence of this attribute signals membership in 489 the group. See Section 3.4.9.1. 491 LANGUAGE 493 The value is a quoted-string containing an RFC 5646 [RFC5646] 494 language tag that identifies the primary language used in the 495 rendition. This attribute is optional. 497 NAME 499 The value is a quoted-string containing a human-readable description 500 of the rendition. If the LANGUAGE attribute is present then this 501 description SHOULD be in that language. 503 DEFAULT 505 The value is an enumerated-string; valid strings are YES and NO. If 506 the value is YES, then the client SHOULD play this rendition of the 507 content in the absence of information from the user indicating a 508 different choice. This attribute is optional. Its absence indicates 509 an implicit value of NO. 511 AUTOSELECT 513 The value is an enumerated-string; valid strings are YES and NO. 514 This attribute is optional. If it is present, its value MUST be YES 515 if the value of the DEFAULT attribute is YES. If the value is YES, 516 then the client MAY choose to play this rendition in the absence of 517 explicit user preference because it matches the current playback 518 environment, such as chosen system language. 520 FORCED 522 The value is an enumerated-string; valid strings are YES and NO. 523 This attribute is optional. Its absence indicates an implicit value 524 of NO. The FORCED attribute MUST NOT be present unless the TYPE is 525 SUBTITLES. 527 A value of YES indicates that the rendition contains content which is 528 considered essential to play. When selecting a FORCED rendition, a 529 client should choose the one that best matches the current playback 530 environment (e.g. language). 532 A value of NO indicates that the rendition contains content which is 533 intended to be played in response to explicit user request. 535 CHARACTERISTICS 537 The value is a quoted-string containing one or more Uniform Type 538 Identifiers [UTI] separated by comma (,) characters. This attribute 539 is optional. Each UTI indicates an individual characteristic of the 540 rendition. 542 A SUBTITLES rendition MAY include the following characteristics: 543 "public.accessibility.transcribes-spoken-dialog"; 544 "public.accessibility.describes-music-and-sound"; "public.easy-to- 545 read" (which indicates that the subtitles have been edited for ease 546 of reading). 548 An AUDIO rendition MAY include the following characteristics: 549 "public.accessibility.describes-video". 551 The CHARACTERISTICS attribute MAY include private UTIs. 553 The EXT-X-MEDIA tag appeared in version 4 of the protocol. 555 3.4.9.1. Rendition Groups 557 A set of EXT-X-MEDIA tags with the same GROUP-ID value forms a group 558 of renditions. Each member of the group MUST represent an 559 alternative rendition of the same content. 561 All EXT-X-MEDIA tags in a Playlist MUST meet the following 562 constraints: 564 o All EXT-X-MEDIA tags in the same group MUST have the same TYPE 565 attribute. 567 o All EXT-X-MEDIA tags in the same group MUST have different NAME 568 attributes. 570 o A group MUST NOT have more than one member with a DEFAULT 571 attribute of YES. 573 o All members of a group whose AUTOSELECT attribute has a value of 574 YES MUST have LANGUAGE [RFC5646] attributes with unique values. 576 o All members of a group with TYPE=AUDIO MUST use the same audio 577 sample format. 579 o All members of a group with TYPE=VIDEO MUST use the same video 580 sample format. 582 A Playlist MAY contain multiple groups of the same TYPE in order to 583 provide multiple encodings of each rendition. If it does so, each 584 group of the same TYPE SHOULD contain corresponding members with the 585 same NAME attribute, LANGUAGE attribute, and rendition. 587 3.4.10. EXT-X-STREAM-INF 589 The EXT-X-STREAM-INF tag identifies a media URI as a Media Playlist 590 file containing a multimedia presentation and provides information 591 about that presentation. It applies only to the URI that follows it. 592 Its format is: 594 #EXT-X-STREAM-INF:<attribute-list> 595 <URI> 597 The following attributes are defined: 599 BANDWIDTH 601 The value is a decimal-integer of bits per second. It MUST be an 602 upper bound of the overall bitrate of each media segment (calculated 603 to include container overhead) that appears or will appear in the 604 Playlist. 606 Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. 608 PROGRAM-ID 610 The value is a decimal-integer that uniquely identifies a particular 611 presentation within the scope of the Playlist file. 613 A Master Playlist file MAY contain multiple EXT-X-STREAM-INF tags 614 with the same PROGRAM-ID to identify different encodings of the same 615 presentation. 617 CODECS 619 The value is a quoted-string containing a comma-separated list of 620 formats, where each format specifies a media sample type that is 621 present in a media segment in the Media Playlist file. Valid format 622 identifiers are those in the ISO File Format Name Space defined by 623 RFC 6381 [RFC6381]. 625 Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. 627 RESOLUTION 629 The value is a decimal-resolution describing the approximate encoded 630 horizontal and vertical resolution of video within the presentation. 632 AUDIO 634 The value is a quoted-string. It MUST match the value of the 635 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 636 Playlist whose TYPE attribute is AUDIO. It indicates the set of 637 audio renditions that MAY be used when playing the presentation. See 638 Section 3.4.10.1. 640 VIDEO 642 The value is a quoted-string. It MUST match the value of the 643 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 644 Playlist whose TYPE attribute is VIDEO. It indicates the set of 645 video renditions that MAY be used when playing the presentation. See 646 Section 3.4.10.1. 648 SUBTITLES 650 The value is a quoted-string. It MUST match the value of the 651 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 652 Playlist whose TYPE attribute is SUBTITLES. It indicates the set of 653 subtitle renditions that MAY be used when playing the presentation. 654 See Section 3.4.10.1. 656 3.4.10.1. Alternative Renditions 658 When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, or SUBTITLE 659 attribute, it indicates that alternative renditions of the content 660 are available for playback of that variant. 662 When defining alternative renditions, the following constraints MUST 663 be met: 665 o All playable combinations of renditions associated with an EXT-X- 666 STREAM-INF tag MUST have an aggregate bandwidth less than or equal 667 to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. 669 o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a 670 VIDEO attribute, then every alternative video rendition MUST match 671 the value of the RESOLUTION attribute. 673 o Every alternative rendition associated with an EXT-X-STREAM-INF 674 tag MUST meet the constraints for a variant stream described in 675 Section 6.2.4. 677 The URI attribute is required if the media type is SUBTITLES, but 678 optional if the media type is VIDEO or AUDIO. If the media type is 679 VIDEO or AUDIO, a missing URI attribute indicates that the media data 680 for this rendition is included in the Media playlist of any EXT-X- 681 STREAM-INF tag referencing this MEDIA tag. If the media type is 682 AUDIO, the audio data for this rendition MUST also be present in any 683 video renditions specified by the EXT-X-STREAM-INF tag. 685 Note that if a client chooses to play renditions of audio and video 686 that are not present in the main Media Playlist described by the EXT- 687 X-STREAM-INF tag, or if the client chooses to play an audio rendition 688 and the main Playlist is audio-only, then the client MAY ignore the 689 main Playlist and its media. 691 3.4.11. EXT-X-DISCONTINUITY 693 The EXT-X-DISCONTINUITY tag indicates an encoding discontinuity 694 between the media segment that follows it and the one that preceded 695 it. The set of characteristics that MAY change is: 697 o file format 699 o number and type of tracks 701 o encoding parameters 703 o encoding sequence 705 o timestamp sequence 707 Its format is: 709 #EXT-X-DISCONTINUITY 711 See Section 4, Section 6.2.1, and Section 6.3.3 for more information 712 about the EXT-X-DISCONTINUITY tag. 714 3.4.12. EXT-X-I-FRAMES-ONLY 716 The EXT-X-I-FRAMES-ONLY tag indicates that each media segment in the 717 Playlist describes a single I-frame. I-frames (or Intra frames) are 718 encoded video frames whose encoding does not depend on any other 719 frame. 721 The EXT-X-I-FRAMES-ONLY tag applies to the entire Playlist. Its 722 format is: 724 #EXT-X-I-FRAMES-ONLY 726 In a Playlist with the EXT-X-I-FRAMES-ONLY tag, the media segment 727 duration (EXTINF tag value) is the time between the presentation time 728 of the I-frame in the media segment and the presentation time of the 729 next I-frame in the Playlist, or the end of the presentation if it is 730 the last I-frame in the Playlist. 732 Media resources containing I-frame segments MUST begin with either a 733 Transport Stream PAT/PMT or be accompanied by an EXT-X-MAP tag 734 indicating the proper PAT/PMT. The byte range of an I-frame segment 735 with an EXT-X-BYTERANGE tag applied to it (Section 3.4.1) MUST NOT 736 include a PAT/PMT. 738 The EXT-X-I-FRAMES-ONLY tag appeared in version 4 of the protocol. 740 3.4.13. EXT-X-MAP 742 The EXT-X-MAP tag specifies how to obtain the Transport Stream PAT/ 743 PMT for the applicable media segment. It applies to every media 744 segment that appears after it in the Playlist until the next EXT-X- 745 DISCONTINUITY tag, or until the end of the playlist. 747 The EXT-X-MAP tag MUST NOT appear unless the Playlist also contains 748 the EXT-X-I-FRAMES-ONLY tag. It is RECOMMENDED that the EXT-X-MAP 749 tag only be used for segments whose resource does not start with a 750 PAT/PMT. 752 Its format is: 754 #EXT-X-MAP:<attribute-list> 756 The following attributes are defined: 758 URI 760 The value is a quoted-string containing a URI that identifies a 761 resource that contains the Transport Stream PAT/PMT. This attribute 762 is mandatory. 764 BYTERANGE 766 The value is a quoted-string specifying a byte range into the 767 resource identified by the URI attribute. This range SHOULD contain 768 only the Transport Stream PAT/PMT. The format of the byte range is 769 described in Section 3.4.1. This attribute is optional; if it is not 770 present, the byte range is the entire resource indicated by the URI. 772 The EXT-X-MAP tag appeared in version 5 of the protocol. 774 3.4.14. EXT-X-I-FRAME-STREAM-INF 776 The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file 777 containing the I-frames of a multimedia presentation. It stands 778 alone, in that it does not apply to a particular URI in the Master 779 Playlist. Its format is: 781 #EXT-X-I-FRAME-STREAM-INF:<attribute-list> 783 All attributes defined for the EXT-X-STREAM-INF tag (Section 3.4.10) 784 are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the 785 AUDIO and SUBTITLES attributes. In addition, the following attribute 786 is defined: 788 URI 790 The value is a quoted-string containing a URI that identifies the 791 I-frame Playlist file. 793 Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute 794 and a URI attribute. 796 The provisions in Section 3.4.10.1 also apply to EXT-X-I-FRAME- 797 STREAM-INF tags with a VIDEO attribute. 799 A Master Playlist that specifies alternative VIDEO renditions and 800 I-frame Playlists SHOULD include an alternative I-frame VIDEO 801 rendition for each regular VIDEO rendition, with the same NAME and 802 LANGUAGE attributes. 804 The EXT-X-I-FRAME-STREAM-INF tag appeared in version 4 of the 805 protocol. Clients that do not implement protocol version 4 or higher 806 MUST ignore it. 808 3.4.15. EXT-X-VERSION 810 The EXT-X-VERSION tag indicates the compatibility version of the 811 Playlist file. The Playlist file, its associated media, and its 812 server MUST comply with all provisions of the most-recent version of 813 this document describing the protocol version indicated by the tag 814 value. 816 The EXT-X-VERSION tag applies to the entire Playlist file. Its 817 format is: 819 #EXT-X-VERSION:<n> 821 where n is an integer indicating the protocol version. 823 A Playlist file MUST NOT contain more than one EXT-X-VERSION tag. A 824 Playlist file that does not contain an EXT-X-VERSION tag MUST comply 825 with version 1 of this protocol. 827 4. Media segments 829 Each media URI in a Playlist file specifies a media segment which is 830 part of the overall presentation. If a media URI has an EXT-X- 831 BYTERANGE tag applied to it, the segment is a sub-range of the media 832 file identified by the URI. Otherwise, the segment is the entire 833 media file. 835 Each media segment MUST be formatted as an MPEG-2 Transport Stream 836 [ISO_13818], an MPEG audio elementary stream [ISO_11172], or a WebVTT 837 [WebVTT] file. 839 Transport Stream segments MUST contain a single MPEG-2 Program. 840 There SHOULD be a Program Association Table (PAT) and a Program Map 841 Table (PMT) at the start of each segment. A segment that contains 842 video SHOULD have at least one key frame and enough information to 843 completely initialize a video decoder. 845 A Transport Stream or audio elementary stream segment MUST be the 846 continuation of the encoded media at the end of the segment with the 847 previous sequence number, where values in a continuous series, such 848 as timestamps and Continuity Counters, continue uninterrupted - 849 unless the media segment was the first ever to appear in the Playlist 850 file or has an EXT-X-DISCONTINUITY tag applied to it. 852 Clients SHOULD be prepared to handle multiple tracks of a particular 853 type (e.g. audio or video). A client with no other preference SHOULD 854 choose the track with the lowest numerical PID that it can play. 856 Clients MUST ignore private streams inside Transport Streams that 857 they do not recognize. 859 The encoding parameters for samples in a stream inside a media 860 segment and between corresponding streams across multiple media 861 segments SHOULD remain consistent. However clients SHOULD deal with 862 encoding changes as they are encountered, for example by scaling 863 video content to accommodate a resolution change. 865 Subtitle segments MUST be formatted as WebVTT [WebVTT] files. Each 866 subtitle segment MUST contain all subtitle cues that are intended to 867 be displayed during the period indicated by the segment EXTINF 868 duration. The start time offset and end time offset of each cue MUST 869 indicate the total display time for that cue, even if that time range 870 extends beyond the EXTINF duration. A WebVTT segment MAY contain no 871 cues; this indicates that no subtitles are to be displayed during 872 that period. 874 Within each WebVTT segment there MUST be an X-TIMESTAMP-MAP metadata 875 header. This header synchronizes the cue timestamps in the WebVTT 876 file with the MPEG-2 (PES) timestamps in other streams. Its format 877 is: 879 X-TIMESTAMP-MAP=LOCAL:<cue time>,MPEGTS:<MPEG-2 time> 880 e.g. X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 882 The cue timestamp in the LOCAL attribute MAY fall outside the range 883 of time covered by the segment. 885 5. Key files 887 5.1. Introduction 889 An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key 890 file contains the cipher key that MUST be used to decrypt subsequent 891 media segments in the Playlist. 893 [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an EXT- 894 X-KEY tag is "identity", the Key file is a single packed array of 16 895 octets in binary format. 897 5.2. IV for [AES_128] 899 [AES_128] requires the same 16-octet Initialization Vector (IV) to be 900 supplied when encrypting and decrypting. Varying this IV increases 901 the strength of the cipher. 903 If an EXT-X-KEY tag has a KEYFORMAT of "identity" and an IV attribute 904 is present, implementations MUST use the attribute value as the IV 905 when encrypting or decrypting with that key. The value MUST be 906 interpreted as a 128-bit number. 908 If an EXT-X-KEY tag with a KEYFORMAT of "identity" does not have the 909 IV attribute, implementations MUST use the sequence number of the 910 media segment as the IV when encrypting or decrypting that media 911 segment. The big-endian binary representation of the sequence number 912 SHALL be placed in a 16-octet buffer and padded (on the left) with 913 zeros. 915 6. Client/Server Actions 917 6.1. Introduction 919 This section describes how the server generates the Playlist and 920 media segments and how the client should download and play them. 922 6.2. Server Process 924 6.2.1. Introduction 926 The production of the media stream is outside the scope of this 927 document, which simply presumes a source of a continuous stream 928 containing the presentation. 930 The server MUST divide the stream into individual media segments 931 whose duration is less than or equal to a constant target duration. 932 The server SHOULD attempt to divide the stream at points that support 933 effective decode of individual media segments, e.g. on packet and key 934 frame boundaries. 936 The server MUST create a URI for every media segment that enables its 937 clients to obtain the segment data. If a server supports partial 938 loading of resources (e.g. via HTTP Range requests), it MAY specify 939 segments as sub-ranges of larger resources using the EXT-X-BYTERANGE 940 tag. 942 If WebVTT segments are distributed by HTTP, the server SHOULD support 943 client requests to use the "gzip" Content-Encoding. 945 The server MUST create a Media Playlist file. The Playlist file MUST 946 conform to the format described in Section 3. A URI for each media 947 segment that the server wishes to make available MUST appear in the 948 Media Playlist in the order in which it is to be played. The entire 949 media segment MUST be available to clients if its URI is in the 950 Playlist file. 952 The Media Playlist file MUST contain an EXT-X-TARGETDURATION tag. 953 Its value MUST be equal to or greater than the EXTINF value of any 954 media segment that appears or will appear in the Playlist file. Its 955 value MUST NOT change. A typical target duration is 10 seconds. 957 The Playlist file SHOULD contain one EXT-X-VERSION tag which 958 indicates the compatibility version of the stream. Its value MUST be 959 the lowest protocol version with which the server, Playlist file, and 960 associated media segments all comply. Its value MUST NOT change. 962 The server MUST create a URI for the Playlist file that will allow 963 its clients to obtain the file. 965 If the Playlist file is distributed by HTTP, the server SHOULD 966 support client requests to use "gzip" Content-Encoding. 968 Changes to the Playlist file MUST be made atomically from the point 969 of view of the clients. 971 The server MUST NOT change the Media Playlist file, except to: 973 Append lines to it (Section 6.2.1). 975 Remove media segment URIs from the Playlist in the order that they 976 appear, along with any tags that apply only to those segments 977 (Section 6.2.2). 979 Increment the value of the EXT-X-MEDIA-SEQUENCE tag 980 (Section 6.2.2). 982 Add or remove EXT-X-STREAM-INF tags or EXT-X-I-FRAME-STREAM-INF 983 tags (Section 6.2.4). Note that clients are not required to 984 reload Master Playlist files, so changing them may not have 985 immediate effect. 987 Add an EXT-X-ENDLIST tag to the Playlist (Section 6.2.1). 989 Furthermore, the Playlist file MAY contain an EXT-X-PLAYLIST-TYPE tag 990 with a value of either EVENT or VOD. If the tag is present and has a 991 value of EVENT, the server MUST NOT change or delete any part of the 992 Playlist file (although it MAY append lines to it). If the tag is 993 present and has a value of VOD, the Playlist file MUST NOT change. 995 Every media segment in a Playlist MUST have an EXTINF tag applied to 996 it indicating the duration of the media segment. 998 The server MAY associate an absolute date and time with a media 999 segment by applying an EXT-X-PROGRAM-DATE-TIME tag to the segment. 1000 The date and time value provides an informative mapping of the 1001 timeline of the media to an appropriate wall-clock time, which may be 1002 used as a basis for seeking, for display, or for other purposes. If 1003 a server provides this mapping, it SHOULD apply an EXT-X-PROGRAM- 1004 DATE-TIME tag to every segment that has an EXT-X-DISCONTINUITY tag 1005 applied to it. 1007 If the Media Playlist contains the final media segment of the 1008 presentation then the Playlist file MUST contain the EXT-X-ENDLIST 1009 tag. 1011 If a Media Playlist does not contain the EXT-X-ENDLIST tag, the 1012 server MUST make a new version of the Playlist file available that 1013 contains at least one new media segment. It MUST be made available 1014 relative to the time that the previous version of the Playlist file 1015 was made available: no earlier than one-half the target duration 1016 after that time, and no later than 1.5 times the target duration 1017 after that time. 1019 If the server wishes to remove an entire presentation, it MUST make 1020 the Playlist file unavailable to clients. It SHOULD ensure that all 1021 media segments in the Playlist file remain available to clients for 1022 at least the duration of the Playlist file at the time of removal. 1024 6.2.2. Sliding Window Playlists 1026 The server MAY limit the availability of media segments by removing 1027 media segments from the Playlist file (Section 6.2.1). If media 1028 segments are to be removed, the Playlist file MUST contain exactly 1029 one EXT-X-MEDIA-SEQUENCE tag. Its value MUST be incremented by 1 for 1030 every media segment that is removed from the Playlist file. 1032 Media segments MUST be removed from the Playlist file in the order 1033 that they appear in the Playlist. 1035 The server MUST NOT remove a media segment from the Playlist file if 1036 the duration of the Playlist file minus the duration of the segment 1037 is less than three times the target duration. 1039 When the server removes a media segment from the Playlist, the 1040 corresponding media URI SHOULD remain available to clients for a 1041 period of time equal to the duration of the segment plus the duration 1042 of the longest Playlist file distributed by the server containing 1043 that segment. 1045 If a server plans to remove a media segment after it is delivered to 1046 clients over HTTP, it SHOULD ensure that the HTTP response contains 1047 an Expires header that reflects the planned time-to-live. 1049 6.2.3. Encrypting media segments 1051 If media segments are to be encrypted the server MUST define a URI 1052 which will allow authorized clients to obtain a Key file containing a 1053 decryption key. The Key file MUST conform to the format described in 1054 Section 5. 1056 The server MAY set the HTTP Expires header in the key response to 1057 indicate that the key may be cached. 1059 The server MUST encrypt every media segment in a Playlist according 1060 to the EXT-X-KEY tag that applies to its URI in the Playlist file. 1061 Media segments with an EXT-X-KEY tag whose METHOD is NONE, or which 1062 do not have an EXT-X-KEY tag applied to them, MUST NOT be encrypted. 1064 If the encryption METHOD is AES-128 and the Playlist does not contain 1065 the EXT-X-I-FRAMES-ONLY tag, AES-128 CBC encryption with PKCS7 1066 padding [RFC5652] SHALL be applied to individual media segments. The 1067 entire segment MUST be encrypted. Cipher Block Chaining MUST NOT be 1068 applied across media segments. The IV used for encryption MUST be 1069 either the sequence number of the media segment or the value of the 1070 IV attribute of the EXT-X-KEY tag, as described in Section 5.2. 1072 If the encryption METHOD is AES-128 and the Playlist contains an EXT- 1073 X-I-FRAMES-ONLY tag, AES-128 CBC encryption with PKCS7 padding 1074 [RFC5652] MUST be applied to the entire resource. The entire 1075 resource MUST be encrypted. Encryption MAY be restarted on 16-byte 1076 block boundaries, unless the first block contains an I-frame. The IV 1077 used for encryption MUST be either the sequence number of the media 1078 segment or the value of the IV attribute of the EXT-X-KEY tag, as 1079 described in Section 5.2. 1081 If the encryption METHOD is SAMPLE-AES, certain elementary streams 1082 MAY be encrypted prior to encapsulation in a media segment. The 1083 encryption format for H.264, AAC and AC-3 elementary streams is 1084 described by [SampleEnc]. 1086 The server MUST NOT remove an EXT-X-KEY tag from the Playlist file if 1087 it applies to any media segment in the Playlist file. 1089 6.2.4. Providing variant streams 1091 A server MAY offer multiple Media Playlist files to provide different 1092 encodings of the same presentation. If it does so it SHOULD provide 1093 a Master Playlist file that lists each variant stream to allow 1094 clients to switch between encodings dynamically. 1096 Master Playlists MUST contain an EXT-X-STREAM-INF tag or EXT-X-I- 1097 FRAME-STREAM-INF tag for each variant stream. Each tag identifying 1098 an encoding of the same presentation MUST have the same PROGRAM-ID 1099 attribute value. The PROGRAM-ID value for each presentation MUST be 1100 unique within the Master Playlist. 1102 If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains 1103 the CODECS attribute, the attribute value MUST include every format 1104 defined by [RFC6381] that is present in any media segment that 1105 appears or will appear in the associated Media Playlist file. 1107 The server MUST meet the following constraints when producing variant 1108 streams: 1110 Each variant stream MUST present the same content, including 1111 stream discontinuities. 1113 Each variant Media Playlist file MUST have the same target 1114 duration. The only exception is that SUBTITLES renditions with a 1115 EXT-X-PLAYLIST-TYPE of VOD MAY have longer target durations. 1117 Content that appears in one variant Media Playlist file but not in 1118 another MUST appear either at the beginning or at the end of the 1119 Playlist file and MUST NOT be longer than the target duration. 1121 Matching content in variant streams MUST have matching timestamps. 1122 This allows clients to synchronize the streams. 1124 Each Elementary Audio Stream segment MUST signal the timestamp of 1125 its first sample with an ID3 PRIV tag [ID3] at the beginning of 1126 the segment. The ID3 PRIV owner identifier MUST be 1127 "com.apple.streaming.transportStreamTimestamp". The ID3 payload 1128 MUST be a 33-bit MPEG-2 Program Elementary Stream timestamp 1129 expressed as a big-endian eight-octet number, with the upper 31 1130 bits set to zero. 1132 In addition, all variant streams SHOULD contain the same encoded 1133 audio bitstream. This allows clients to switch between streams 1134 without audible glitching. 1136 The rules for variant streams also apply to alternate renditions - 1137 see Section 3.4.10.1. 1139 6.3. Client Process 1141 6.3.1. Introduction 1143 How the client obtains the URI to the Playlist file is outside the 1144 scope of this document; it is presumed to have done so. 1146 The client MUST obtain the Playlist file from the URI. If the 1147 Playlist file so obtained is a Master Playlist, the client MUST 1148 obtain the Media Playlist file from the Master Playlist. 1150 This document does not specify the treatment of variant streams by 1151 clients. 1153 6.3.2. Loading the Playlist file 1155 Every time a Playlist file is loaded or reloaded from the Playlist 1156 URI: 1158 The client MUST ensure that the Playlist file begins with the 1159 EXTM3U tag and that the EXT-X-VERSION tag, if present, specifies a 1160 protocol version supported by the client; if not, the client MUST 1161 NOT attempt to use the Playlist. 1163 The client SHOULD ignore any tags and attributes it does not 1164 recognize. 1166 The client MUST determine the next media segment to load, as 1167 described in Section 6.3.5. 1169 If the Media Playlist contains the EXT-X-MEDIA-SEQUENCE tag, the 1170 client SHOULD assume that each media segment in it will become 1171 unavailable at the time that the Playlist file was loaded plus the 1172 duration of the Playlist file. 1174 6.3.3. Playing the Playlist file 1176 The client SHALL choose which media segment to play first from the 1177 Media Playlist when playback starts. If the EXT-X-ENDLIST tag is not 1178 present and the client intends to play the media regularly (i.e. in 1179 playlist order at the nominal playback rate), the client SHOULD NOT 1180 choose a segment which starts less than three target durations from 1181 the end of the Playlist file. Doing so can trigger playback stalls. 1183 To achieve regular playback, media segments MUST be played in the 1184 order that they appear in the Playlist file. The client MAY present 1185 the available media in any way it wishes, including regular playback, 1186 random access, and trick modes. 1188 The client MUST be prepared to reset its parser(s) and decoder(s) 1189 before playing a media segment that has an EXT-X-DISCONTINUITY tag 1190 applied to it. 1192 The client SHOULD attempt to load media segments in advance of when 1193 they will be required for uninterrupted playback to compensate for 1194 temporary variations in latency and throughput. 1196 If the Playlist file contains the EXT-X-ALLOW-CACHE tag and its value 1197 is NO, the client MUST NOT cache downloaded media segments after they 1198 have been played. Otherwise the client MAY cache downloaded media 1199 segments indefinitely for later replay. 1201 The client MAY use the value of the EXT-X-PROGRAM-DATE-TIME tag to 1202 display the program origination time to the user. If the value 1203 includes time zone information the client SHALL take it into account, 1204 but if it does not the client MUST NOT infer an originating time 1205 zone. 1207 The client MUST NOT depend upon the correctness or the consistency of 1208 the value of the EXT-X-PROGRAM-DATE-TIME tag. 1210 6.3.4. Reloading the Playlist file 1212 The client MUST periodically reload the Media Playlist file unless it 1213 contains the EXT-X-ENDLIST tag. 1215 However the client MUST NOT attempt to reload the Playlist file more 1216 frequently than specified by this section. 1218 When a client loads a Playlist file for the first time or reloads a 1219 Playlist file and finds that it has changed since the last time it 1220 was loaded, the client MUST wait for a period of time before 1221 attempting to reload the Playlist file again. This period is called 1222 the initial minimum reload delay. It is measured from the time that 1223 the client began loading the Playlist file. 1225 The initial minimum reload delay is the duration of the last media 1226 segment in the Playlist. Media segment duration is specified by the 1227 EXTINF tag. 1229 If the client reloads a Playlist file and finds that it has not 1230 changed then it MUST wait for a period of one-half the target 1231 duration before retrying. 1233 In order to reduce server load, the client SHOULD NOT reload the 1234 Playlist files of variant streams that are not currently being 1235 played. If it decides to switch playback to a different variant, it 1236 SHOULD stop reloading the Playlist of the old variant and begin 1237 loading the Playlist of the new variant. It can use the EXTINF 1238 durations and the constraints in Section 6.2.4 to determine the 1239 approximate location of corresponding media. Once media from the new 1240 variant has been loaded, the timestamps in the media segments can be 1241 used to synchronize the old and new timelines precisely. A client 1242 MUST NOT assume that segments with the same media sequence number in 1243 different variants or renditions contain matching content. 1245 6.3.5. Determining the next segment to load 1247 The client MUST examine the Media Playlist file every time it is 1248 loaded or reloaded to determine the next media segment to load. 1250 The first segment to load MUST be the segment that the client has 1251 chosen to play first, as described in Section 6.3.3. 1253 If the first segment to be played has been loaded and the Playlist 1254 file does not contain the EXT-X-MEDIA-SEQUENCE tag then the client 1255 MUST verify that the current Playlist file contains the URI of the 1256 last loaded media segment at the offset it was originally found at, 1257 halting playback if it does not. The next media segment to load MUST 1258 be the first media segment following the last-loaded segment in the 1259 Playlist. 1261 If the first segment to be played has been loaded and the Playlist 1262 file contains the EXT-X-MEDIA-SEQUENCE tag then the next media 1263 segment to load SHALL be the one with the lowest sequence number that 1264 is greater than the sequence number of the last media segment loaded. 1266 6.3.6. Decrypting encrypted media segments 1268 If a Media Playlist file contains an EXT-X-KEY tag that specifies a 1269 Key file URI, the client MUST obtain that key file and use the key 1270 inside it to decrypt all media segments to which that EXT-X-KEY tag 1271 applies. 1273 A client MUST NOT attempt to use an EXT-X-KEY tag with an unsupported 1274 or unrecognized KEYFORMAT attribute. A client SHOULD fail playback 1275 if the Playlist contains a media segment to which only EXT-X-KEY tags 1276 with unrecognized or unsupported KEYFORMAT attributes are applied. 1278 If the encryption METHOD is AES-128, AES-128 CBC decryption SHALL be 1279 applied to individual media segments. The entire segment MUST be 1280 decrypted. Cipher Block Chaining MUST NOT be applied across media 1281 segments. The IV used for decryption MUST be either the sequence 1282 number of the media segment or the value of the IV attribute of the 1283 EXT-X-KEY tag, as described in Section 5.2. 1285 If the encryption METHOD is AES-128 and the media segment is part of 1286 an I-frame playlist (Section 3.4.12) special care MUST be taken in 1287 loading and decrypting the segment, because the resource identified 1288 by the URI is encrypted in 16-byte blocks from the start of the 1289 resource (offset 0). The sub-range specified by the EXT-X-BYTERANGE 1290 tag MUST be widened to include the 16-byte blocks in which the 1291 beginning and end of the sub-range fall. Next, it MUST be widened 1292 further to include the previous 16-byte block. That range MUST be 1293 loaded and decrypted with AES-128 CBC using an arbitrary IV. The 1294 decrypted segment will then be in the original (unwidened) sub-range. 1296 If the encryption METHOD is SAMPLE-AES, AES-128 decryption SHALL be 1297 applied to encrypted elementary streams within the media segment. 1298 The encryption format for H.264, AAC and AC-3 elementary streams is 1299 described by [SampleEnc]. 1301 An EXT-X-KEY tag with a METHOD of NONE indicates that the media 1302 segments it applies to are not encrypted. 1304 7. Protocol version compatibility 1306 Clients and servers MUST implement protocol version 2 or higher to 1307 use: 1309 o The IV attribute of the EXT-X-KEY tag. 1311 Clients and servers MUST implement protocol version 3 or higher to 1312 use: 1314 o Floating-point EXTINF duration values. 1316 Clients and servers MUST implement protocol version 4 or higher to 1317 use: 1319 o The EXT-X-BYTERANGE tag. 1321 o The EXT-X-I-FRAME-STREAM-INF tag. 1323 o The EXT-X-I-FRAMES-ONLY tag. 1325 o The EXT-X-MEDIA tag. 1327 o The AUDIO and VIDEO attributes of the EXT-X-STREAM-INF tag. 1329 Clients and servers MUST implement protocol version 5 or higher to 1330 use: 1332 o The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY 1333 tag. 1335 o The EXT-X-MAP tag. 1337 8. Examples 1339 8.1. Introduction 1341 This section contains several example Playlist files. 1343 8.2. Simple Media Playlist file 1345 #EXTM3U 1346 #EXT-X-VERSION:3 1347 #EXT-X-TARGETDURATION:5220 1348 #EXTINF:5219.2, 1349 http://media.example.com/entire.ts 1350 #EXT-X-ENDLIST 1352 8.3. Sliding Window Media Playlist, using HTTPS 1354 #EXTM3U 1355 #EXT-X-VERSION:3 1356 #EXT-X-TARGETDURATION:8 1357 #EXT-X-MEDIA-SEQUENCE:2680 1359 #EXTINF:7.975, 1360 https://priv.example.com/fileSequence2680.ts 1361 #EXTINF:7.941, 1362 https://priv.example.com/fileSequence2681.ts 1363 #EXTINF:7.975, 1364 https://priv.example.com/fileSequence2682.ts 1366 8.4. Playlist file with encrypted media segments 1368 #EXTM3U 1369 #EXT-X-VERSION:3 1370 #EXT-X-MEDIA-SEQUENCE:7794 1371 #EXT-X-TARGETDURATION:15 1373 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" 1375 #EXTINF:2.833, 1376 http://media.example.com/fileSequence52-A.ts 1377 #EXTINF:15.0, 1378 http://media.example.com/fileSequence52-B.ts 1379 #EXTINF:13.333, 1380 http://media.example.com/fileSequence52-C.ts 1382 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" 1384 #EXTINF:15.0, 1385 http://media.example.com/fileSequence53-A.ts 1387 8.5. Master Playlist file 1389 #EXTM3U 1390 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000 1391 http://example.com/low.m3u8 1392 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000 1393 http://example.com/mid.m3u8 1394 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000 1395 http://example.com/hi.m3u8 1396 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS="mp4a.40.5" 1397 http://example.com/audio-only.m3u8 1399 8.6. Master Playlist with I-Frames 1401 In this example, the PROGRAM-ID attributes have been left out: 1403 #EXTM3U 1404 #EXT-X-STREAM-INF:BANDWIDTH=1280000 1405 low/audio-video.m3u8 1406 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=86000,URI="low/iframe.m3u8" 1407 #EXT-X-STREAM-INF:BANDWIDTH=2560000 1408 mid/audio-video.m3u8 1409 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=150000,URI="mid/iframe.m3u8" 1410 #EXT-X-STREAM-INF:BANDWIDTH=7680000 1411 hi/audio-video.m3u8 1412 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=550000,URI="hi/iframe.m3u8" 1413 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 1414 audio-only.m3u8 1416 8.7. Master Playlist with Alternative audio 1418 In this example, the PROGRAM-ID attributes have been left out. The 1419 CODECS attributes have been condensed for space. A '\' is used to 1420 indicate that the tag continues on the following line with whitespace 1421 removed: 1423 #EXTM3U 1424 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \ 1425 DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \ 1426 URI="main/english-audio.m3u8" 1427 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \ 1428 DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \ 1429 URI="main/german-audio.m3u8" 1430 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", \ 1431 DEFAULT=NO,AUTOSELECT=NO,URI="commentary/audio-only.m3u8" 1432 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac" 1433 low/video-only.m3u8 1434 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac" 1435 mid/video-only.m3u8 1436 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac" 1437 hi/video-only.m3u8 1438 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac" 1439 main/english-audio.m3u8 1441 8.8. Master Playlist with Alternative video 1443 In this example, the PROGRAM-ID attributes have been left out. The 1444 CODECS attributes have been condensed for space. A '\' is used to 1445 indicate that the tag continues on the following line with whitespace 1446 removed: 1448 #EXTM3U 1449 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main", \ 1450 DEFAULT=YES,URI="low/main/audio-video.m3u8" 1451 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield", \ 1452 DEFAULT=NO,URI="low/centerfield/audio-video.m3u8" 1453 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Dugout", \ 1454 DEFAULT=NO,URI="low/dugout/audio-video.m3u8" 1456 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",VIDEO="low" 1457 low/main/audio-video.m3u8 1459 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Main", \ 1460 DEFAULT=YES,URI="mid/main/audio-video.m3u8" 1461 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Centerfield", \ 1462 DEFAULT=NO,URI="mid/centerfield/audio-video.m3u8" 1463 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Dugout", \ 1464 DEFAULT=NO,URI="mid/dugout/audio-video.m3u8" 1466 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",VIDEO="mid" 1467 mid/main/audio-video.m3u8 1469 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Main", \ 1470 DEFAULT=YES,URI="hi/main/audio-video.m3u8" 1471 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Centerfield", \ 1472 DEFAULT=NO,URI="hi/centerfield/audio-video.m3u8" 1473 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Dugout", \ 1474 DEFAULT=NO,URI="hi/dugout/audio-video.m3u8" 1476 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",VIDEO="hi" 1477 hi/main/audio-video.m3u8 1479 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 1480 main/audio-only.m3u8 1482 9. Contributors 1484 Significant contributions to the design of this protocol were made by 1485 Jim Batson, David Biderman, Bill May, Roger Pantos, Alan Tseng, and 1486 Eryk Vershen. 1488 10. IANA Considerations 1490 This memo requests that the following MIME type [RFC2046] be 1491 registered with the IANA: 1493 Type name: "application" 1494 Subtype name: "vnd.apple.mpegurl" 1496 Required parameters: (none) 1498 Optional parameters: (none) 1500 Encoding considerations: encoded as text. See Section 3 for more 1501 information. 1503 Security considerations: See Section 11. 1505 Compression: this media type does not employ compression. 1507 Interoperability considerations: There are no byte-ordering issues, 1508 since files are 7- or 8-bit text. Applications could encounter 1509 unrecognized tags, which SHOULD be ignored. 1511 Published specification: see Section 3. 1513 Applications that use this media type: Multimedia applications such 1514 as the iPhone media player in iOS 3.0 and later and QuickTime Player 1515 in Mac OS X version 10.6 and later. 1517 Additional information: files begin with the magic number #EXTM3U. 1518 Filenames normally end with .m3u8 or .m3u (see Section 3). No 1519 Macintosh file type codes have been registered. 1521 Person & email address to contact for further information: David 1522 Singer, singer AT apple.com. 1524 Intended usage: LIMITED USE 1526 Restrictions on usage: (none) 1528 Author: Roger Pantos 1530 Change Controller: David Singer 1532 11. Security Considerations 1534 Since the protocol generally uses HTTP to transfer data, most of the 1535 same security considerations apply. See section 15 of RFC 2616 1536 [RFC2616]. 1538 Media file parsers are typically subject to "fuzzing" attacks. 1539 Clients SHOULD take care when parsing segments received from a server 1540 that non-compliant segments are rejected. 1542 Playlist files contain URIs, which clients will use to make network 1543 requests of arbitrary entities. Clients SHOULD range-check responses 1544 to prevent buffer overflows. See also the Security Considerations 1545 section of RFC 3986 [RFC3986]. 1547 Clients SHOULD load resources identified by URI lazily to avoid 1548 contributing to denial-of-service attacks. 1550 HTTP requests often include session state ("cookies"), which may 1551 contain private user data. Implementations MUST follow cookie 1552 restriction and expiry rules specified by RFC 6265 [RFC6265]. See 1553 also the Security Considerations section of RFC 6265, and RFC 2964 1554 [RFC2964]. 1556 Encryption keys are specified by URI. The delivery of these keys 1557 SHOULD be secured by a mechanism such as HTTP over TLS [RFC5246] 1558 (formerly SSL) in conjunction with a secure realm or a session 1559 cookie. 1561 12. References 1563 12.1. Normative References 1565 [AC_3] Advanced Television Systems Committee, "ATSC Standard: 1566 A/52:2010: Digital Audio Compression (AC-3) (E-AC-3) 1567 Standard", November 2010, 1568 <http://www.atsc.org/cms/standards/a_52-2010.pdf>. 1570 [AES_128] U.S. Department of Commerce/National Institute of 1571 Standards and Technology, "Advanced Encryption Standard 1572 (AES), FIPS PUB 197", November 2001, <http:// 1573 csrc.nist.gov/publications/fips/fips197/fips-197.pdf>. 1575 [H_264] International Telecommunications Union, "Advanced video 1576 coding for generic audiovisual services", January 2012, 1577 <http://www.itu.int/rec/T-REC-H.264>. 1579 [ISO_11172] 1580 International Organization for Standardization, "ISO/IEC 1581 International Standard 11172-1; Coding of moving pictures 1582 and associated audio for digital storage media -- Part 1: 1583 Systems", 1993, 1584 <http://www.iso.org/iso/catalogue_detail?csnumber=19180>. 1586 [ISO_13818] 1587 International Organization for Standardization, "ISO/IEC 1588 International Standard 13818; Generic coding of moving 1589 pictures and associated audio information", October 2007, 1590 <http://www.iso.org/iso/catalogue_detail?csnumber=44169>. 1592 [ISO_14496] 1593 International Organization for Standardization, "ISO/IEC 1594 14496-3:2009 Information technology -- Coding of audio- 1595 visual objects -- Part 3: Audio", 2009, 1596 <http://www.iso.org/iso/catalogue_detail?csnumber=53943>. 1598 [ISO_8601] 1599 International Organization for Standardization, "ISO/IEC 1600 International Standard 8601:2004; Data elements and 1601 interchange formats -- Information interchange -- 1602 Representation of dates and times", December 2004, 1603 <http://www.iso.org/iso/catalogue_detail?csnumber=40874>. 1605 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1606 Extensions (MIME) Part Two: Media Types", RFC 2046, 1607 November 1996. 1609 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1610 Requirement Levels", BCP 14, RFC 2119, March 1997. 1612 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 1613 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 1614 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 1616 [RFC2964] Moore, K. and N. Freed, "Use of HTTP State Management", 1617 BCP 44, RFC 2964, October 2000. 1619 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1620 10646", STD 63, RFC 3629, November 2003. 1622 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1623 Resource Identifier (URI): Generic Syntax", STD 66, 1624 RFC 3986, January 2005. 1626 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1627 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1629 [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying 1630 Languages", BCP 47, RFC 5646, September 2009. 1632 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 1633 RFC 5652, September 2009. 1635 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 1636 April 2011. 1638 [RFC6381] Gellens, R., Singer, D., and P. Frojdh, "The 'Codecs' and 1639 'Profiles' Parameters for "Bucket" Media Types", RFC 6381, 1640 August 2011. 1642 [US_ASCII] 1643 American National Standards Institute, "ANSI X3.4-1986, 1644 Information Systems -- Coded Character Sets 7-Bit American 1645 National Standard Code for Information Interchange (7-Bit 1646 ASCII)", December 1986. 1648 12.2. Informative References 1650 [ID3] ID3.org, "The ID3 audio file data tagging format", 1651 <http://www.id3.org/Developer_Information>. 1653 [M3U] Nullsoft, Inc., "The M3U Playlist format, originally 1654 invented for the Winamp media player", 1655 <http://wikipedia.org/wiki/M3U>. 1657 [SampleEnc] 1658 Apple Inc., "MPEG-2 Stream Encryption Format for HTTP Live 1659 Streaming", <https://developer.apple.com/library/ios/ 1660 documentation/AudioVideo/Conceptual/ 1661 HLS_Sample_Encryption/>. 1663 [UTI] Apple Inc., "Uniform Type Identifier", <http:// 1664 developer.apple.com/library/ios/#documentation/general/ 1665 conceptual/DevPedia-CocoaCore/UniformTypeIdentifier.html>. 1667 [WebVTT] World Wide Web Consortium (W3C), "WebVTT Standard", 1668 September 2012, <http://dev.w3.org/html5/webvtt/>. 1670 Authors' Addresses 1672 Roger Pantos (editor) 1673 Apple Inc. 1674 Cupertino, California 1675 United States 1677 Email: http-live-streaming-review@group.apple.com 1678 William May, Jr. 1679 Apple Inc. 1680 Cupertino, California 1681 United States 1683 Email: http-live-streaming-review@group.apple.com