Syntax
What EXTM3U means
#EXTM3U is the header line of every HLS playlist. It says the file is an Extended M3U playlist. Plain M3U is an old playlist format for music players: a text file with one file path per line. The extended version adds lines that start with #EXT and carry extra information. HLS is built on that format and keeps two of its tags, EXTM3U and EXTINF.
The tag has no value and no attributes. It is the same in master playlists, which list the available qualities, and in media playlists, which list the video segments.
Where it goes
It must be the first line of the file, and it appears once. Nothing may come before it: no blank line, no comment, no spaces. Every other tag follows it.
Rules from RFC 8216
Section 4.3.1.1 makes EXTM3U the required first line of every media playlist and every master playlist. The general file rules in section 4.1 matter here too:
- The file must be UTF-8 text with no byte order mark (BOM). Players should refuse a playlist that starts with one.
- Tags are case sensitive.
#extm3uis not a valid header. - Lines end with a line feed, or a carriage return followed by a line feed, so both Unix and Windows line endings are allowed.
- The playlist must be identifiable either by an address whose path ends in
.m3u8or.m3u, or by the HTTP Content-Typeapplication/vnd.apple.mpegurloraudio/mpegurl. Players should refuse playlists that are neither.
Common mistakes
- A web page instead of a playlist. When a link has expired or needs a sign-in, many servers answer with a web page or an error message. Its first line is
<!DOCTYPE html>, not#EXTM3U. See how to fix m3u8 403 errors. - The page address instead of the playlist address. The address of the page that shows the video is not the playlist. See how to find the m3u8 link.
- An invisible byte order mark. Some text editors on Windows add three hidden bytes to the start of a UTF-8 file when they save it. The first line then looks right on screen but no longer matches.
- A blank line or space at the top. Scripts that build playlists from templates sometimes add one.
How players treat it
Players check the first line before anything else. If it is not #EXTM3U, they report a parsing or format error and play nothing. How strictly players check the Content-Type header varies, so a playlist served with the wrong type can work in one player and fail in another. Serving playlists as application/vnd.apple.mpegurl avoids that question.
Example
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXTINF:6.000,
segment0.ts
#EXTINF:6.000,
segment1.ts
#EXT-X-ENDLISTThe #EXTM3U line comes first, before any other tag, in this short on-demand media playlist.
How m3u8.cloud handles it
m3u8.cloud checks the first line before anything else. A file that does not start with #EXTM3U is rejected as "not an HLS playlist".
That usually means the link leads to a web page, an error message or an expired address rather than the playlist itself. See how to find the m3u8 link.
Related tags
Check the tags in any playlist
Open the m3u8 inspector