Inside M3U: How the Playlist Format Works

Published: Jun 24, 2026 02:42

Inside M3U: How the Playlist Format Works

An M3U file is a plain-text playlist file used to tell a media player where audio or video files are located. The name comes from MP3 URL, although M3U playlists can reference many types of media, not just MP3s.

What an M3U File Contains

An M3U file doesn't usually contain the media itself. Instead, it contains paths or URLs pointing to media files.
Example:
song1.mp3
song2.mp3
C:\Music\song3.mp3
https://example.com/stream.mp3
When opened in a compatible media player, the player loads and plays the listed files in order.

Extended M3U (M3U8)

Many playlists use an extended format that begins with:
#EXTM3U
Additional metadata can be included:
#EXTM3U

#EXTINF:245,Artist Name - Song Title
song1.mp3

#EXTINF:180,Another Artist - Another Song
song2.mp3
Here:
  • #EXTM3U indicates an extended playlist.
  • #EXTINF provides media information.
    • The number is the duration in seconds.
    • The text is the display title.

M3U8

M3U8 is simply an M3U file encoded in UTF-8, allowing support for international characters. It is also widely used in HTTP Live Streaming (HLS), a streaming technology developed by Apple.
Example HLS playlist:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXTINF:10,
segment1.ts
#EXTINF:10,
segment2.ts
#EXT-X-ENDLIST

Common Uses

  • Music playlists
  • Video playlists
  • Internet radio streams
  • IPTV channel lists
  • HLS video streaming

Opening an M3U File

Many media players support M3U playlists, including:
  • VLC media player
  • Winamp
  • Kodi
  • Windows Media Player

IPTV Example

An IPTV playlist often looks like:
#EXTM3U

#EXTINF:-1 tvg-id="news1" tvg-name="News Channel",News Channel
http://stream.example.com/live/news.m3u8

#EXTINF:-1 tvg-id="sports1" tvg-name="Sports Channel",Sports Channel
http://stream.example.com/live/sports.m3u8
The playlist contains channel information and stream URLs that IPTV applications can load.

The Extended M3U Format: Core Tags

An "Extended M3U" file offers more functionality through specific directives. All extended files must start with #EXTM3U on the first line.

Here is a list of the key directives for the Extended M3U format:

Directive Description Example
#EXTM3U File header indicating an Extended M3U file; must be the first line. #EXTM3U
#EXTENC: Specifies the text encoding of the file, usually placed as the second line. #EXTENC:UTF-8
#EXTINF: Specifies track information, most commonly the duration (in seconds) and a display title. For live streams, the duration is often set to -1. #EXTINF:123,Artist - Song Title
#PLAYLIST: Defines the title of the entire playlist. #PLAYLIST:My Favorite Podcasts
#EXTGRP: Marks the beginning of a named grouping for tracks or channels. #EXTGRP:Rock Classics
#EXTALB: Provides album information for the following track. #EXTALB:Dark Side of the Moon
#EXTART: Specifies the album's artist. #EXTART:Pink Floyd
#EXTGENRE: Indicates the genre of the album or track. #EXTGENRE:Progressive Rock
#EXTM3A A single-file playlist used for album tracks or chapters. #EXTM3A
#EXTBYT: Specifies the file size in bytes. #EXTBYT:8482812
#EXTBIN: Indicates that binary data follows. #EXTBIN:
#EXTIMG: Provides a URL for a logo, cover art, or other images. #EXTIMG:https://example.com/logo.png

 

Specialized Tags for IPTV Playlists

In IPTV contexts, additional attributes are often used inside the #EXTINF line to provide rich metadata for Electronic Program Guides (EPGs) and channel organization.

Tag / Attribute Description Example
tvg-id A unique identifier for the channel, used to match it with EPG data. tvg-id="cnn.us"
tvg-name The channel name as it appears in the EPG file. tvg-name="CNN International"
tvg-logo A URL pointing to the channel's logo image (usually PNG format). tvg-logo="https://example.com/logos/cnn.png"
group-title Defines the group or category for the channel. group-title="News"
tvg-url A URL to the EPG (Electronic Program Guide) data file, often in XMLTV or JTV format. tvg-url="https://example.com/epg.xml.gz"
channel-number Specifies a custom channel number to be displayed to the user. channel-number="105"
refresh Defines the playlist refresh period in seconds. refresh="3600"

Example of an IPTV #EXTINF line:

#EXTINF:-1 tvg-id="bbcnews.uk" tvg-name="BBC News" tvg-logo="https://example.com/bbc.png" group-title="News",BBC News

 

Advanced HLS Tags (#EXT-X-)

For HTTP Live Streaming, the M3U8 format uses a specific set of tags prefixed with #EXT-X-. These tags are defined in the IETF RFC 8216.

Tag Description Example
#EXT-X-VERSION Indicates the compatibility version of the playlist and its server. #EXT-X-VERSION:3
#EXT-X-TARGETDURATION Specifies the maximum duration (in seconds) for each media segment. #EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE Indicates the sequence number of the first media segment in the playlist. #EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY Specifies how to decrypt media segments that are encrypted. #EXT-X-KEY:METHOD=AES-128,URI="https.../key.bin"
#EXT-X-PROGRAM-DATE-TIME Associates the first sample of a media segment with an absolute date and/or time. #EXT-X-PROGRAM-DATE-TIME:2024-01-01T00:00:00Z
#EXT-X-DISCONTINUITY Indicates a discontinuity in the stream, such as a change in encoding parameters or ad insertion. #EXT-X-DISCONTINUITY
#EXT-X-ENDLIST Indicates that no more media segments will be added to the playlist (used for Video on Demand, VOD). #EXT-X-ENDLIST
#EXT-X-STREAM-INF In a master playlist, it specifies a variant stream (e.g., different bitrates or resolutions). #EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=1280x720
#EXT-X-MEDIA Relates media playlists that contain alternative renditions of the same content (e.g., different audio languages). #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",URI="..."
#EXT-X-I-FRAME-STREAM-INF Defines an I-frame-only variant stream for seeking or thumbnail generation. #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=50000,URI="iframes.m3u8"
#EXT-X-BITRATE Provides the bitrate of the media segment or variant stream. #EXT-X-BITRATE:128000
#EXT-X-DATERANGE Associates a date range (e.g., for ad breaks or program segments) with the playlist. #EXT-X-DATERANGE:ID="ad1",START-DATE="2025-01-01T00:00:00Z"

 

Player-Specific Tags

Some tags are specific to certain media players. The most common ones are for VLC, which uses the #EXTVLCOPT directive to pass options directly to the player.

Tag Description Example
#EXTVLCOPT: Passes a configuration option to the VLC media player (e.g., for network referrers or HTTP headers). #EXTVLCOPT:http-referrer=https://example.com/

Advantages

  • Simple text format
  • Easy to edit with any text editor
  • Supported by many media players
  • Can reference local files or online streams

Limitations

  • Does not store the actual media
  • Broken paths or URLs make entries unusable
  • Limited metadata compared with some modern media library formats

In short, an M3U file is a lightweight playlist format that acts as a list of media locations, making it easy to organize and play collections of audio, video, or streaming content.

UD X-File Editorial Team
Verified updates, firmware releases and technical news.