M3U
lastmod 2022-02-07created 2022-01-189 edits
M3U is a file format for multimedia playlists. Most programs, such as Windows Media Player, iTunes, Winamp, and ALSong, support it, but there is no formal specification and support varies from program to program.
Categories
- FFmpeg:Example:HLS - FFmpeg HLS conversion options and code samples (see the m3u8 format)
Tags
EXT-X-VERSION
Protocol versions and features:
| EXT-X-VERSION | Features and usage notes |
| 2 | IV attribute of the EXT-X-KEY tag |
| 3 | Floating-point EXTINF duration values |
| 4 | EXT-X-BYTERANGE, EXT-X-I-FRAME-STREAM-INF, EXT-X-I-FRAMES-ONLY, EXT-X-MEDIA, the AUDIO and VIDEO attributes of the EXT-X-STREAM-INF tag |
| 5 | KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY tag. The EXT-X-MAP tag. SUBTITLES media type. SAMPLE-AES encryption method EXT-X-KEY |
| 6 | CLOSED-CAPTIONS media type. Allow EXT-X-MAP for subtitle playlists |
| 7 | EXT-X-SESSION-DATA, EXT-X-SESSION-KEY, EXT-X-DATERANGE, 'SERVICEn' values of INSTREAM-ID, AVERAGE-BANDWIDTH, FRAME-RATE, CHANNELS, and HDCP-LEVEL attributes. |
| 8 | EXT-X-GAP, EXT-X-DEFINE, Variable Substitution, VIDEO-RANGE attribute. |
Examples
- Apple Developer Documentation - Example Playlists for HTTP Live Streaming
- [Recommended] (Swift) Playlists for HTTP Live Streaming (m3u8)
Checking support
HLS support can be checked as follows.
/**
* https://github.com/videojs/videojs-contrib-hls
* Whether the browser has built-in HLS support.
*/
videojs.Hls.supportsNativeHls = (function() {
var
video = document.createElement('video'),
xMpegUrl,
vndMpeg;
// native HLS is definitely not supported if HTML5 video isn't
if (!videojs.Html5.isSupported()) {
return false;
}
xMpegUrl = video.canPlayType('application/x-mpegURL');
vndMpeg = video.canPlayType('application/vnd.apple.mpegURL');
return (/probably|maybe/).test(xMpegUrl) ||
(/probably|maybe/).test(vndMpeg);
})();
var video = document.getElementById('video');
var videoSrc = 'https://test.dev/tmp/index.m3u8';
// HLS를 지원하는지 체크
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = videoSrc;
// HLS를 지원하지 않는다면 hls.js 사용
} else if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(videoSrc);
hls.attachMedia(video);
}
See also
Favorite site
- Wikipedia (en) M3U
- HLS manifest tag handling - AWS Elemental MediaTailor
- HTTP Live Streaming (HLS) encoder integration
- Creating m3u8 meta files for HLS (using ffmpeg)
- (Swift) Playlists for HTTP Live Streaming (m3u8)