Understanding the M3U File: A Guide to Playlist Format



Hello everyone,

I'd like to provide a comprehensive, technical deep dive into the M3U file format. This post will detail all the key tags and directives, from the basic extended M3U format to the advanced tags used in HLS and IPTV playlists. Whether you're a developer, a streaming enthusiast, or just a curious user, this should serve as a thorough reference.


What is an M3U file?

M3U stands for MP3 URL. It is a plain text file that acts as a multimedia playlist, containing references—not the media itself—to the locations of audio or video files, which can be absolute or relative paths on a computer or URLs on the internet.

M3U files can be encoded using the local system's default non-Unicode charset (using the .m3u extension) or UTF-8 (using the .m3u8 extension), which is the standard for modern web streaming. The M3U8 UTF-8 encoded format is the basis for HTTP Live Streaming (HLS) , the adaptive streaming protocol developed by Apple.


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:

DirectiveDescriptionExample
#EXTM3UFile 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
#EXTM3AA 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 / AttributeDescriptionExample
tvg-idA unique identifier for the channel, used to match it with EPG data.tvg-id="cnn.us"
tvg-nameThe channel name as it appears in the EPG file.tvg-name="CNN International"
tvg-logoA URL pointing to the channel's logo image (usually PNG format).tvg-logo="https://example.com/logos/cnn.png"
group-titleDefines the group or category for the channel.group-title="News"
tvg-urlA URL to the EPG (Electronic Program Guide) data file, often in XMLTV or JTV format.tvg-url="https://example.com/epg.xml.gz"
channel-numberSpecifies a custom channel number to be displayed to the user.channel-number="105"
refreshDefines 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.

TagDescriptionExample
#EXT-X-VERSIONIndicates the compatibility version of the playlist and its server.#EXT-X-VERSION:3
#EXT-X-TARGETDURATIONSpecifies the maximum duration (in seconds) for each media segment.#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCEIndicates the sequence number of the first media segment in the playlist.#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEYSpecifies how to decrypt media segments that are encrypted.#EXT-X-KEY:METHOD=AES-128,URI="https.../key.bin"
#EXT-X-PROGRAM-DATE-TIMEAssociates 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-DISCONTINUITYIndicates a discontinuity in the stream, such as a change in encoding parameters or ad insertion.#EXT-X-DISCONTINUITY
#EXT-X-ENDLISTIndicates that no more media segments will be added to the playlist (used for Video on Demand, VOD).#EXT-X-ENDLIST
#EXT-X-STREAM-INFIn a master playlist, it specifies a variant stream (e.g., different bitrates or resolutions).#EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=1280x720
#EXT-X-MEDIARelates 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-INFDefines an I-frame-only variant stream for seeking or thumbnail generation.#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=50000,URI="iframes.m3u8"
#EXT-X-BITRATEProvides the bitrate of the media segment or variant stream.#EXT-X-BITRATE:128000
#EXT-X-DATERANGEAssociates 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.

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


I hope this professional guide to M3U tags and directives proves useful. Feel free to ask if you have any questions or need further clarification on any of these elements!


More Articles

How To Create A Conversation (Private Message)
Forum Rules and Terms of Service
How to change your user profile banner

Navigation

  1. Donate
  2. Articles
  3. FileBase
  4. Forum
  5. Gallery
  6. Firmware
  7. Live On Sat
  8. OSCam
  9. Useful Links
  1. Contact
  2. Terms Of Use

Current Location

This site uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.