简体   繁体   English

http livestreaming,一个包含ts文件的m3u8文件,我可以将它们合并为一个文件吗?

[英]http live streaming, a m3u8 file with loads of ts files, can I combine them into just one file?

I use the tools provided by apple to covert a .mp4 file into a m3u8 file and many .ts files. 我使用Apple提供的工具将.mp4文件转换为m3u8文件和许多.ts文件。 Then I uploaded those files to my server and use mpmovieplayercontroller to play the .m3u8 file and it worked. 然后,我将这些文件上传到服务器,并使用mpmovieplayercontroller播放.m3u8文件,该文件可以正常工作。

my question is, since there are too many .ts files and this would be difficult to manage on our server, is it possible to combine them into a single file, but it still follows http live streaming? 我的问题是,由于.ts文件太多,很难在我们的服务器上进行管理,是否可以将它们合并为一个文件,但是仍然遵循http live stream? Thank you, 谢谢,

since there are too many .ts files and this would be difficult to manage on our server, is it possible to combine them into a single file, but it still follows http live streaming? 由于.ts文件太多,并且很难在我们的服务器上进行管理,是否可以将它们合并为一个文件,但是仍然遵循http live stream?

It is possible. 有可能的。 Then you need to also alter the variant playlists so that that they use a byte-range request on the combined TS file. 然后,您还需要更改变体播放列表,以便它们在组合的TS文件上使用字节范围的请求。 Once you know the byte offsets of each of the original segments into the combined file, this is not particularly hard to do: you need to add a number of #EXT-X-BYTERANGE tags to the playlist, which point the media player to the byte range to request from the media server. 一旦知道组合文件中每个原始段的字节偏移量,就不难做到这一点:您需要在播放列表中添加多个#EXT-X-BYTERANGE标签 ,这#EXT-X-BYTERANGE媒体播放器指向向媒体服务器请求的字节范围。

Note that for #EXT-X-BYTERANGE to work you need a player that supports HLS version 4 or higher (which is anyway the near totality of iOS devices, and most Android devices). 请注意,要使#EXT-X-BYTERANGE正常工作,您需要一个支持HLS版本4或更高版本的播放器(无论如何,这是iOS设备和大多数Android设备#EXT-X-BYTERANGE )。

You should use a class of software called "media servers" to do transmuxing, ie re-packaging on the fly. 您应该使用一类称为“媒体服务器”的软件进行转发,即即时重新打包。 You'll be able to keep MP4 on your disk and have media server processing and caching it for all viewers. 您将能够将MP4保留在磁盘上,并进行媒体服务器处理并将其缓存给所有查看器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM