In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the format of files that m3u8 refers to. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
M3u8 refers to the M3U file in UTF-8 coding format; M3U file records an index plain text file. When opening it, the playback software does not play it, but finds the network address of the corresponding audio and video file according to its index to play online.
A brief introduction to M3U8
M3U8 files refer to M3U files in UTF-8 encoding format (M3U uses Latin-1 character set encoding). M3U file is a plain text file that records the index. when opening it, the playback software does not play it, but finds the network address of the corresponding audio and video file according to its index to play online. The process is as follows:
M3u8 playback flow .png
M3U8 is a common streaming media format, which mainly exists in the form of file list. It supports both live streaming and VOD, especially in Android, iOS and other platforms.
II. M3U8 coding format
M3u8 can basically be thought of as .m3u format files, the difference is that m3u8 files use UTF-8 character encoding.
# EXTM3U m3u file header, must be placed on the first line
# EXT-X-MEDIA-SEQUENCE Serial number of the first TS part
# EXT-X-TARGETDURATION maximum duration of each multipart TS
# whether EXT-X-ALLOW-CACHE allows cache
# EXT-X-ENDLIST m3u8 file Terminator
# EXTINF extra info, information about sharding TS, such as duration, bandwidth, etc.
# EXT-X-PLAYLIST-TYPE provides information about the variability of PlayList, which is 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 can add a new line to the file.
Example 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
This form of playback and download links need to be spliced, for example, the link for the first TS clip is: https://dco4urblvsasc.cloudfront.net/811/81095_ywfZjAuP/game/1000kbps-00001.ts, that is, the path 1000kbps-00001.ts in the index file replaces the 1000kbps.m3u8 at the end of the m3u8 link (that is, lastPathComponent).
Example 2:
When you use Cloud Image TV to broadcast live programs on demand, send a request:
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
Return to the M3U8 file The contents of the file are as follows: # 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...
This form of playback and download link: directly presented in the index file.
Third, the advantages of M3U8
1. Multi-rate adaptation can be done. According to the network bandwidth, the client will automatically select a file suitable for its own bitrate to play to ensure a smooth video stream, which represents Apple's HLS (HTTP Live Streaming). HLS has a feature: adaptive bit rate streaming (adaptive streaming), the client can automatically select video streams with different bitrates according to the network conditions, use high bitrates when conditions permit, use low bitrates when the network is busy, and automatically switch between the two at will. This is very helpful to ensure smooth playback in the case of unstable network conditions of mobile devices.
2. Reduce the load pressure on the source server. The characteristic of M3U is that it divides the streaming media into several TS fragments, and then centralizes these TS fragments for the client player to receive through an extended M3U list file. The advantage of this compared to using RTSP protocol is that once the segmentation is completed, the subsequent distribution process does not need to use any additional specialized software, ordinary network servers can be used, which greatly reduces the configuration requirements of CDN edge servers and can use any ready-made CDN. The protocol used for distribution is the most common HTTP, and the cache optimization of this protocol by proxy servers is quite mature, while there are few proxy servers to optimize the cache of RTSP.
3. For non-real-time video, the benefits also exist: when playing a single MP4 format video file using HTTP protocol, the proxy server is required to support HTTP range request to get some of the large files, but not all proxy servers have good support for this. On the other hand, M3U only needs to find the corresponding TS fragments according to the timeline in the list file to download. It does not need range request, and the requirements for proxy servers are much smaller. 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 stitched together and the player can play them continuously. While MP4 files cannot be seamlessly stitched together because of the encoding method, two MP4 segments cannot be seamlessly stitched together. When the player plays two MP4 files in a row, there will be sound breakage and picture interruption, which will affect the user experience.
Thank you for reading! This is the end of the article on "what format file m3u8 refers to". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.