问题描述
我目前正在用 PHP 编写一个脚本来运行一些 ffmpeg
命令来获取 concat
并从中创建一个实时流 hls
文件。
我使用的是旧版本的 ffmpeg
和 -f 段,这工作正常,但我不得不更新系统上的 ffmpeg
以获取其他内容,因此我一直在更新所有内容以使用 -f hls 但是,这会产生问题,使用 -f hls 的流不再有效,并且在每 5-10 秒结束时不断停止和重新启动,每个段应该在 6 秒左右。
这是我的旧命令
exec("ffmpeg -y -nostdin -hide_banner -re -f concat -safe 0 -i concat.txt -vcodec copy -acodec copy -f segment -segment_format mpegts -segment_time 6 -segment_list_size 10 -segment_format_options mpegts_flags=+initial_discontinuity:mpegts_copyts=1 -segment_list_type m3u8 -segment_list_flags +live+delete -segment_list segment%d.ts playlist.m3u8",$rScriptOut);
这就是我现在拥有的
exec('ffmpeg -y -nostdin -hide_banner -re '-f concat -safe 0 -i concat.txt -vcodec copy -acodec copy -map 0 -sn -dn -f "hls" -hls_time 6.000 -hls_segment_type "mpegts" -hls_list_size 6 -hls_delete_threshold 6 -hls_flags "delete_segments+discont_start+omit_endlist" -hls_segment_filename segment%d.ts playlist.m3u8',$rScriptOut);
在使用 -f segment 之前,流会播放得很好而且流畅,不断读取 concat 文件并以实时格式创建片段和播放列表
使用 -f hls 它根本不起作用并且它在几秒钟后冻结并重新启动应该注意我正在使用 nginx
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)