M3U Back
Menu
1. Introduction
- M3U is an standard of plain-text files, which is used to record an index. Player is not to play it, but to find video files to play according to the index recorded in M3U file.
- M3U8 is a kind of M3U files with UTF-8 encode.
- M3U is based on a protocol named HLS (HTTP Live Stream)
- A multimedia presentation is specified by a URI [RFC3986] to a Playlist file, which is an ordered list of media URIs and informational tags. Each media URI refers to a media file which is a segment of a single contiguous stream.
- Each ines is terminated by either a single LF (\n) character or a CR (\n) character followed by an LF character, and it maybe a URI, a blank, or starts with the comment character '#'.
- Tags: begin with '#EXT'
- Comments: only begin with '#'
2. Tags
2.1 EXTM3U, EXTINF
- Description: To identify what kind of this file. An Extended M3U file is distinguished from a basic M3U file by its first line, which must be #EXTM3U.
- M3U: #EXTINF
- Extended M3U: #EXTM3U
Format:
- duration: an integer(less than Version 3) or floating-point number in decimal positional notation that specifies the duration of the media file in seconds.
title: the title of the media file
#EXTINF:<duration>,<title>
2.2 EXT-X-TARGETDURATION
- Description: To specifie the maximum media file duration, which the EXTINF duration of each media file in the Playlist file must be less than or equal.
Format:
s: an integer indicating the target duration in seconds
#EXT-X-TARGETDURATION:<s>
2.3 EXT-X-MEDIA-SEQUENCE (optional)
- Description: To indicate the sequence number of the first URI that appears in a Playlist file.
Format:
number: if the playlist does not contain an EXT-X-MEDIA-SEQUENCE, it shall be considered to be 0
#EXT-X-MEDIA-SEQUENCE:<number>
2.4 EXT-X-KEY (optional)
- Description: To provide information necessary to decrypt media files that follow it.
Format:
- attribute-list
- URI attribute: to specify how to obtain the key
- IV attribute: to specify the Initialization Vector to be used with the key (a hexadecimal-integer)
method:
- NONE: An encryption method of NONE means that media files are not encrypted
- AES_128: An encryption method of AES-128 means that media files are encrypted using the Advanced Encryption Standard [AES_128] with a 128-bit key and PKCS7 padding [RFC5652]. (URI attribute must be present, IV attribute may be present)
#EXT-X-KEY:<attribute-list>
- attribute-list
2.5 EXT-X-PROGRAM-DATE-TIME (optional)
- Description: To indicate whether the client MAY or MUST NOT cache downloaded media files for later replay.
Format:
#EXT-X-ALLOW-CACHE:<YES|NO>
2.6 EXT-X-PROGRAM-DATE-TIME (optional)
- Description: To indicate whether the client MAY or MUST NOT cache downloaded media files for later replay.
Format:
#EXT-X-ALLOW-CACHE:<YES|NO>
2.7 EXT-X-PLAYLIST-TYPE (optional)
- Description: To provide mutability information about the Playlist file
Format:
#EXT-X-PLAYLIST-TYPE:<EVENT|VOD>
2.8 EXT-X-ENDLIST
- Description: To indicate that no more media files will be added to the Playlist file.
Format:
#EXT-X-ENDLIST
2.9 EXT-X-STREAM-INF (optional)
- Description: To provide mutability information about the Playlist file
Format:
attribute-list
- BANDWIDTH(need): a decimal-integer of bits per second, which must be an upper bound of the overall bitrate of each media file
- PROGRAM-ID: a decimal-integer that uniquely identifies a particular presentation within the scope of the Playlist file
- CODECS(need): a quoted-string containing a comma-separated list of formats, where each format specifies a media sample type that is present in a media file in the Playlist file
- RESOLUTION: a decimal-resolution describing the approximate encoded horizontal and vertical resolution of video within the stream
#EXT-X-STREAM-INF:<attribute-list> <URI>
2.10 EXT-X-DISCONTINUITY (optional)
- Description: To indicate an encoding discontinuity between the media file that follows it and the one that preceded it
The set of characteristics that MAY change is:
- file format
- number and type of tracks
- encoding parameters
- encoding sequence
timestamp sequence
#EXT-X-DISCONTINUITY
2.11 EXT-X-VERSION
- Description: To indicate the compatibility version of the Playlist file
Attention: A Playlist file that does not contain an EXT-X-VERSION tag MUST comply with version 1 of this protocol.
#EXT-X-VERSION:<n>