# M3U

**M3U**（MP3 URL）是一种纯文本播放列表文件格式，逐行列出一个媒体文件路径或流URL，可选地附带时长和显示名称。该格式由马丁·西勒（Martin Sieler）在埃尔朗根（Erlangen）的弗劳恩霍夫集成电路研究所（Fraunhofer IIS）开发，从未被正式的标准机构批准，却仍然是媒体软件中支持最广泛的播放列表格式之一。<sup>[1](https://docs.fileformat.com/audio/m3u/)</sup><sup> • </sup><sup>[2](https://m3uplayer.app/m3u-file-format)</sup><sup> • </sup><sup>[19](https://www.heise.de/hintergrund/25-Jahre-WinAmp-Der-Lama-Hintern-kriegt-Haue-7017360.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 一种纯文本文件，逐行列出一个媒体地址，可选地附带时长和显示名称<sup>[2](https://m3uplayer.app/m3u-file-format)</sup> |
| 起源 | 在埃尔朗根的弗劳恩霍夫集成电路研究所开发，代码由马丁·西勒编写；从未有正式标准机构批准该格式<sup>[1](https://docs.fileformat.com/audio/m3u/)</sup><sup> • </sup><sup>[3](https://www.file-extension.info/format/m3u)</sup><sup> • </sup><sup>[19](https://www.heise.de/hintergrund/25-Jahre-WinAmp-Der-Lama-Hintern-kriegt-Haue-7017360.html)</sup> |
| 文件扩展名 | .m3u用于本地系统默认非Unicode编码的文本；.m3u8用于UTF-8编码的文本<sup>[1](https://docs.fileformat.com/audio/m3u/)</sup> |
| 核心标签 | #EXTM3U文件头和#EXTINF时长与标题指令，被HLS流媒体格式继承<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup> |
| MIME类型 | M3U使用audio/mpegurl（未在IANA注册）；HLS播放列表使用application/vnd.apple.mpegurl<sup>[5](https://developer.apple.com/streaming/hls-authoring-specification-for-apple-devices.html)</sup> |
| 现代用途 | HTTP Live Streaming（HLS）清单文件的基础，以及IPTV播放器应用所使用的频道列表<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup><sup> • </sup><sup>[6](https://www.iptv-expert.app/en/blog/what-is-m3u-playlist)</sup> |

## 结构

M3U文件本身不包含媒体内容；它是一份地址列表，附带少量元数据。每个非注释行都是一个指向媒体资源的URI或文件路径。以#字符开头的行是注释或指令，而一个只包含裸URL、完全不含标签的文件仍然是有效的M3U，符合规范的播放器会打开它。<sup>[2](https://m3uplayer.app/m3u-file-format)</sup>

定义扩展格式的两条指令是#EXTM3U和#EXTINF：#EXTM3U必须位于第一行，将文件标记为扩展M3U播放列表；#EXTINF位于媒体条目之前，给出以秒为单位的时长，后跟显示标题。<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup>一个最小条目如下所示：

```
#EXTM3U
#EXTINF:221,Artist - Song Title
Music/Artist - Song Title.mp3
```

路径可以是绝对URL、绝对本地路径，或相对于播放列表文件所在位置的路径。相对条目在播放列表与其媒体一起移动时很方便，但移动文件夹会破坏基于文件的条目，除非重新设定路径基准。<sup>[7](https://formats.jarhalab.com/formats/playlist)</sup>

## 编码与.m3u8扩展名

原始格式假定使用本地系统的默认非Unicode字符编码，历史上被视为Latin-1或操作系统所使用的任何编码。.m3u8扩展名专门表示UTF-8编码，这使其成为包含带重音字母或非拉丁文字的文件名的必需选择。<sup>[1](https://docs.fileformat.com/audio/m3u/)</sup><sup> • </sup><sup>[6](https://www.iptv-expert.app/en/blog/what-is-m3u-playlist)</sup>[HTTP Live Streaming](https://www.edgepedia.org/zh/http-live-streaming)规范更进一步：其播放列表文件必须使用UTF-8编码，不得包含字节顺序标记，且除回车和换行外不得包含UTF-8控制字符。<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup>

## HTTP Live Streaming

当苹果公司于2009年推出HTTP Live Streaming（HLS）时，它将其播放列表文件构建在M3U格式之上。2017年8月发布的HLS规范RFC 8216指出，HLS播放列表文件的格式源自M3U，并从中继承了两个标签：EXTM3U和EXTINF。<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup><sup> • </sup><sup>[8](https://indico.freedesktop.org/event/5/contributions/259/attachments/117/175/HLS%2CLL-HLS%20and%20DASH%20Playback.pdf)</sup>在此基础上，HLS增加了一大类#EXT-X-标签，用于描述媒体分段、加密密钥、不同比特率的变体流以及备用音频或字幕版本。<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup>

HLS播放列表必须能够通过以.m3u8或.m3u结尾的路径来识别，或通过HTTP Content-Type application/vnd.apple.mpegurl或audio/mpegurl来识别。苹果公司的编写规范建议HLS播放列表使用application/vnd.apple.mpegurl，普通M3U播放列表使用audio/mpegurl，并指出M3U的MIME类型audio/mpegurl未在IANA注册。<sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup><sup> • </sup><sup>[5](https://developer.apple.com/streaming/hls-authoring-specification-for-apple-devices.html)</sup>IANA注册表确实列出了application/vnd.apple.mpegurl，其注册与HLS规范绑定。<sup>[9](https://www.iana.org/assignments/media-types)</sup>

## IPTV与扩展属性

[互联网协议电视](https://www.edgepedia.org/zh/internet-protocol-television)（IPTV）服务以M3U文件形式分发频道列表，TiviMate、IPTV Smarters、Perfect Player和VLC等播放器应用均可接受这些文件。<sup>[10](https://www.globe.gov/documents/10157/24408700/iptv-service-provider-premium-6.pdf)</sup>由于基础格式只携带时长和标题，IPTV播放列表在#EXTINF行上叠加了值用双引号括起的额外属性，例如tvg-id用于将频道链接到其XMLTV电子节目指南，tvg-logo用于台标图片，group-title用于频道分组。这些属性是由有影响力的播放器推广开来的广泛采用的惯例，并不属于任何官方规范。<sup>[6](https://www.iptv-expert.app/en/blog/what-is-m3u-playlist)</sup><sup> • </sup><sup>[11](https://uniplayer.net/docs/specs/m3u/)</sup>

## 支持情况与其他格式的比较

几乎所有数字音乐播放器都接受M3U，这就是为什么XML播放列表格式XSPF项目在论证M3U与更复杂标准之间的选择时，如此陈述自己的立场：M3U是最简单、最流行的播放列表格式，而SMIL等格式则复杂得多。<sup>[12](https://www.xspf.org/spec)</sup>[Windows Media Player](https://www.edgepedia.org/zh/windows-media-player)以其专有的.wpl格式保存播放列表，该格式可以创建动态播放列表，而.asx和.m3u格式则不能。<sup>[13](https://support.microsoft.com/en-gb/windows/apps/windowsmediaplayer/file-types-supported-by-windows-media-player)</sup>[Winamp](https://www.edgepedia.org/zh/winamp)本身在翻录CD时生成M3U和PLS播放列表，并将两者都视为简单文本文件。<sup>[14](https://support.winamp.com/winamp-desktop-player-for-windows)</sup>

[VLC媒体播放器](https://www.edgepedia.org/zh/vlc-media-player)既可导入也可导出M3U。其导入器通过.m3u8扩展名、UTF-8字节顺序标记或几种MPEGurl MIME类型之一来识别文件，其导出器则写入#EXTINF行和VLC特有的#EXTVLCOPT选项。<sup>[15](https://github.com/videolan/vlc/blob/master/modules/demux/playlist/m3u.c)</sup><sup> • </sup><sup>[16](https://github.com/videolan/vlc/blob/master/modules/misc/playlist/m3u.c)</sup>2007年的一份VideoLAN安全公告（CVE-2007-6683）描述了在VLC 0.8.6c或更早版本中打开特制的M3U播放列表，如何通过解析器的流输出功能覆盖任意文件或发送网络数据包；VLC 0.8.6d修复了该问题，而从VLC 0.9.0起，不安全的播放列表扩展功能一律被忽略。<sup>[17](https://images.videolan.org/security/sa0804.html)</sup>

## 局限性

该格式的简洁同时也是其约束。它是一个扁平列表，没有用于分组条目的结构性标准，这就是IPTV播放器处理电视剧集时显得笨拙的原因，也是扩展属性不得不在任何规范之外被发明出来的原因。<sup>[6](https://www.iptv-expert.app/en/blog/what-is-m3u-playlist)</sup>标题中的逗号是一个实实在在的隐患，因为EXTINF语法是纯文本，没有引号机制。<sup>[18](https://vidonzo.com/blog/inside-an-m3u-file/)</sup>编码是第二个反复出现的问题：以旧代码页保存的文件会错误处理国际字符，而某些文本编辑器会添加严格解析器所拒绝的字节顺序标记。<sup>[1](https://docs.fileformat.com/audio/m3u/)</sup><sup> • </sup><sup>[4](https://datatracker.ietf.org/doc/html/rfc8216)</sup>

## References

1. [M3U File Format – Your Guide to Playlists, FileFormat Docs](https://docs.fileformat.com/audio/m3u/)
2. [M3U File Format: The Spec, Explained Line by Line, m3uplayer.app](https://m3uplayer.app/m3u-file-format)
3. [M3U File – What It Is, How to Open & Convert It, File-Extension.info](https://www.file-extension.info/format/m3u)
4. [RFC 8216 – HTTP Live Streaming, IETF](https://datatracker.ietf.org/doc/html/rfc8216)
5. [HTTP Live Streaming (HLS) Authoring Specification for Apple Devices, Apple Developer](https://developer.apple.com/streaming/hls-authoring-specification-for-apple-devices.html)
6. [What Is an M3U Playlist? Complete Format Guide, IPTV Expert](https://www.iptv-expert.app/en/blog/what-is-m3u-playlist)
7. [Playlist File Formats – M3U, PLS & Media Lists, Jarhalab](https://formats.jarhalab.com/formats/playlist)
8. [HLS, LL-HLS and DASH Playback (presentation slides)](https://indico.freedesktop.org/event/5/contributions/259/attachments/117/175/HLS%2CLL-HLS%20and%20DASH%20Playback.pdf)
9. [IANA Media Types Registry](https://www.iana.org/assignments/media-types)
10. [IPTV Service Provider documentation (M3U compatibility)](https://www.globe.gov/documents/10157/24408700/iptv-service-provider-premium-6.pdf)
11. [The Complete M3U Playlist Format Reference for IPTV, UniPlayer Docs](https://uniplayer.net/docs/specs/m3u/)
12. [XSPF Specification](https://www.xspf.org/spec)
13. [File types supported by Windows Media Player, Microsoft Support](https://support.microsoft.com/en-gb/windows/apps/windowsmediaplayer/file-types-supported-by-windows-media-player)
14. [Winamp Desktop Player for Windows, Winamp Help Center](https://support.winamp.com/winamp-desktop-player-for-windows)
15. [vlc/modules/demux/playlist/m3u.c, VideoLAN Git](https://github.com/videolan/vlc/blob/master/modules/demux/playlist/m3u.c)
16. [vlc/modules/misc/playlist/m3u.c, VideoLAN Git](https://github.com/videolan/vlc/blob/master/modules/misc/playlist/m3u.c)
17. [VideoLAN Security Advisory 0804](https://images.videolan.org/security/sa0804.html)
18. [What is an M3U file? The playlist format, line by line, Vidonzo](https://vidonzo.com/blog/inside-an-m3u-file/)
19. [25 Jahre MP3-Player WinAmp: Der Lama-Hintern kriegt Haue](https://www.heise.de/hintergrund/25-Jahre-WinAmp-Der-Lama-Hintern-kriegt-Haue-7017360.html)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Data formats and serialization › Audio formats and codecs

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/m3u

English original: https://www.edgepedia.org/m3u
