m3u8 File Introduction

Source: Internet
Author: User

1. m3u8 File Concept

The m3u8 file refers to the m3u file in the UTF-8 encoded format. The m3u file is an indexed plain text file that is opened when the playback software does not play it, but instead finds the corresponding audio and video file's network address for online playback based on its index.

2. Examples of m3u8 files

For example, when you use cloud TV on-demand live programs, send requests:

Http://121.199.63.236:7613/m3u8/cckw1/szws.m3u8?from=bab&fun=yes&chk=y&chunk=xax&ppw=yuntutv &auth=yuntutvyuntutvyuntutv&auth=yuntutvyuntutvyuntutv&nwtime=1406515232&sign= 033d5483609e6bc87987fc7d2f30a024

Returns the m3u8 file with the following file contents:

#EXTM3U

#EXT-x-media-sequence:140651513

#EXT-x-targetduration:10

#EXTINF: 8,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651513[140651513].ts

#EXTINF: 9,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651514[140651514].ts

#EXTINF: 11,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651515[140651515].ts

#EXTINF: 10,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651516[140651516].ts

#EXTINF: 12,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651517[140651517].ts

#EXTINF: 8,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651518[140651518].ts

#EXTINF: 12,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651519[140651519].ts

#EXTINF: 8,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651520[140651520].ts

#EXTINF: 9,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651521[140651521].ts

#EXTINF: 13,

Http://vapp1.fw.live.cntv.cn/cache/289_/seg0/index140651522[140651522].ts

The audio and video is then downloaded and played according to the link request in the index

3. m3u file tag and attribute description

The m3u file can contain multiple tags, with each tag having the following functions and properties:

#EXTM3U

The first line of each m3u file must be this tag, please mark the function

#EXT-x-media-sequence:140651513

Each media URI has a unique ordinal number in playlist, adjacent to the ordinal +1, a media URI that does not have to be included, and if not, the default is 0

#EXTINF:,

Duration Specifies the duration (in seconds) of each media segment (TS), only valid for the URI that follows it, and title is the URL of the download resource

#EXT-x-targetduration

Specifies the maximum media segment length of time (in seconds). So the length of time specified in the #extinf must be less than or equal to the maximum value. This tag can only appear once in the entire playlist file (in the case of nesting, the tag will only appear for m3u8 with a real TS URL)

#EXT-x-key

Indicates how the media segments is decoded. Its scope is the next time the tag appears all the media URI, the property is None or AES-128. None indicates that the URI and IV (initialization Vector) attribute must not exist, AES-128 (Advanced Encryptionstandard) indicates that the URI must exist, and IV may not exist.

For AES-128, the Keytag and URI properties together represent a key file that can be obtained by URI, and if there is no IV (initialization Vector), the serial number is encoded as IV, The high-level of the serial number is assigned to 16 bytes of buffer, the left side is 0, and if there is an IV, the value is treated as a 16-byte 16 binary number.

#EXT-x-program-date-time

Associate an absolute time or date with the first sample in a media segment, valid only for the next Meida URI, in the form of #ext-x-program-date-time:

For example: #EXT-x-program-date-time:2010-02-19t14:54:23.031+08:00

#EXT-x-allow-cache

Whether to allow the cache, this can appear anywhere in the playlist file, and at most once, the effect is all media segments. The format is as follows: #EXT-x-allow-cache:

#EXT-x-playlist-type

Provides information about the variability of the PLAYLIST, which is valid for the entire PLAYLIST file, is optional, in the following format: #EXT-x-playlist-type:: If it is VOD, the server cannot change the PLAYLIST file; The server cannot change or delete any part of the playlist file, but it can add a new line to the file.

#EXT-x-endlist

Represents the end of the playlist, which can appear anywhere in the playlist, but only one, in the following format: #EXT-x-endlist

#EXT-x-media

A version of a language/translation that is used to represent the same content in a playlist, for example, by using 3 of these tags to represent 3 of audio without speech, or using 2 of this tag to represent different angles of video in playlists. This tag is independent, and the attribute contains:

URI: If not, the selectable version of the tag description exists in the Ext-x-stream-inf of the main playlist;

Type:audio and VIDEO;

Group-id: Mediatag with the same ID, forming a set of styles;

LANGUAGE: Determining the primary language used

NAME: Translation of human-readable languages

Default:yes or no, the default is no, and if yes, the client will play this option unless the user chooses to do so.

Autoselect:yes or no, the default is no, and if yes, the client chooses according to the current playback environment (the user does not choose according to his preference).

#EXT-x-stream-inf

Specifies a media URI that contains multimedia information as playlist, which is generally used as a nested m3u8, which is valid only for the URI immediately following it, in the following format: #EXT-x-stream-inf: There are some properties:

BANDWIDTH: bandwidth, must have.

Program-id: This value is a decimal integer that uniquely identifies a specific description within the scope of the playlist file. A playlist file may contain multiple of this tag with the same ID.

CODECS: Not required.

RESOLUTION: Resolution.

AUDIO: This value must match the value of the "Group-id" attribute in the "Ext-x-media" tab of the audio category.

VIDEO: Ditto

m3u8 File Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.