M3U8 File Format Explained — Tags, Master vs Media + Play
M3U8 File Structure Overview
An M3U8 file is line-based. Each line is either a tag (starts with #) or a URI (path/URL to a segment or another playlist). Structure differs for a master playlist (lists quality variants) vs a media playlist (lists actual segments). Full tag list: M3U8 extended tags reference.
See a live stream: paste any M3U8 URL into the free online player while you learn the tags below.
Master Playlist Structure
A master playlist points to multiple variant streams:
#EXTM3U #EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=720x480,CODECS="avc1.66.30,mp4a.40.2" medium.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=2560000,RESOLUTION=1280x720,CODECS="avc1.77.30,mp4a.40.2" high.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=5120000,RESOLUTION=1920x1080,CODECS="avc1.77.30,mp4a.40.2" fullhd.m3u8
The player picks a variant based on bandwidth, then loads that media playlist.
Media Playlist Structure
A media playlist lists the segments:
#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:10 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:10.000, seg-0.ts #EXTINF:10.000, seg-1.ts #EXTINF:10.000, seg-2.ts #EXT-X-ENDLIST
#EXT-X-ENDLIST means VOD (complete). Live playlists omit it and keep updating.
Essential Tags Reference
| Tag | Purpose | Required |
|---|---|---|
| #EXTM3U | File header (first line) | Yes |
| #EXT-X-VERSION | Protocol version | Yes |
| #EXT-X-TARGETDURATION | Max segment duration | Yes (media) |
| #EXTINF | Segment duration | Yes (media) |
| #EXT-X-MEDIA-SEQUENCE | First segment number | Often |
| #EXT-X-KEY | Encryption key | If encrypted |
| #EXT-X-STREAM-INF | Variant description | Master only |
| #EXT-X-ENDLIST | End of VOD | VOD only |
Common Errors in M3U8 Files
- Missing #EXTM3U — not recognized as a playlist.
- Broken relative paths — segments 404 if the base URL is wrong.
- TARGETDURATION too low — players misbehave if segments exceed it.
- Missing ENDLIST on VOD — players wait forever for new segments.
- Wrong encoding — must be UTF-8 for M3U8.
Required and Common Tags
A valid HLS media playlist typically starts with #EXTM3U and includes version, target duration, and #EXTINF + URI pairs. Masters add #EXT-X-STREAM-INF with BANDWIDTH and RESOLUTION. Optional tags cover encryption (#EXT-X-KEY), initialization maps for fMP4, discontinuity, program date time, and end lists for VOD.
Ignore unknown tags cautiously — players skip some, break on others. When debugging, sort lines into “structure,” “timing,” and “security.”
Master vs Media Cheat Sheet
| Playlist type | Points to | Player action |
|---|---|---|
| Master | Other playlists (variants) | Pick ladder level |
| Media (VOD) | Finite segments + ENDLIST | Fetch all / seek |
| Media (live) | Sliding window segments | Reload playlist |
Feeding a master URL into a tool that expects a media playlist can pick the wrong variant or fail oddly — be explicit when automating.
Practical Inspection Workflow
- curl or browser-open the playlist; save the text.
- Identify master vs media.
- Resolve one segment and one key URI if present.
- Play in online player.
- Only then download/convert if authorized.
Deep dives: what is M3U8, read in editor, HLS overview.
Bottom Line
The M3U8 format is a structured text contract between packagers and players. Learn the core tags, distinguish master from media and live from VOD, and validate with real fetches before blaming the UI tool of the day.
Frequently Asked Questions
What is the difference between master and media playlists?
Master lists quality variants; media lists the actual segments.
Do all M3U8 files have ENDLIST?
No — live streams omit it.
Can I edit an M3U8 file by hand?
Yes — it is plain text; validate carefully afterward.
How do I learn every tag?
See our extended tags reference.