FMUSER Wirless Transmit Video And Audio More Easier !
es.fmuser.org
it.fmuser.org
fr.fmuser.org
de.fmuser.org
af.fmuser.org ->Afrikaans
sq.fmuser.org ->Albanian
ar.fmuser.org ->Arabic
hy.fmuser.org ->Armenian
az.fmuser.org ->Azerbaijani
eu.fmuser.org ->Basque
be.fmuser.org ->Belarusian
bg.fmuser.org ->Bulgarian
ca.fmuser.org ->Catalan
zh-CN.fmuser.org ->Chinese (Simplified)
zh-TW.fmuser.org ->Chinese (Traditional)
hr.fmuser.org ->Croatian
cs.fmuser.org ->Czech
da.fmuser.org ->Danish
nl.fmuser.org ->Dutch
et.fmuser.org ->Estonian
tl.fmuser.org ->Filipino
fi.fmuser.org ->Finnish
fr.fmuser.org ->French
gl.fmuser.org ->Galician
ka.fmuser.org ->Georgian
de.fmuser.org ->German
el.fmuser.org ->Greek
ht.fmuser.org ->Haitian Creole
iw.fmuser.org ->Hebrew
hi.fmuser.org ->Hindi
hu.fmuser.org ->Hungarian
is.fmuser.org ->Icelandic
id.fmuser.org ->Indonesian
ga.fmuser.org ->Irish
it.fmuser.org ->Italian
ja.fmuser.org ->Japanese
ko.fmuser.org ->Korean
lv.fmuser.org ->Latvian
lt.fmuser.org ->Lithuanian
mk.fmuser.org ->Macedonian
ms.fmuser.org ->Malay
mt.fmuser.org ->Maltese
no.fmuser.org ->Norwegian
fa.fmuser.org ->Persian
pl.fmuser.org ->Polish
pt.fmuser.org ->Portuguese
ro.fmuser.org ->Romanian
ru.fmuser.org ->Russian
sr.fmuser.org ->Serbian
sk.fmuser.org ->Slovak
sl.fmuser.org ->Slovenian
es.fmuser.org ->Spanish
sw.fmuser.org ->Swahili
sv.fmuser.org ->Swedish
th.fmuser.org ->Thai
tr.fmuser.org ->Turkish
uk.fmuser.org ->Ukrainian
ur.fmuser.org ->Urdu
vi.fmuser.org ->Vietnamese
cy.fmuser.org ->Welsh
yi.fmuser.org ->Yiddish
background
MP4 is our common video format, and often when we play server videos, it is directly the requested MP4 video source. But in fact, this is not good. The MP4 header file [ftyp+moov] is large, and the initial playback needs to download the complete header file and analyze it, and then download a certain length of playable video clip to play. In addition, as the size of the video increases, the header file will continue to grow, and the initial playback time will be longer. In view of this situation, a method that can speed up the initial analysis of the video is needed. HLS is the solution proposed by Apple to solve this problem.
HLS
HLS is the abbreviation of HTTP Live Streaming. It is an HTTP-based streaming media network transmission protocol proposed by Apple. It can support live and on-demand at the same time, as well as multi-definition, audio and video dual-track, subtitles and other functions. Its principle is to divide a whole video into multiple small videos, and the complete playback is formed by splicing these segments.
HLS is widely used on mobile terminals. The current clients that support the HLS protocol include:
iOS 3.0 and above, AVPlayer natively supports HLS
Android 3.0 and above
Adobe Flash Player 11.0 and above
Its general principle is this:
1. Collect audio and video
2. Encode audio and video on the server
3. After encoding, hand it over to the Stream Segmenter in the form of MPEG-2 transport stream
4. The slicer creates an index file and a ts playlist, the index file is used to indicate the position of the audio and video, and ts is a real multimedia clip
5. Put the resources of the previous step on the HTTP server
6. The client requests the index file for playback, and the playback content can be found through the index file
M3U8
A key step to realize HLS is the fourth step above, namely the organization of index files and ts playlists. The M3U8 format is used here. M3U8 is the Unicode version of M3U, 8 means UTF-8 encoding is used, and both M3U and M3U8 are file formats for multimedia lists.
M3U8 format description
Sometimes we may need to manually modify the content of the M3U8 file for testing or in some special cases, so we need to have a certain understanding of its format. The definition of this format is written in the RFC 8216 document. The following are some notes:
M3U8 files must be encoded in UTF-8, and cannot use Byte Order Mark (BOM) byte order, and cannot contain utf-8 control characters (U+0000 ~ U_001F and U+007F ~ u+009F)
Each line of the M3U8 file content is either a blank line, a URI, or a string starting with #, and no blank characters can appear.
The built-in tags are all strings starting with #EXT and are case sensitive.
URI is the content path, which can be a relative path or an absolute path
Master M3U8 list file
The main M3U8 index file is generally used to specify multiple index sources. Let's first analyze the content of the main m3u8 file hls_vod_mvp.m3u8, its head is like this
Header format
#EXTM3U
#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTSCopy code
#EXTM3U indicates that the file is in M3U format, and all M3U format files should put the content on the first line.
#EXT-X-VERSIOn indicates the compatible version of the playlist, which is currently 7.
#EXT-X-INDEPENDENT-SEGMENTS This tag indicates that all media samples in a media segment can be decoded independently without relying on other media segment information.
Subtitle format
The content below is some captions, the content of captions is not necessary.
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/eng/ prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subsC",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/engc/ prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Japanese",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="jpn",URI="subtitles/jpn/ prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subsC",NAME="Japanese",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="jpn",URI="subtitles/jpnc/ prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Chinese",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="zho",URI="subtitles/zho/ prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subsC",NAME="Chinese",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="zho",URI="subtitles/zhoc/ prog_index.m3u8"Copy code
#EXT-X-MEDIA is used to specify multilingual media list resources of the same content.
TYPE is the resource type, and the optional contents are: AUDIO, VIDEO, SUBTITLES, CLOSED-CAPTIONS.
The above content sets TYPE=SUBTITLES, which is the subtitle type.
GROUP-ID is the group to which the multilingual translation belongs and is a required parameter
NAME is the readable description information of the translation stream, and this value corresponds to the displayName of AVMediaSelectionOption.
DEFAULT, AUTOSELECT, FORCED are three BOOL values corresponding to whether the translation stream is selected by default if necessary information is missing. The playback stream is played when the user does not display the settings. FORCED is only valid for the subtitle type and is used to mark the current automatic selection of the translation stream. .
LANGUAGE is used to specify the language type, which is set according to the [ISO 639 language code] (https://www.w3.org/WAI/ER/WD-AERT/iso639.htm "ISO 639 language code") standard. When the system default player selects subtitles, the name of the subtitle list displayed is set according to this value.
The URI is the location information of the resource, where it corresponds to a subtitled M3U8 file. subtitles/eng/prog_index.m3u8 is a relative path,
Through the above information, we can analyze the meaning of the above content as: The current video supports three subtitles: English, Japanese, and Chinese. But each language has two EXT-X-MEDIA messages. The difference between them is the grouping, one is grouped in subs and the other is grouped in subsC. Why are there two groups? I'll talk about this later.
Video format
Look down again, for the index of the video content:
#EXT-X-STREAM-INF:BANDWIDTH=827299,AVERAGE-BANDWIDTH=747464,CODECS="avc1.64001f,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="program_audio",SUBTITLES=" subs"
0640/0640.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=360849,AVERAGE-BANDWIDTH=320932,CODECS="avc1.64001f",RESOLUTION=640x360,URI="0640/0640_I-Frame.m3u8"Copy code
EXT-X-STREAM-INF: This attribute specifies a backup source, that is, the video playback path and some video information. The following is the configuration of the corresponding content: BANDWIDTH is the peak bit rate, 827299 is 827299bit/s, which is the highest peak time Consumes 101KB of traffic per second.
AVERAGE-BANDWIDTH is the average bit rate, 747464
CODECS is encoding information, avc1.64001f, mp4a.40.2, avc represents the h264 encoding format, the following 64001f is the encoding parameter represented by hexadecimal, 64, 00, 1f respectively represent three different parameter values. mp4a is an audio coding format, and the following 40.2 represents audio coding parameters.
RESOLUTION is the video resolution. The current video source resolution is 640x360.
FRAME-RATE is the maximum frame rate, 29.970 represents the maximum frame rate of the current playback is 29.970 frames per second.
AUDIO is the audio group, and program_audio is the name of the corresponding audio group.
SUBTITLES indicates the corresponding subtitle group, and subs is the name of the corresponding subtitle group. The above subtitle information has a GROUP-ID, and this value corresponds to it.
URI is the content path, 0640/0640.m3u8 corresponds to the m3u8 file path of the video source. This can be seen in the packet capture information.
Below EXT-X-STREAM-INF is EXT-X-I-FRAME-STREAM-INF, which represents the I frame (key frame) of the multimedia resource contained in the playlist file. Because the I frame is just a picture, it does not contain audio content, and the remaining parameters are consistent with the video content format.
After that, there are video sources corresponding to different resolutions, 1920x1080, 1280x720, 960x540, 480x270. Because HLS will automatically switch the resolution according to the network situation, multiple resolutions are generally prepared for selection. According to the analysis of the captured data, the first segment played is 640 resolution, the second to 8 segments after that are 480 resolution, and then it is switched to 640 resolution.
audio format
Looking down is the index of the corresponding audio
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="program_audio",LANGUAGE="eng",NAME="Alternate Audio",AUTOSELECT=YES,DEFAULT=YES,URI="audio1/audio1.m3u8"Copy Code
#EXT-X-MEDIA appeared above, but did not mention the list for multiple languages.
TYPE=AUDIO, this time the type is audio.
GROUP-ID is the group ID, corresponding to the AUDIO content in EXT-X-STREAM-INF.
URI=audio1/audio1.m3u8 corresponds to the audio path.
Alternative sources of different encoding formats
In the main M3U8 file, we can also see a 640 resolution video source, which is not the same as the above 640 resolution. Its content is like this:
#EXT-X-STREAM-INF:BANDWIDTH=1922391,AVERAGE-BANDWIDTH=1276855,VIDEO-RANGE=SDR,CODECS="hvc1.2.4.H150.B0,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970 ,AUDIO="program_audio_0",SUBTITLES="subsC"
0640c/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1922391,AVERAGE-BANDWIDTH=1276855,CODECS="hvc1.2.4.H150.B0",RESOLUTION=640x360,URI="0640c/iframe_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="program_audio_0",LANGUAGE="eng",NAME="Alternate Audio",AUTOSELECT=YES,DEFAULT=YES,URI="audioc/prog_index.m3u8"Copy Code
The CODECS encoding format is hvc1.2.4.H150.B0, mp4a.40.2, the audio encoding format has not changed, but the video encoding format has changed. hvc1 is one of the HEVC (H265) encoding formats. It is a new generation video encoding format launched by Apple. Because of compatibility issues, many clients cannot parse this format, so it is not very popular. Video sources of this format appear It should be a backup here. Comparing two contents of the same resolution, it can be found that the bit rate of hvc1 format is higher than that of avc1 format, which shows that the content of hvc1 is larger and the compression ratio of avc1 is higher under the same resolution.
Corresponding to the hvc1 format video source, its subtitle content grouping and audio content grouping have also changed, which is why the above subtitles have two copies of the same language, and they correspond to the video sources in avc1 and hvc1 formats.
This is the main list of M3U8. The audio and video of this content are processed separately, but they can also be combined.
M3u8 file containing media information
Take the file 0640.m3u8 as an example
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.006,
0640_00001.ts
#EXTINF:6.006,
0640_00002.ts
#EXTINF:6.006,
0640_00003.ts
....
#EXT-X-ENDLISTCopy code
#EXTM3U and #EXT-X-VERSION are the M3U file header and compatible version number respectively. This format is an early version so the version number is lower than the main file.
EXT-X-TARGETDURATION represents the maximum duration of each playback segment, 7 represents 7 seconds, and the segments in this directory cannot exceed 7s.
EXT-X-MEDIA-SEQUENCE represents the sequence number of the first segment of the playlist, and 1, represents that the play segment starts from 1.
#EXTINF represents the duration of the segment, 6.006 means that the current segment is 6.006s. The total video duration information is obtained by accumulating this value.
0640_00001.ts is the relative path of the clip. The ts file represents a piece of video or audio, and it can be in ts, mp4, aac and other formats. Because it has been specified to open from 1
|
Enter email to get a surprise
es.fmuser.org
it.fmuser.org
fr.fmuser.org
de.fmuser.org
af.fmuser.org ->Afrikaans
sq.fmuser.org ->Albanian
ar.fmuser.org ->Arabic
hy.fmuser.org ->Armenian
az.fmuser.org ->Azerbaijani
eu.fmuser.org ->Basque
be.fmuser.org ->Belarusian
bg.fmuser.org ->Bulgarian
ca.fmuser.org ->Catalan
zh-CN.fmuser.org ->Chinese (Simplified)
zh-TW.fmuser.org ->Chinese (Traditional)
hr.fmuser.org ->Croatian
cs.fmuser.org ->Czech
da.fmuser.org ->Danish
nl.fmuser.org ->Dutch
et.fmuser.org ->Estonian
tl.fmuser.org ->Filipino
fi.fmuser.org ->Finnish
fr.fmuser.org ->French
gl.fmuser.org ->Galician
ka.fmuser.org ->Georgian
de.fmuser.org ->German
el.fmuser.org ->Greek
ht.fmuser.org ->Haitian Creole
iw.fmuser.org ->Hebrew
hi.fmuser.org ->Hindi
hu.fmuser.org ->Hungarian
is.fmuser.org ->Icelandic
id.fmuser.org ->Indonesian
ga.fmuser.org ->Irish
it.fmuser.org ->Italian
ja.fmuser.org ->Japanese
ko.fmuser.org ->Korean
lv.fmuser.org ->Latvian
lt.fmuser.org ->Lithuanian
mk.fmuser.org ->Macedonian
ms.fmuser.org ->Malay
mt.fmuser.org ->Maltese
no.fmuser.org ->Norwegian
fa.fmuser.org ->Persian
pl.fmuser.org ->Polish
pt.fmuser.org ->Portuguese
ro.fmuser.org ->Romanian
ru.fmuser.org ->Russian
sr.fmuser.org ->Serbian
sk.fmuser.org ->Slovak
sl.fmuser.org ->Slovenian
es.fmuser.org ->Spanish
sw.fmuser.org ->Swahili
sv.fmuser.org ->Swedish
th.fmuser.org ->Thai
tr.fmuser.org ->Turkish
uk.fmuser.org ->Ukrainian
ur.fmuser.org ->Urdu
vi.fmuser.org ->Vietnamese
cy.fmuser.org ->Welsh
yi.fmuser.org ->Yiddish
FMUSER Wirless Transmit Video And Audio More Easier !
Contact
Address:
No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620
Categories
Newsletter