Home > Common Problem > body text

What format file is m3u8?

青灯夜游
Release: 2021-03-11 15:28:33
Original
162014 people have browsed it

m3u8 refers to the M3U file in UTF-8 encoding format; the M3U file records an index plain text file. When you open it, the playback software does not play it, but finds the corresponding audio and video based on its index. The network address of the file is played online.

What format file is m3u8?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

1. Introduction to M3U8

M3U8 files refer to M3U files in UTF-8 encoding format (M3U uses Latin-1 character set encoding) . The M3U file is a plain text file that records the index. When you open it, the playback software does not play it, but finds the network address of the corresponding audio and video file based on its index for online playback. The process is as follows:

What format file is m3u8?
m3u8 playback process.png

M3U8 is a common streaming media format that mainly exists in the form of a file list and supports both live broadcast and On-demand, especially on Android, iOS and other platforms, is most commonly used.

2. M3U8 encoding format

m3u8 can basically be considered as a .m3u format file. The difference is that m3u8 files use UTF-8 characters. coding.
#EXTM3U                                                                                                                                                                                                                                                                       # Maximum duration
#EXT-X-ALLOW-CACHE                                               ‐           ‐   ‐                                                                                                                  .
EXT-X-PLAYLIST-TYPE Provides information about the variability of PlayList, valid for the entire PlayList file, and is optional. The format is as follows: #EXT-X-PLAYLIST-TYPE: VOD (or EVENT). VOD means that the server cannot change the PlayList file; EVENT means that the server cannot change or delete any part of the PlayList file, but it can add a new line to the file.


Case 1:

M3U8 file reference link: https://dco4urblvsasc.cloudfront.net/811/81095_ywfZjAuP/game/1000kbps.m3u8 and content:

#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXTINF:10,
1000kbps-00001.ts
#EXTINF:10,
1000kbps-00002.ts

...

#EXTINF:10,
1000kbps-00099.ts
#EXTINF:10,
1000kbps-00100.ts
#ZEN-TOTAL-DURATION:999.70000
#ZEN-AVERAGE-BANDWIDTH:1098134
#ZEN-MAXIMUM-BANDWIDTH:1700874
#EXT-X-ENDLIST
Copy after login
This form of playback and download links needs to be spliced. For example, the link to the first TS clip is: https://dco4urblvsasc.cloudfront.net/811/81095_ywfZjAuP/game/1000kbps-00001.ts, which is the index The path 1000kbps-00001.ts in the file replaces 1000kbps.m3u8 at the end of the m3u8 link (that is, lastPathComponent).

Case 2:

使用云图TV点播直播节目时,发送请求:
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
Copy after login
返回M3U8文件,文件内容如下:
#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

...
Copy after login

This form of playback and download links: directly presented in the index file.

3. Advantages of M3U8

1. It can adapt to multiple code rates. According to the network bandwidth, the client will automatically select a file suitable for its own bit rate for playback to ensure smooth video streaming. The representative is Apple's HLS (HTTP Live Streaming). HLS has a feature: adaptive streaming. The client can automatically select video streams with different bit rates according to network conditions. Use high bit rates when conditions permit, and use low bit rates when the network is busy. And Automatically switch between the two at will. This is very helpful to ensure smooth playback when the network condition of mobile devices is unstable. 2. Reduce the load pressure on the source server. The characteristic of M3U is to divide the streaming media into several TS fragments, and then collect these TS fragments through an extended m3u list file for the client player to receive. The advantage of doing this compared to using the RTSP protocol is that once the segmentation is completed, the subsequent distribution process does not require the use of any additional special software. An ordinary network server can be used, which greatly reduces the configuration requirements of the CDN edge server and can use any off-the-shelf CDN. The most common protocol used for distribution is HTTP. The proxy server's caching optimization for this protocol is quite mature, while few proxy servers have caching optimization for RTSP.

3. For non-real-time videos, the benefits also exist: when playing a single MP4 format video file using the HTTP protocol, the proxy server needs to support HTTP range request to obtain part of the large file, but not all proxies Servers all have good support for this. M3U, on the other hand, only needs to find the corresponding TS fragment to download based on the timeline in the list file. It does not require a range request and has much smaller requirements on the proxy server. All proxy servers support efficient caching of small files.

4. Why use TS instead of MP4? This is because two TS clips can be seamlessly spliced ​​and the player can play them continuously. However, due to the encoding method of MP4 files, two MP4 clips cannot be seamlessly spliced. , the player will continuously play two MP4 files and there will be broken sound and picture interruption, which will affect the user experience.

For more related knowledge, please visit the

FAQ

column!

The above is the detailed content of What format file is m3u8?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template