M3U8 Lab

m3u8 Example

Two copy-ready m3u8 examples, a master playlist and a media playlist, with every line explained. Open them in the playlist reader to see the result.

Below are two small playlists you can copy as they are: a master playlist that offers two qualities, and a media playlist that lists three segments. Each is followed by the meaning of every line.

A master playlist

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=640x360,CODECS="avc1.42c01e,mp4a.40.2"
360p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2800000,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2"
720p/index.m3u8
  • #EXTM3U — must be the first line. A file that starts with anything else is not a playlist.
  • #EXT-X-VERSION:3 — the revision of the format the file is written for. Version 3 covers everything used here, including decimal segment durations.
  • #EXT-X-STREAM-INF:BANDWIDTH=800000,... — one quality level. BANDWIDTH is the bitrate in bits per second (about 800 kbps here), RESOLUTION is the picture size, and CODECS names the video and audio codecs so a player can skip a variant it cannot decode.
  • 360p/index.m3u8 — the address of that variant's own playlist. It belongs to the #EXT-X-STREAM-INF line directly above it and is resolved against this file's address.
  • The second pair of lines is the same thing at 720p and about 2.8 Mbps. The player picks one by comparing BANDWIDTH to the connection it measures, and can switch while playing.

There is no duration anywhere in this file, and that is correct: the length belongs to the media playlists it points at.

A media playlist

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.000,
seg-00000.ts
#EXTINF:6.000,
seg-00001.ts
#EXTINF:4.200,
seg-00002.ts
#EXT-X-ENDLIST
  • #EXT-X-TARGETDURATION:6 — no segment is longer than 6 seconds once rounded to a whole number. Every #EXTINF below must fit under it.
  • #EXT-X-MEDIA-SEQUENCE:0 — the number of the first segment in the list. It stays at 0 here because nothing has been dropped; on a live stream it climbs as old segments leave the top.
  • #EXTINF:6.000, — the length of the segment on the next line, in seconds. The part after the comma is an optional title, empty here.
  • seg-00000.ts — the segment itself, an address relative to this file.
  • The last segment is shorter (4.200), which is normal: a recording rarely ends on an exact multiple of the segment length.
  • #EXT-X-ENDLIST — the list is complete. Add up the #EXTINF values and you get the running time: 6.000 + 6.000 + 4.200 = 16.2 seconds.

A line you will meet in real playlists

If the segments are encrypted, a line like this appears above the first one it covers:

#EXT-X-KEY:METHOD=AES-128,URI="key.bin",IV=0x00000000000000000000000000000001

METHOD names the encryption and URI says where the key file lives. It applies to every segment after it until another #EXT-X-KEY line replaces it. This site only reads the line: the tools here do not request keys or decrypt anything.

Try them

Check the two examples. Copy each block into a text file, save it with a .m3u8 extension and open it in the m3u8 playlist reader. The first reads as a master playlist with two variants; the second as a media playlist with three segments and 16 seconds of media.

Play a real stream. The examples point at no real files, so they will not play. For something that does, paste this public test address, published by Mux for testing players, into the m3u8 player:

https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8

It is a master playlist with five variants, from 320×184 up to 1920×1080. Paste the same address into the playlist reader to see the five lines laid out, or open it in the HLS player to switch between levels by hand.

What to do with your own

If your playlist is the one that fails, reading why an m3u8 will not play is the faster route. If it works and you want one file out of it, the m3u8 to MP4 tool re-wraps the segments, and the MP4 player checks the result.

Rights holders can reach us through the notice procedure.

Questions

Can I use these examples as a template?

Yes. Change the addresses, the segment names and the durations to match your own files. The durations have to be true: a player trusts #EXTINF for timing, and a wrong number shows up as drift or a bad seek bar.

Why are the addresses in the examples not full URLs?

Because relative addresses are legal and common. seg-00000.ts means the file sits next to the playlist, and a player resolves it against the playlist's own URL. The examples are illustrations, so they point at no real stream.

Which example should I start with?

The media playlist, because it is the one that holds segments. A master playlist only chooses between media playlists, and each variant line in it points at one.

How do I check my own playlist against these?

Save it as a .m3u8 file and open it in the m3u8 playlist reader. It tells you whether the file is a master or a media playlist, how many segments it lists, the total duration and whether an encryption tag is present.

Does a media playlist need #EXT-X-ENDLIST?

Only a finished recording has it. A live stream leaves it out and keeps adding segments at the bottom, so the player knows to come back and reload the list.