大家好,我的 ffmpeg 行目前看起来像这样
ffmpeg -i "http://x.com/x.ts" -s 810x520 -pix_fmt yuv420p -vcodec copy -acodec copy -bsf:v h264_mp4toannexb -preset baseline -strict -2 -flags -global_header -f segment -segment_list "E:\2.m3u8" -segment_time 10 -segment_list_size 5 "E:\2-%%3d.ts"
它生成 .ts 文件,如 1.ts 2.ts 等。
但如果你要查看 twitch.tv 的 m3u8 文件,它看起来像这样
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#ID3-EQUIV-TDTG:2016-10-14T12:33:35
#EXT-X-MEDIA-SEQUENCE:345
#EXT-X-TWITCH-ELAPSED-SYSTEM-SECS:1368.979
#EXT-X-TWITCH-ELAPSED-SECS:1365.240
#EXT-X-TWITCH-TOTAL-SECS:1386.919
#EXTINF:3.440,
index-0000000346-Am9S.ts
#EXTINF:1.720,
index-0000000347-Am3j.ts
#EXTINF:3.980,
index-0000000348-MYfR.ts
#EXTINF:2.000,
index-0000000349-kIwd.ts
#EXTINF:3.300,
index-0000000350-TpwI.ts
#EXTINF:3.500,
index-0000000351-MAjv.ts
我也想做同样的事情有什么例子吗?
谢谢。
此致
最佳答案
这不能直接用 FFMPEG 完成。 Twitch 处理 M3U8 文件并用他们自己的自定义格式重写它。它在最后一段中提到:https://blog.twitch.tv/en/2017/10/10/live-video-transmuxing-transcoding-f-fmpeg-vs-twitch-transcoder-part-i-489c1c125f28/
Certain information needs to be inserted into the HLS bitstreams to enhance the user experience on the player side. By building our own transcoder and player, Twitch can control the full end-to-end ingest-transcode-CDN-playback pipeline. This allows us to insert proprietary metadata structures into the transcoder output, which are eventually parsed by our player and utilized to produce effects unique to Twitch.
关于video - m3u8 文件中的随机 .ts 文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40043319/