Skip to main content
All posts

What Is M3U8? A Beginner's Guide to HLS Streaming

Learn what an M3U8 file is, how HLS streaming works, and why an M3U8 link is not a video you can simply download.

Guide

If you have ever opened your browser's developer tools while a video was playing, you have probably seen a request ending in .m3u8. It looks like a video URL, but if you open it you get a page of plain text. This guide explains what that file is and how it fits into modern video streaming.

M3U8 in one sentence

An M3U8 file is a UTF-8 text index file used by HLS, Apple's adaptive streaming format. It does not contain any video. Instead, it tells a player where to find the small pieces of video that make up the stream, and in which order to play them.

The name comes from the older M3U format that MP3 players used to list songs. The 8 simply means the file is encoded in UTF-8.

What is inside an M3U8 file

Here is a simplified media manifest:

text
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.0,
segment0.ts
#EXTINF:6.0,
segment1.ts
#EXTINF:4.2,
segment2.ts
#EXT-X-ENDLIST
  • #EXTM3U marks the file as an extended M3U file.
  • #EXTINF gives the duration of the next segment in seconds.
  • Lines such as segment0.ts are the actual video segments, usually MPEG-TS (.ts) or fragmented MP4 (.m4s) files.
  • #EXT-X-ENDLIST says the video is complete. A broadcast that is still in progress leaves this tag out and keeps adding segments.

Master and media manifests

Most HLS videos use two levels of manifests:

  1. A master manifest lists several versions of the same video at different resolutions and bitrates, for example 480p, 720p, and 1080p.
  2. Each entry points to a media manifest, which lists the segments for that one version.

The player picks a version based on your screen size and network speed, and can switch between them while you watch. This is called adaptive bitrate streaming, and it is the main reason HLS is so widely used.

Why HLS splits video into segments

Splitting a video into short segments has real advantages for streaming:

  • Playback can start after the first few seconds are downloaded.
  • The player can change quality between segments without restarting.
  • Segments are ordinary files served over HTTP, so they work with any CDN.
  • Events can be broadcast by publishing new segments as they are recorded.

Why you cannot just "save" an M3U8

Because the manifest only points to segments, downloading the .m3u8 file gives you a few hundred bytes of text, not a video. To get something you can keep, you need to:

  1. Read the manifest and choose a quality level.
  2. Download every segment in the correct order.
  3. Join the segments and package them into a standard container such as MP4.

That is exactly what an M3U8 to MP4 converter does. In our next article we compare four ways to convert M3U8 to MP4.

A note on rights

HLS is used for public videos, paid courses, and protected content alike. Only download and convert videos you own or have permission to save. Streams protected by DRM are encrypted on purpose and cannot be converted by normal tools.