Skip to content

HLS Tags - Everything you need to know

Let's take a deep dive into the HLS format and see what all of those #EXT tags, also known as directives, are for and why they are needed.

Here's a very short example HLS media playlist:

#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:6 #EXT-X-PLAYLIST-TYPE:VOD #EXTINF:5, https://chunk-gcp-us-east1-vop1.fastly.mux.com/v1/chunk/XycqKjh00026zR5gJcIhREMs0101JahGDI7VHKpZaou4n01kQQAXC3M6QWgNftsD00Pi02XJOPVqpyEIgzp23c02UuxGhsPLeN01k002qTAKwQh00IyrSQ/0.ts?skid=default&signature=NjcwOTNkNzBfODE4NzJlZWExYzY5ZjAyZTdjOGE0NDEwZjEzYzBhYmZiMzE4NDFkYmU2NTI2ZDE3MDI0ZmY3NzlmMDgwN2M5Mw==&zone=0 #EXTINF:5, https://chunk-gcp-us-east1-vop1.fastly.mux.com/v1/chunk/Qjd6SRi00Td6KEEjsU2qXDooj6suaHJRH92eaBtNI7NkQjfeVXOOEJIoAp6ab4hLSw1A42V02CnehDrfla2If87phpN2DZlIEc5F6Lz3ULeeo/1.ts?skid=default&signature=NjcwOTNkNzBfZjkwYjg0NTllZTBhNDU2OTgxOThlZmMwYzIwNTgxOGI0NWYwYWEyMDI0NTY5NWNlZTY5ZDkwNTEyNTZmYzU5NQ==&zone=0 #EXT-X-ENDLIST

This sample file has two media chunks of 5 seconds each that together make up a short 10 second video.

LinkWhat is a HLS file?

Usually a text file with an .m3u8 file extension, an HLS playlist describes where all of the smaller pieces of media can be found that make up a video stream. A program that reads the manifest file grabs all of the smaller video chunks defined and stitches them back together for playback.

Originating from the .m3u file format - meaning mp3 url - the format quickly evolved into the format we are used to working with today called "extended m3u8". Apple defined the HLS spec on top of the extended m3u format which is where all of those #EXT-X-: directives come from.

LinkWhat is the difference between a multi-variant playlist (master manifest) and a media playlist?

HLS streaming normally takes advantage of ABR (adaptive bitrate streaming) which means that instead of a single video there's actually many different copies of the same file in different resolutions. This means that the player, or the user if they want to manually switch, can jump seamlessly between different resolutions during playback.

A multi-variant playlist (what used to be called a master manifest) describes where media playlists can be found. These media playlists describe where the actual media chunks are located for a given resolution.

The multi-variant playlist is therefore just a list of "variants" of the same piece of media, it doesn't define where the video chunks themselves are, that's the job of the media playlists that it lists. Usually these variants describe different resolutions like 1080p, 4K, etc.

If you've made it this far, you might be interested in the Mux Video API to utilize HLS.

Learn more about Mux Video

LinkWhat do the HLS tags and directives mean?

Let's take a look at the most common tags that make up the HLS format and see why they are needed.

Link#EXT

The file header. Must be on the first line.

Link#EXTINF:

Defines track information. For example: #EXTINF:60,Big Buck Bunny describes a track that is 60 seconds long followed by a comma and the title of the track.

Link#PLAYLIST:

Defines the title of a playlist e.g. #PLAYLIST:My favorite ice cream flavors.

Link#EXT-X-START:

Defines where a playlist should start from e.g. #EXT-X-START:TIME-OFFSET:5 means that the playback should start from 5 second in.

Link#EXT-X-INDEPENDENT-SEGMENTS

