my-server
← Wiki

M3U

M3U (MP3 URL) is a computer file format for a multimedia playlist. One common use of the M3U file format is creating a single-entry playlist file pointing to a stream on the Internet. The created file provides easy access to that stream and is often used in downloads from a website, for emailing, and for listening to Internet radio.

Although originally designed for audio files, such as MP3, it is commonly used to point media players to audio and video sources, including online sources. M3U was originally developed by Fraunhofer for use with their WinPlay3 software, 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.

Each entry carries one specification. The specification can be any one of the following:

  • an absolute local pathname; e.g., C:\My Music\Heavysets.mp3
  • a local pathname relative to the M3U file location; e.g. Heavysets.mp3
  • a URL

Each entry ends with a line break which separates it from the following one. Furthermore, some devices only accept line breaks represented as <code>CR&nbsp;LF</code>, but do not recognize a single <code>LF</code>.

Extended M3U

The M3U file can also include comments, prefaced by the "#" character. In extended M3U, "#" also introduces extended M3U directives which are terminated by a colon ":" if they support parameters.

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>.

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.

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>. Likewise, these are the two types recommended for HLS use by Microsoft.

For non-HLS applications, no media types were standardized or registered with the IANA, but a number of media types are nonetheless associated with the historical and ongoing use of the M3U and M3U8 formats for general playlists:

  • <code>application/mpegurl</code>
  • <code>application/x-mpegurl</code>
  • <code>audio/mpegurl</code>
  • <code>audio/x-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:

  • 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
Windows
macOS

Media players

The following media player software supports playing M3U files.

Multi-platform
Android
macOS
Nintendo
Windows

See also

Other playlist file formats
  • PLS - SHOUTcast

References

External links