What is M3U8 File?
M3U8 file is a UTF-8 encoded playlist file format, originally designed for multimedia playlist management. With the popularization of HTTP Live Streaming (HLS) technology, M3U8 has become one of the core formats for internet video streaming.
Unlike traditional video files (such as MP4, AVI), M3U8 files do not contain any video or audio data themselves. It is just an index file that contains a series of media segment URLs. The player reads the M3U8 file to get the location of these segments and plays them in order.
M3U8 File Structure
M3U8 files have two main types: Video on Demand (VOD) and Live (LIVE).
VOD M3U8 Example
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.0,
segment0.ts
#EXTINF:10.0,
segment1.ts
#EXTINF:10.0,
segment2.ts
#EXT-X-ENDLIST
This playlist contains multiple TS video segments. The player downloads and plays these segments in order. The #EXTINF tag indicates the duration of each segment, and #EXT-X-ENDLIST marks the end of the playlist.
Key Tags
- #EXTM3U - File header, indicating this is an M3U8 playlist
- #EXT-X-VERSION - HLS protocol version number
- #EXT-X-TARGETDURATION - Maximum duration of each segment (seconds)
- #EXT-X-MEDIA-SEQUENCE - Sequence number of the first segment
- #EXTINF - Segment duration and title
- #EXT-X-ENDLIST - End list marker (for VOD)
Master Playlist
For videos with multiple bitrates, M3U8 supports Master Playlist:
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=720x480
low.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2560000,RESOLUTION=1280x720
medium.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=7680000,RESOLUTION=1920x1080
high.m3u8
The player automatically selects the appropriate bitrate based on the user's network bandwidth.
Advantages of M3U8
- Adaptive Bitrate - Automatically switches video quality based on network conditions
- Distributed Delivery - Video segments can be distributed via CDN for faster loading
- Strong Interference Resistance - Quick recovery after network interruption
- Open Standard - HLS is a public standard with broad support
- Mobile Friendly - Native support on iOS and Android