This is a boolean directive (it doesn't have any paramaters). It indicates that each media segment can be decoded on it's own and played without needing to decode other segments in order to play it.

Link#EXT-X-PLAYLIST-TYPE:

Defines the type of playlist, possible values are "EVENT" or "VOD". Event is usually use for live streams and VOD for regular video playback e.g. #EXT-X-PLAYLIST-TYPE:VOD

Link#EXT-X-TARGETDURATION:

Defines the maximum duration that any individual media segment is expected to be e.g: #EXT-X-TARGETDURATION:5 specifies that no segment should exceed 5 seconds in duration.

Link#EXT-X-VERSION:

Which version of the HLS format is being used. Each version introduced new tags and directives so make sure you're only using directives specified by this version e.g. #EXT-X-VERSION:3

Link#EXT-X-MEDIA:

Used to associate different media playlists together that relate to the same content, like different renditions or different camera angles of the same recording.

Link#EXT-X-STREAM-INF:

Found in a multi-variant playlist and details information about a variant stream (media playlist) e.g: #EXT-X-STREAM-INF:BANDWIDTH=1123000, CODECS="avc1.64001f,mp4a.40.2" describes a renditions bandwidth in bits per second and the codecs that will be needed to decode the segments contained within the playlist once it has been fetched.

Link#EXT-X-ENDLIST

Indicates that no more media segments will be defined after this point. Usually found at the end of a media playlist file but can technically be placed anywhere to delineate that there's no more media segments to be found after it.

LinkLearn more with Mux

If you're interested in learning more about the HLS format and the less common tags and directives that sometimes appear, you could go dive in to RFC spec document and go straight to the source.

LinkHLS FAQs

Do I need to create HLS playlists manually?

No. Video platforms and APIs automatically generate HLS playlists when you upload video. They handle all the complexity—segmenting video, creating multiple renditions, generating manifests with proper tags, and serving them to players. Manual HLS creation only makes sense for learning, custom workflows, or when building your own streaming infrastructure. For production use, platforms like Mux handle HLS generation automatically.

What's the difference between .m3u and .m3u8 files?

Both use the same format, but .m3u8 explicitly indicates UTF-8 character encoding, which became standard for HLS to support international characters in metadata. Modern HLS implementations use .m3u8 exclusively. The "8" simply means "UTF-8 encoded m3u playlist." In practice, treat them as identical—most systems serve HLS manifests as .m3u8 regardless.

How does a player know which rendition to choose?

Players parse the multi-variant playlist to see available renditions and their bandwidth requirements (specified in #EXT-X-STREAM-INF). Based on measured network conditions and device capabilities, the player selects an appropriate rendition. It continuously monitors performance and switches renditions up or down as needed. This adaptive bitrate streaming happens automatically—the player makes all decisions without user intervention.

What happens if #EXT-X-ENDLIST is missing?

Missing #EXT-X-ENDLIST indicates a live stream—the playlist is still being written and players should periodically fetch updated versions to discover new segments. For VOD (video on demand), #EXT-X-ENDLIST must be present to signal that all segments are available and no more will be added. Players behave differently based on this tag's presence.

Can I mix different codecs in the same HLS stream?

Technically yes, but it's not recommended. Each rendition (variant) can use different codecs, specified in the CODECS attribute of #EXT-X-STREAM-INF. However, players must support all codecs you use, and switching between different codecs during playback is inefficient. Best practice is to use the same codec (like H.264 for video, AAC for audio) across all renditions, varying only bitrate and resolution.

What's the optimal segment duration for HLS?

Apple recommends 6-second segments as a balance between latency and efficiency. Shorter segments (2-4 seconds) reduce latency but increase overhead and CDN requests. Longer segments (10+ seconds) are more efficient but increase buffering time and prevent quick quality switching. For low-latency HLS (LL-HLS), segments are divided into even smaller partial segments. Video platforms typically handle segment duration automatically.

Why do HLS URLs sometimes have long query strings?

Query strings often contain authentication tokens (signed URLs), cache-busting parameters, or session identifiers. These ensure only authorized users can access content, enable analytics tracking, or control CDN caching behavior. The HLS specification itself doesn't require query strings, but production systems add them for security and operational reasons.

How do I debug HLS playback issues?

Use browser developer tools to inspect network requests for .m3u8 files and .ts or .m4s segments. Check for 404 errors (missing files), CORS issues (cross-origin restrictions), or slow segment downloads (bandwidth problems). Tools like ffprobe can validate HLS manifests and segment integrity. Video platforms with analytics (like Mux Data) provide visibility into playback errors, rebuffering, and quality metrics to diagnose issues.

Arrow RightBack to Articles

No credit card required to start using Mux.