Inspect any HLS playlist without a player
An M3U8 parser breaks down an HLS playlist so you can see exactly what a video player would: the quality variants, the segment list, encryption, and timing tags. It is useful for debugging streaming setups, verifying an encoder’s output, or auditing a stream’s structure — all locally.
How it works
The parser follows the HLS specification (RFC 8216). It first confirms the #EXTM3U header, then decides the playlist type: if any #EXT-X-STREAM-INF tag is present it is a master playlist, otherwise a media playlist.
For master playlists it reads each #EXT-X-STREAM-INF attribute list — BANDWIDTH, RESOLUTION, CODECS, FRAME-RATE — pairing it with the URI on the following line, and also lists #EXT-X-MEDIA alternate audio and subtitle renditions. For media playlists it walks the tags in order, attaching each #EXTINF duration, #EXT-X-BYTERANGE, and #EXT-X-DISCONTINUITY to the segment URI that follows, and reads #EXT-X-VERSION, #EXT-X-TARGETDURATION, #EXT-X-KEY, and #EXT-X-ENDLIST. Attribute lists are split with a quote-aware regex so commas inside quoted CODECS values are not mistaken for separators.
Master vs. media playlists: understanding the two-level structure
HLS streams use a two-level structure. The master playlist is the entry point — it lists the available quality renditions (variants) and points to the media playlist for each. A player fetches the master first, selects a variant based on available bandwidth, then fetches and follows the corresponding media playlist.
A typical master playlist variant entry:
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080,CODECS="avc1.640028,mp4a.40.2"
1080p/index.m3u8
The BANDWIDTH is in bits per second (5,000,000 here is 5 Mbps). CODECS uses RFC 6381 format: avc1.640028 is H.264 High Profile Level 4.0, and mp4a.40.2 is AAC-LC audio. The parser surfaces all of this so you can verify your encoder output matches what you expect without playing the stream.
Reading the segment list for VOD and live
For VOD streams, the media playlist ends with #EXT-X-ENDLIST. Every segment is present and the total duration is the sum of all #EXTINF values. You can verify:
- Total content duration (sum of all segment durations)
- Whether all segments have the expected duration
- Whether
#EXT-X-DISCONTINUITYmarkers are present (which signal timeline breaks from ad splices or chapter changes)
For live streams without #EXT-X-ENDLIST, the playlist represents a sliding window of recent segments. The #EXT-X-TARGETDURATION tells you the maximum segment length, and players re-fetch the playlist every target-duration seconds to discover new segments.
Encryption and key tags
When an HLS stream uses encryption, each group of segments is preceded by an #EXT-X-KEY tag specifying the method and where to fetch the key:
#EXT-X-KEY:METHOD=AES-128,URI="https://keyserver.example.com/key",IV=0x00000000000000000000000000000001
METHOD=AES-128means segments are encrypted with 128-bit AES in CBC modeMETHOD=SAMPLE-AESencrypts audio/video samples (common in DRM workflows)URIis where the player fetches the decryption key (requires authorization)IVis the initialization vector; if absent the default is the segment sequence number
The parser reports all of these fields so you can verify key delivery configuration without intercepting network traffic.
Tips and notes
- Variant streams are sorted by bandwidth (highest first) so the top entry is the best-quality rendition.
- A missing
#EXT-X-ENDLISTmeans the playlist is live; players would re-fetch it on the target-duration interval. - The
#EXT-X-KEYmethod tells you the encryption scheme —NONE,AES-128, orSAMPLE-AES. The key URI is where the player fetches the decryption key. - The parser works on local text only, so it cannot follow relative segment URIs to a server; it reports them exactly as written.
- Nothing is uploaded — your playlist contents stay in your browser.