Introduction
An .m3u8 file is the playlist of HTTP Live Streaming (HLS), the streaming
protocol Apple introduced in 2009 and published as RFC 8216. The video is cut into short
segments, often at several qualities, and the playlist tells the player where to fetch
each one. HLS plays natively in Safari and on Apple devices, and in other browsers
through JavaScript players.
The format extends the M3U music playlist, and the 8 in the extension
means the text is UTF-8. Some music software also saves ordinary UTF-8 playlists as
.m3u8; those hold a list of tracks rather than a stream.
Structure
The full reference, following RFC 8216 and its successor draft:
- Playlist file – lines, tags, attribute lists, variables and protocol versions
- Media playlist – playlist and segment tags, and date ranges with SCTE-35
- Multivariant playlist – variant streams, renditions and session tags
- Low-latency HLS – parts, preload hints, rendition reports, delta updates
- Segments and encryption – segment formats and the encryption methods
An HLS playlist is UTF-8 text with one item per line. The first line is
#EXTM3U. Lines that start with #EXT are tags, other lines that
start with # are comments, and every other line is the address of a
segment or of another playlist.
There are two kinds of playlist. A multivariant playlist, also called a master
playlist, lists the versions of a stream: each #EXT-X-STREAM-INF tag gives
a bandwidth, resolution and codecs, and the next line names that version’s media
playlist. A media playlist lists the segments themselves: #EXTINF gives
each segment’s duration, followed by its address. #EXT-X-ENDLIST marks a
playlist that will not grow, as for a film rather than a live broadcast.
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.000,
segment0.ts
#EXTINF:6.000,
segment1.ts
#EXTINF:4.200,
segment2.ts
#EXT-X-ENDLIST
Not described
The pages follow the HTTP Live Streaming draft (rfc8216bis-22), read in full, and RFC 8216.
Known, not yet covered
- Reference: the content steering manifest, the JSON document fetched from
SERVER-URI, and Apple’s HLS Sample Encryption specification (SAMPLE-AES for transport streams and packed audio): both are outside the playlist draft and are only named. - Viewer: there is no HLS viewer plugin yet; the explorer shows the file as text.
Also used for
- M3U playlist (UTF-8) – A plain text list of tracks, one path or URL per line, with optional #EXTINF details.
Links
Software
- Safari – Apple’s web browser, which plays HLS natively (macOS, iOS)
- VLC media player – free media player that opens HLS playlists and addresses (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player that plays HLS streams (Windows, macOS, Linux)
- FFmpeg – command-line tools that read and write HLS (Windows, macOS, Linux)
- Video.js – open-source web video player with HLS support
Developers
Reference
- RFC 8216 – the HTTP Live Streaming specification
- HTTP Live Streaming – Apple’s developer pages and tools for HLS