4.3.4. Master Playlist Tags
Master Playlist tags define the Variant Streams, Renditions, and other global parameters of the presentation. Master Playlist tags MUST NOT appear in a Media Playlist; clients MUST fail to parse any Playlist that contains both a Master Playlist tag and either a Media Playlist tag or a Media Segment tag.4.3.4.1. EXT-X-MEDIA
The EXT-X-MEDIA tag is used to relate Media Playlists that contain alternative Renditions (Section 4.3.4.2.1) of the same content. For example, three EXT-X-MEDIA tags can be used to identify audio-only Media Playlists that contain English, French, and Spanish Renditions of the same presentation. Or, two EXT-X-MEDIA tags can be used to identify video-only Media Playlists that show two different camera angles. Its format is: #EXT-X-MEDIA:<attribute-list> The following attributes are defined: TYPE The value is an enumerated-string; valid strings are AUDIO, VIDEO, SUBTITLES, and CLOSED-CAPTIONS. This attribute is REQUIRED. Typically, closed-caption [CEA608] media is carried in the video stream. Therefore, an EXT-X-MEDIA tag with TYPE of CLOSED- CAPTIONS does not specify a Rendition; the closed-caption media is present in the Media Segments of every video Rendition. URI The value is a quoted-string containing a URI that identifies the Media Playlist file. This attribute is OPTIONAL; see Section 4.3.4.2.1. If the TYPE is CLOSED-CAPTIONS, the URI attribute MUST NOT be present.
GROUP-ID The value is a quoted-string that specifies the group to which the Rendition belongs. See Section 4.3.4.1.1. This attribute is REQUIRED. LANGUAGE The value is a quoted-string containing one of the standard Tags for Identifying Languages [RFC5646], which identifies the primary language used in the Rendition. This attribute is OPTIONAL. ASSOC-LANGUAGE The value is a quoted-string containing a language tag [RFC5646] that identifies a language that is associated with the Rendition. An associated language is often used in a different role than the language specified by the LANGUAGE attribute (e.g., written versus spoken or a fallback dialect). This attribute is OPTIONAL. The LANGUAGE and ASSOC-LANGUAGE attributes can be used, for example, to link Norwegian Renditions that use different spoken and written languages. NAME The value is a quoted-string containing a human-readable description of the Rendition. If the LANGUAGE attribute is present, then this description SHOULD be in that language. This attribute is REQUIRED. DEFAULT The value is an enumerated-string; valid strings are YES and NO. If the value is YES, then the client SHOULD play this Rendition of the content in the absence of information from the user indicating a different choice. This attribute is OPTIONAL. Its absence indicates an implicit value of NO. AUTOSELECT The value is an enumerated-string; valid strings are YES and NO. This attribute is OPTIONAL. Its absence indicates an implicit value of NO. If the value is YES, then the client MAY choose to play this Rendition in the absence of explicit user preference because it matches the current playback environment, such as chosen system language.
If the AUTOSELECT attribute is present, its value MUST be YES if the value of the DEFAULT attribute is YES. FORCED The value is an enumerated-string; valid strings are YES and NO. This attribute is OPTIONAL. Its absence indicates an implicit value of NO. The FORCED attribute MUST NOT be present unless the TYPE is SUBTITLES. A value of YES indicates that the Rendition contains content that is considered essential to play. When selecting a FORCED Rendition, a client SHOULD choose the one that best matches the current playback environment (e.g., language). A value of NO indicates that the Rendition contains content that is intended to be played in response to explicit user request. INSTREAM-ID The value is a quoted-string that specifies a Rendition within the segments in the Media Playlist. This attribute is REQUIRED if the TYPE attribute is CLOSED-CAPTIONS, in which case it MUST have one of the values: "CC1", "CC2", "CC3", "CC4", or "SERVICEn" where n MUST be an integer between 1 and 63 (e.g., "SERVICE3" or "SERVICE42"). The values "CC1", "CC2", "CC3", and "CC4" identify a Line 21 Data Services channel [CEA608]. The "SERVICE" values identify a Digital Television Closed Captioning [CEA708] service block number. For all other TYPE values, the INSTREAM-ID MUST NOT be specified. CHARACTERISTICS The value is a quoted-string containing one or more Uniform Type Identifiers [UTI] separated by comma (,) characters. This attribute is OPTIONAL. Each UTI indicates an individual characteristic of the Rendition. A SUBTITLES Rendition MAY include the following characteristics: "public.accessibility.transcribes-spoken-dialog", "public.accessibility.describes-music-and-sound", and "public.easy-to-read" (which indicates that the subtitles have been edited for ease of reading).
An AUDIO Rendition MAY include the following characteristic: "public.accessibility.describes-video". The CHARACTERISTICS attribute MAY include private UTIs. CHANNELS The value is a quoted-string that specifies an ordered, backslash- separated ("/") list of parameters. If the TYPE attribute is AUDIO, then the first parameter is a count of audio channels expressed as a decimal-integer, indicating the maximum number of independent, simultaneous audio channels present in any Media Segment in the Rendition. For example, an AC-3 5.1 Rendition would have a CHANNELS="6" attribute. No other CHANNELS parameters are currently defined. All audio EXT-X-MEDIA tags SHOULD have a CHANNELS attribute. If a Master Playlist contains two Renditions encoded with the same codec but a different number of channels, then the CHANNELS attribute is REQUIRED; otherwise, it is OPTIONAL.4.3.4.1.1. Rendition Groups
A set of one or more EXT-X-MEDIA tags with the same GROUP-ID value and the same TYPE value defines a Group of Renditions. Each member of the Group MUST be an alternative Rendition of the same content; otherwise, playback errors can occur. All EXT-X-MEDIA tags in a Playlist MUST meet the following constraints: o All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes. o A Group MUST NOT have more than one member with a DEFAULT attribute of YES. o Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have a combination of LANGUAGE [RFC5646], ASSOC-LANGUAGE, FORCED, and CHARACTERISTICS attributes that is distinct from those of other AUTOSELECT=YES members of its Group. A Playlist MAY contain multiple Groups of the same TYPE in order to provide multiple encodings of that media type. If it does so, each Group of the same TYPE MUST have the same set of members, and each corresponding member MUST have identical attributes with the exception of the URI and CHANNELS attributes.
Each member in a Group of Renditions MAY have a different sample format. For example, an English Rendition can be encoded with AC-3 5.1 while a Spanish Rendition is encoded with AAC stereo. However, any EXT-X-STREAM-INF tag (Section 4.3.4.2) or EXT-X-I-FRAME-STREAM- INF tag (Section 4.3.4.3) that references such a Group MUST have a CODECS attribute that lists every sample format present in any Rendition in the Group, or client playback failures can occur. In the example above, the CODECS attribute would include "ac-3,mp4a.40.2".4.3.4.2. EXT-X-STREAM-INF
The EXT-X-STREAM-INF tag specifies a Variant Stream, which is a set of Renditions that can be combined to play the presentation. The attributes of the tag provide information about the Variant Stream. The URI line that follows the EXT-X-STREAM-INF tag specifies a Media Playlist that carries a Rendition of the Variant Stream. The URI line is REQUIRED. Clients that do not support multiple video Renditions SHOULD play this Rendition. Its format is: #EXT-X-STREAM-INF:<attribute-list> <URI> The following attributes are defined: BANDWIDTH The value is a decimal-integer of bits per second. It represents the peak segment bit rate of the Variant Stream. If all the Media Segments in a Variant Stream have already been created, the BANDWIDTH value MUST be the largest sum of peak segment bit rates that is produced by any playable combination of Renditions. (For a Variant Stream with a single Media Playlist, this is just the peak segment bit rate of that Media Playlist.) An inaccurate value can cause playback stalls or prevent clients from playing the variant. If the Master Playlist is to be made available before all Media Segments in the presentation have been encoded, the BANDWIDTH value SHOULD be the BANDWIDTH value of a representative period of similar content, encoded using the same settings.
Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. AVERAGE-BANDWIDTH The value is a decimal-integer of bits per second. It represents the average segment bit rate of the Variant Stream. If all the Media Segments in a Variant Stream have already been created, the AVERAGE-BANDWIDTH value MUST be the largest sum of average segment bit rates that is produced by any playable combination of Renditions. (For a Variant Stream with a single Media Playlist, this is just the average segment bit rate of that Media Playlist.) An inaccurate value can cause playback stalls or prevent clients from playing the variant. If the Master Playlist is to be made available before all Media Segments in the presentation have been encoded, the AVERAGE- BANDWIDTH value SHOULD be the AVERAGE-BANDWIDTH value of a representative period of similar content, encoded using the same settings. The AVERAGE-BANDWIDTH attribute is OPTIONAL. CODECS The value is a quoted-string containing a comma-separated list of formats, where each format specifies a media sample type that is present in one or more Renditions specified by the Variant Stream. Valid format identifiers are those in the ISO Base Media File Format Name Space defined by "The 'Codecs' and 'Profiles' Parameters for "Bucket" Media Types" [RFC6381]. For example, a stream containing AAC low complexity (AAC-LC) audio and H.264 Main Profile Level 3.0 video would have a CODECS value of "mp4a.40.2,avc1.4d401e". Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. RESOLUTION The value is a decimal-resolution describing the optimal pixel resolution at which to display all the video in the Variant Stream. The RESOLUTION attribute is OPTIONAL but is recommended if the Variant Stream includes video.
FRAME-RATE The value is a decimal-floating-point describing the maximum frame rate for all the video in the Variant Stream, rounded to three decimal places. The FRAME-RATE attribute is OPTIONAL but is recommended if the Variant Stream includes video. The FRAME-RATE attribute SHOULD be included if any video in a Variant Stream exceeds 30 frames per second. HDCP-LEVEL The value is an enumerated-string; valid strings are TYPE-0 and NONE. This attribute is advisory; a value of TYPE-0 indicates that the Variant Stream could fail to play unless the output is protected by High-bandwidth Digital Content Protection (HDCP) Type 0 [HDCP] or equivalent. A value of NONE indicates that the content does not require output copy protection. Encrypted Variant Streams with different HDCP levels SHOULD use different media encryption keys. The HDCP-LEVEL attribute is OPTIONAL. It SHOULD be present if any content in the Variant Stream will fail to play without HDCP. Clients without output copy protection SHOULD NOT load a Variant Stream with an HDCP-LEVEL attribute unless its value is NONE. AUDIO The value is a quoted-string. It MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist whose TYPE attribute is AUDIO. It indicates the set of audio Renditions that SHOULD be used when playing the presentation. See Section 4.3.4.2.1. The AUDIO attribute is OPTIONAL. VIDEO The value is a quoted-string. It MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist whose TYPE attribute is VIDEO. It indicates the set of video Renditions that SHOULD be used when playing the presentation. See Section 4.3.4.2.1. The VIDEO attribute is OPTIONAL.
SUBTITLES The value is a quoted-string. It MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master Playlist whose TYPE attribute is SUBTITLES. It indicates the set of subtitle Renditions that can be used when playing the presentation. See Section 4.3.4.2.1. The SUBTITLES attribute is OPTIONAL. CLOSED-CAPTIONS The value can be either a quoted-string or an enumerated-string with the value NONE. If the value is a quoted-string, it MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Playlist whose TYPE attribute is CLOSED-CAPTIONS, and it indicates the set of closed-caption Renditions that can be used when playing the presentation. See Section 4.3.4.2.1. If the value is the enumerated-string value NONE, all EXT-X- STREAM-INF tags MUST have this attribute with a value of NONE, indicating that there are no closed captions in any Variant Stream in the Master Playlist. Having closed captions in one Variant Stream but not another can trigger playback inconsistencies. The CLOSED-CAPTIONS attribute is OPTIONAL.4.3.4.2.1. Alternative Renditions
When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, SUBTITLES, or CLOSED-CAPTIONS attribute, it indicates that alternative Renditions of the content are available for playback of that Variant Stream. When defining alternative Renditions, the following constraints MUST be met to prevent client playback errors: o All playable combinations of Renditions associated with an EXT-X- STREAM-INF tag MUST have an aggregate bandwidth less than or equal to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a VIDEO attribute, then every alternative video Rendition MUST have an optimal display resolution matching the value of the RESOLUTION attribute. o Every alternative Rendition associated with an EXT-X-STREAM-INF tag MUST meet the constraints for a Variant Stream described in Section 6.2.4.
The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. If the media type is VIDEO or AUDIO, a missing URI attribute indicates that the media data for this Rendition is included in the Media Playlist of any EXT-X-STREAM-INF tag referencing this EXT- X-MEDIA tag. If the media TYPE is AUDIO and the URI attribute is missing, clients MUST assume that the audio data for this Rendition is present in every video Rendition specified by the EXT-X-STREAM-INF tag. The URI attribute of the EXT-X-MEDIA tag MUST NOT be included if the media type is CLOSED-CAPTIONS.4.3.4.3. EXT-X-I-FRAME-STREAM-INF
The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file containing the I-frames of a multimedia presentation. It stands alone, in that it does not apply to a particular URI in the Master Playlist. Its format is: #EXT-X-I-FRAME-STREAM-INF:<attribute-list> All attributes defined for the EXT-X-STREAM-INF tag (Section 4.3.4.2) are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the FRAME-RATE, AUDIO, SUBTITLES, and CLOSED-CAPTIONS attributes. In addition, the following attribute is defined: URI The value is a quoted-string containing a URI that identifies the I-frame Media Playlist file. That Playlist file MUST contain an EXT-X-I-FRAMES-ONLY tag. Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute and a URI attribute. The provisions in Section 4.3.4.2.1 also apply to EXT-X-I-FRAME- STREAM-INF tags with a VIDEO attribute. A Master Playlist that specifies alternative VIDEO Renditions and I-frame Playlists SHOULD include an alternative I-frame VIDEO Rendition for each regular VIDEO Rendition, with the same NAME and LANGUAGE attributes.
4.3.4.4. EXT-X-SESSION-DATA
The EXT-X-SESSION-DATA tag allows arbitrary session data to be carried in a Master Playlist. Its format is: #EXT-X-SESSION-DATA:<attribute-list> The following attributes are defined: DATA-ID The value of DATA-ID is a quoted-string that identifies a particular data value. The DATA-ID SHOULD conform to a reverse DNS naming convention, such as "com.example.movie.title"; however, there is no central registration authority, so Playlist authors SHOULD take care to choose a value that is unlikely to collide with others. This attribute is REQUIRED. VALUE VALUE is a quoted-string. It contains the data identified by DATA-ID. If the LANGUAGE is specified, VALUE SHOULD contain a human-readable string written in the specified language. URI The value is a quoted-string containing a URI. The resource identified by the URI MUST be formatted as JSON [RFC7159]; otherwise, clients may fail to interpret the resource. LANGUAGE The value is a quoted-string containing a language tag [RFC5646] that identifies the language of the VALUE. This attribute is OPTIONAL. Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI attribute, but not both. A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same DATA-ID attribute. A Playlist MUST NOT contain more than one EXT-X- SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute.
4.3.4.5. EXT-X-SESSION-KEY
The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists to be specified in a Master Playlist. This allows the client to preload these keys without having to read the Media Playlist(s) first. Its format is: #EXT-X-SESSION-KEY:<attribute-list> All attributes defined for the EXT-X-KEY tag (Section 4.3.2.4) are also defined for the EXT-X-SESSION-KEY, except that the value of the METHOD attribute MUST NOT be NONE. If an EXT-X-SESSION-KEY is used, the values of the METHOD, KEYFORMAT, and KEYFORMATVERSIONS attributes MUST match any EXT-X-KEY with the same URI value. EXT-X-SESSION-KEY tags SHOULD be added if multiple Variant Streams or Renditions use the same encryption keys and formats. An EXT-X- SESSION-KEY tag is not associated with any particular Media Playlist. A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values. The EXT-X-SESSION-KEY tag is optional.4.3.5. Media or Master Playlist Tags
The tags in this section can appear in either Master Playlists or Media Playlists. If one of these tags appears in a Master Playlist, it SHOULD NOT appear in any Media Playlist referenced by that Master Playlist. A tag that appears in both MUST have the same value; otherwise, clients SHOULD ignore the value in the Media Playlist(s). These tags MUST NOT appear more than once in a Playlist. If a tag appears more than once, clients MUST fail to parse the Playlist.4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS
The EXT-X-INDEPENDENT-SEGMENTS tag indicates that all media samples in a Media Segment can be decoded without information from other segments. It applies to every Media Segment in the Playlist. Its format is: #EXT-X-INDEPENDENT-SEGMENTS
If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master Playlist, it applies to every Media Segment in every Media Playlist in the Master Playlist.4.3.5.2. EXT-X-START
The EXT-X-START tag indicates a preferred point at which to start playing a Playlist. By default, clients SHOULD start playback at this point when beginning a playback session. This tag is OPTIONAL. Its format is: #EXT-X-START:<attribute-list> The following attributes are defined: TIME-OFFSET The value of TIME-OFFSET is a signed-decimal-floating-point number of seconds. A positive number indicates a time offset from the beginning of the Playlist. A negative number indicates a negative time offset from the end of the last Media Segment in the Playlist. This attribute is REQUIRED. The absolute value of TIME-OFFSET SHOULD NOT be larger than the Playlist duration. If the absolute value of TIME-OFFSET exceeds the duration of the Playlist, it indicates either the end of the Playlist (if positive) or the beginning of the Playlist (if negative). If the Playlist does not contain the EXT-X-ENDLIST tag, the TIME- OFFSET SHOULD NOT be within three target durations of the end of the Playlist file. PRECISE The value is an enumerated-string; valid strings are YES and NO. If the value is YES, clients SHOULD start playback at the Media Segment containing the TIME-OFFSET, but SHOULD NOT render media samples in that segment whose presentation times are prior to the TIME-OFFSET. If the value is NO, clients SHOULD attempt to render every media sample in that segment. This attribute is OPTIONAL. If it is missing, its value should be treated as NO.
5. Key Files
5.1. Structure of Key Files
An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key file contains a cipher key that can decrypt Media Segments in the Playlist. [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an EXT- X-KEY tag is "identity", the Key file is a single packed array of 16 octets in binary format.5.2. IV for AES-128
[AES_128] REQUIRES the same 16-octet IV to be supplied when encrypting and decrypting. Varying this IV increases the strength of the cipher. An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" specifies an IV that can be used when decrypting Media Segments encrypted with that Key file. IV values for AES-128 are 128-bit numbers. An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an IV attribute indicates that the Media Sequence Number is to be used as the IV when decrypting a Media Segment, by putting its big-endian binary representation into a 16-octet (128-bit) buffer and padding (on the left) with zeros.