EXT-X-MEDIA

Describes an alternative rendition, such as an audio language, a subtitle track, closed captions or another camera angle.

Master playlist tagAny protocol versionIn: Master playlistRFC 8216, section 4.3.4.1

Syntax

#EXT-X-MEDIA:<attribute-list>

Attributes

AttributeValueRequiredWhat it means
TYPEAUDIO, VIDEO, SUBTITLES or CLOSED-CAPTIONSYesWhat kind of rendition this is. CLOSED-CAPTIONS does not describe a separate file: the captions are inside the video segments.
URIURI of the rendition's media playlistRequired for SUBTITLES; not allowed for CLOSED-CAPTIONSThe media playlist for this rendition. For AUDIO or VIDEO, leaving it out means the media is already inside the variant's own media playlist.
GROUP-IDAny string, such as "aac"YesThe group this rendition belongs to. Variants refer to the group by this value.
LANGUAGERFC 5646 language tag, such as "en" or "es"NoThe main language of the rendition.
ASSOC-LANGUAGERFC 5646 language tagNoA related language used in a different role, such as written rather than spoken, or a fallback dialect.
NAMEHuman-readable textYesThe label shown to viewers, such as "English". It should be written in the rendition's language and must be unique within the group.
DEFAULTYES or NO
Default: NO
NoYES means players should pick this rendition when the viewer has not chosen another. At most one per group.
AUTOSELECTYES or NO
Default: NO
NoYES means players may pick this rendition automatically when it suits the device, for example its language setting. If present, it must be YES when DEFAULT is YES.
FORCEDYES or NO
Default: NO
NoFor SUBTITLES only. YES marks subtitles that are essential to follow the content, such as translations of foreign-language dialogue.
INSTREAM-ID"CC1" to "CC4", or "SERVICE1" to "SERVICE63"Required for CLOSED-CAPTIONSWhich caption channel inside the video this rendition is. CC values are CEA-608 channels; SERVICE values are CEA-708 services and need version 7. The RFC 8216bis draft also allows it for other types, with version 13.
CHARACTERISTICSComma-separated identifiers, such as "public.accessibility.describes-video"NoAccessibility and other characteristics of the rendition, such as audio description or subtitles for the deaf and hard of hearing.
CHANNELSChannel count, such as "2" or "6"When two renditions share a codec but differ in channel countFor AUDIO: the maximum number of independent audio channels. Added in the RFC 8216bis draft: further slash-separated parameters for spatial audio, such as "16/JOC".
STABLE-RENDITION-IDLetters, digits and + / = . - _NoA stable identifier for the rendition that stays the same even if its URI changes between downloads of the master playlist. Added in the RFC 8216bis draft.
BIT-DEPTHBits per sample, such as 24NoFor AUDIO only: the audio bit depth, so players can pick a rendition that suits the hardware. Added in the RFC 8216bis draft.
SAMPLE-RATESamples per second, such as 48000NoFor AUDIO only: the audio sample rate, useful for lossless audio. Added in the RFC 8216bis draft.

What EXT-X-MEDIA means

EXT-X-MEDIA describes an alternative rendition: another version of the same content, such as an audio track in a different language, a different camera angle or a subtitle track. Each tag describes one rendition. Renditions with the same TYPE and GROUP-ID form a group, and a player picks one member of each group it needs.

Variant streams, defined by EXT-X-STREAM-INF, point to groups through their AUDIO, VIDEO, SUBTITLES and CLOSED-CAPTIONS attributes. That is how a 720p and a 1080p variant can share the same set of audio tracks.

Where it goes

Master playlists only, one tag per rendition. By convention the tags come before the EXT-X-STREAM-INF lines that use them.

Rules from RFC 8216

Section 4.3.4.1 and the sections after it set these rules:

The tag works at any protocol version, though RFC 8216 notes that servers may choose to declare version 4 or higher. SERVICE values in INSTREAM-ID need version 7.

Common mistakes

How players treat it

Players build their audio and subtitle menus from NAME and LANGUAGE. Without a choice from the viewer, they play the DEFAULT=YES rendition, or one marked AUTOSELECT=YES that matches the device language. Closed captions declared here travel inside the video segments as CEA-608 or CEA-708 data, so players read them from the video rather than from a separate file.

Example

#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2",URI="audio/en.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Español",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2",URI="audio/es.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",LANGUAGE="en",DEFAULT=NO,AUTOSELECT=YES,URI="subs/en.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=2800000,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2",AUDIO="aac",SUBTITLES="subs"
video/720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1400000,RESOLUTION=854x480,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="aac",SUBTITLES="subs"
video/480p.m3u8

Both video qualities share one audio group, with English as the default and Spanish as an alternative, plus a group with English subtitles.

How m3u8.cloud handles it

Audio renditions that have a URI are downloaded together with the quality you choose, using the group's default rendition. Subtitle renditions in WebVTT format can be saved next to the video as an .srt file.

Closed captions declared with TYPE=CLOSED-CAPTIONS are not extracted.

Check the tags in any playlist

Open the m3u8 inspector