M3U (MP3 URL but numerous media players and software applications now support the format.
Careless handling of M3U playlists has been the cause of vulnerabilities in many music players such as VLC media player, iTunes, Winamp, and many others.
File format
There is no formal specification for the M3U format; it is a de facto standard.
An M3U file is a plain text file that specifies the locations of one or more media files. The file is saved with the "m3u" filename extension if the text is encoded in the local system's default non-Unicode encoding (e.g., a Windows codepage), or with the "m3u8" extension if the text is UTF-8 encoded. The "mp3url" extension originally supported by Winplay3 fell out of use. M3A
|-
| <code>#EXTBYT:</code> || file size in bytes || <code>#EXTBYT:34124</code>|| ||
|}
M3U8
The use of UTF-8 encoding is mandatory in M3U playlists with the M3U8 file extension. The system codepage is usually assumed for ".m3u" but this is often UTF-8 as well nowadays so the distinction has mostly been lost in practice.
HLS
Apple used the extended M3U format, UTF-8 encoded, as a base for their HTTP Live Streaming (HLS) which was documented in an Independent Submission Stream RFC in 2017 as RFC 8216. Therein, a master playlist references segment playlists which usually contain URLs for short parts of the media stream. Some tags only apply to the former type and some only to the latter type of playlist, but they all begin with <code>#EXT-X-</code>.
{| class="wikitable"
|+ HLS M3U extensions
! Directive !! Example !! Description
|-
| <code>#EXT-X-START:</code> || <code>TIME-OFFSET=0</code> ||
|-
| <code>#EXT-X-INDEPENDENT-SEGMENTS</code> ||colspan=2| Toggle without parameters
|-
| <code>#EXT-X-PLAYLIST-TYPE:</code> || <code>VOD</code> or <code>EVENT</code> ||
|-
| <code>#EXT-X-TARGETDURATION:</code> || <code>10</code> || The maximum Media Segment duration in seconds
|-
| <code>#EXT-X-VERSION:</code> || <code>4</code> ||
|-
| <code>#EXT-X-MEDIA-SEQUENCE:</code> || <code>0</code> || The Media Sequence Number of the first Media Segment appearing in the playlist file
|-
| <code>#EXT-X-MEDIA:</code> || <code>NAME="English", TYPE=AUDIO, GROUP-ID="audio-stereo-64", LANGUAGE="en", DEFAULT=YES, AUTOSELECT=YES, URI="english.m3u8"</code> ||
|-
| <code>#EXT-X-STREAM-INF:</code> || <code>BANDWIDTH=1123000, CODECS="avc1.64001f,mp4a.40.2"</code> || Parameters have either one combined value or one per stream, separated by commas
|-
| <code>#EXT-X-BYTERANGE:</code> || <code>1024@256000</code> ||
|-
| <code>#EXT-X-DISCONTINUITY</code> || toggle without parameters || The segment represents the start of a new period
|-
| <code>#EXT-X-DISCONTINUITY-SEQUENCE:</code> || <code>2</code> || Indicates start of numbering of periods
|-
| <code>#EXT-X-GAP</code> || toggle without parameters || The segment represents a "spacer" before a new period
|-
| <code>#EXT-X-KEY:</code> || <code>METHOD=NONE</code> || Indicates encryption method used and decryption key
|-
| <code>#EXT-X-MAP:</code> || <code>URI=MediaInitializationSection</code> ||
|-
| <code>#EXT-X-PROGRAM-DATE-TIME:</code> || <code>2010-02-19T14:54:23.031+08:00</code> || ISO 8601 format
|-
| <code>#EXT-X-DATERANGE:</code> || <code>ID=foo</code> ||
|-
| <code>#EXT-X-I-FRAMES-ONLY</code> ||colspan=2| i-frame Toggle without parameters
|-
| <code>#EXT-X-SESSION-DATA:</code> || <code>DATA-ID=com.example.movie.title</code> ||
|-
| <code>#EXT-X-SESSION-KEY:</code> || <code></code> ||
|-
| <code>#EXT-X-ENDLIST</code> ||colspan=2| End-of-list signal without parameters
|}
IPTV
With television broadcasting via the internet protocol (IPTV), M3U playlists are frequently used to store the (start) URLs of the streams, so each entry represents a channel. As usual for continuous streams, the length info directly after <code>#EXTINF:</code> is set to <code>-1</code>. Unlike HLS, other structured information is not provided in separate info lines but with a key–value syntax before the mandatory comma following the length.<!-- Most of these case-insensitive attribute names start with a <code>tvg-</code> prefix, standing for "TV Guide".
<!--https://github.com/HamzaBhf00/m3u-tags-iptv-->
<syntaxhighlight lang="text">
- EXTINF:-1 tvg-id="123" tvg-name="Channel Name" tvg-logo="http://example.com/logo.png" group-title="Examples", Channel Name
rtsp://example.com/stream
</syntaxhighlight>
{| class="wikitable"
|+ IPTV #EXTINF length value extensions
! Attribute !! Example !! Description
|-
|rowspan=2| Group || <code>group-title="News"</code> || named (thematic) group of channels, i.e. a genre
|-
| <code>tvg-group="Music/Rock"</code> || named group of channels, some players support a hierarchical separator within the value
|-
| Logo || <code>tvg-logo="/logos/channel.png"</code> || URL to channel logo image file
|-
| Name || <code>tvg-name="Channel TV"</code> || usually the same name repeated after the comma, but can differ to match <code>display-name</code> in XMLTV
|-
| Number || <code>tvg-chno="12"</code> || channel number
|-
| CUID || <code>tvg-id="1234"</code> || unique identifier to link EPG info with (e.g. using <code>channel-id</code> in XMLTV)
|-
| Country || <code>tvg-country="NZ"</code> || origin country of the channel, possibly using ISO 3166 codes
|-
| Language || <code>tvg-language="English"</code> || main audio language of the channel, possibly using ISO 639 codes
|-
| Radio || <code>radio=true</code> || boolean value to mark audio-only channels
|-
|}
<!--tvg-shift, tvg-timeshift: time offset from EPG-->
Internet media types
The only Internet media type registered for M3U and M3U8 is <code>application/vnd.apple.mpegurl</code>, registered in 2009 and only referring to the playlist format as used in HLS applications.
The current proposal for the HLS playlist format acknowledges two media types which it treats as equivalent: <code>application/vnd.apple.mpegurl</code> and <code>audio/mpegurl</code>.
These types, plus <code>application/vnd.apple.mpegurl</code> and <code>application/vnd.apple.mpegurl.audio</code>, are supported for HLS applications by (for example) Microsoft's Windows 10 and Internet Explorer 9, and LG's WebOS.
Example
The following is an example of an M3U playlist file for "Jar of Flies" album by "Alice in Chains" that was created by Mp3tag with the following custom option settings: <!-- NOTE: This example was posted by User:Sbmeirow -->
- playlist extended info format = <code>"%artist% - %title%"</code>
- playlist filename format = <code>"%artist%_%album%_00_Playlist.m3u"</code>
- tag to filename conversion format = <code>"%artist%_%album%_$num(%track%,2)_%title%"</code>
<pre>
- EXTM3U
- EXTINF:419,Alice in Chains - Rotten Apple
Alice in Chains_Jar of Flies_01_Rotten Apple.mp3
- EXTINF:260,Alice in Chains - Nutshell
Alice in Chains_Jar of Flies_02_Nutshell.mp3
- EXTINF:255,Alice in Chains - I Stay Away
Alice in Chains_Jar of Flies_03_I Stay Away.mp3
- EXTINF:256,Alice in Chains - No Excuses
Alice in Chains_Jar of Flies_04_No Excuses.mp3
- EXTINF:157,Alice in Chains - Whale And Wasp
Alice in Chains_Jar of Flies_05_Whale And Wasp.mp3
- EXTINF:263,Alice in Chains - Don't Follow
Alice in Chains_Jar of Flies_06_Don't Follow.mp3
- EXTINF:245,Alice in Chains - Swing On This
Alice in Chains_Jar of Flies_07_Swing On This.mp3
</pre>
Software
Tag editors
The following tag editor software allows users to edit the ID3 tags in MP3 files, and has support for creating M3U files.
;Linux
- Kid3, Puddletag.
;Windows
- Mp3tag, Puddletag.
;macOS
- Mp3tag.
Media players
The following media player software supports playing M3U files.
;Multi-platform
{| class="wikitable"
! scope=rowgroup rowspan=2 | Programs !! scope=colgroup colspan=5 | Platforms
|-
|Windows
|macOS
|Linux
|Android
|Other
|-
|Amarok
|
|
|
|
|
|-
|Audacious
|
|
|
|
|
|-
|Banshee
|
|
|
|
|
|-
|Clementine
|
|
|
|
|
|-
|foobar2000
|
|
|
|
|
|-
|Kodi
|
|
|
|
|
|-
|MOC (Music on Console)
|
|
|
|
|
|-
|MPlayer
|
|
|
|
|
|-
|mpv
|
|
|
|
|
|-
|VLC media player
|
|
|
|
|
|-
|iTunes
|
|
|
|
|
|-
|make_playlist (mkpl)
|
|
|
|
|
|}
;Android
- Astro Player, Kodi, N7Player, Musicolet
;macOS
- Music, QuickTime Player, IINA
;Nintendo
- New Nintendo 3DS (including XL and 2DS XL variants) with Internet Browser app
- Nintendo Switch with the YouTube (site-specific) app
- Wii U with the Internet Browser or YouTube app
;Windows
- foobar2000, JRiver Media Center, JuK, MediaMonkey, PotPlayer, Winamp, Windows Media Player, XMPlay
See also
- List of tag editors
;Other playlist file formats
- PLS - SHOUTcast
References
External links
- Creating Playlists to Work with the Streaming Music Manager
