Generate .m3u8 on the fly from .ts files

半城伤御伤魂 提交于 2021-02-06 14:00:49

问题


I have a list of .ts file segments that follow this pattern

http://www.someaddress.com/file_11223344.ts
http://www.someaddress.com/file_11223345.ts
http://www.someaddress.com/file_11223346.ts
...

Since I need a m3u8 file in order to open this videos, is there a way to generate this m3u8 manually (from ts segments) in .php for example. Original m3u8 is protected and generated only if I have user/pass id etc. This is live stream that is always updated and generated based on a timestamp


回答1:


if you have the main file, let's say : http://www.someaddress.com/file_11223344.ts you don't have to convert anything. just change the end of the URL from .ts to .m3u8 that's it :)




回答2:


Yes there is a way. You just generate it. The m3u8 spec is very simple and fully documented. https://tools.ietf.org/html/draft-pantos-http-live-streaming-19




回答3:


szatmary is correct.

For your case, being pass protected you can use json or xml feeds and parse it or simply call the m3u8 file and make sure it is done in utf-8 without BOM. Here is a m3u8 method.

#EXTM3U
#EXTINF:-1,Title Here
http://www.someaddress.com/live/user/pass/file_11223344.m3u8
#EXTINF:-1,Title Here
http://www.someaddress.com/live/user/pass/file_11223345.m3u8
#EXTINF:-1,Title Here
http://www.someaddress.com/live/user/pass/file_11223346.m3u8

Learn about BOM here What's different between UTF-8 and UTF-8 without BOM?




回答4:


All you have to do is a IPTV website which provide .ts streaming file, If you have subscription then it will be more useful. Just you want to change one address.



来源:https://stackoverflow.com/questions/38011563/generate-m3u8-on-the-fly-from-ts-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!