2
0

hls-m3u8-draft-pantos-http-live-streaming-12.txt 82 KB

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