ffmpeg 转码和 HLS

ffmpeg 转码和 HLS

将输入流转码为较小的二进制数:

ffmpeg -re -v info -i "rtmp://localhost/live/stream live=1" \
-c:v libx264 -b:v 500k -vf scale=540:-1 -preset faster -copyts \
-c:a aac -b:a 64k -ac 2 -flags +global_header \
-f flv "rtmp://localhost/live/500k live=1" \
-c:v libx264 -b:v 800k -vf scale=720:-1 -preset faster -copyts \
-c:a aac -b:a 64k -ac 2 -flags +global_header \
-f flv "rtmp://localhost/live/800k live=1"

然后我需要将它们转发到 AMS livepkgr HLS 应用程序:

ffmpeg -re -v info \
-i "rtmp://localhost/live/500k live=1" \
-c copy -copyts -flags +global_header \
-f flv "rtmp://localhost/livepkgr/500k?adbe-live-event=liveevent" \
-i "rtmp://localhost/live/800k live=1" \
-c copy -copyts -flags +global_header \
-f flv "rtmp://localhost/livepkgr/800k?adbe-live-event=liveevent"

生成的流未与关键帧对齐。有没有可能像 FMLE 编码器那样使用 ffmpeg 来实现这一点?谢谢关注。

答案1

尝试

ffmpeg -re -v info -i "rtmp://localhost/live/stream live=1" \
-filter_complex "[0:v]split[a][b];[a]scale=540:-1[oa];[b]scale=720:-1[ob]" \
-map [oa] -c:v libx264 -b:v 500k -preset faster -copyts \
-map 0:a -c:a aac -b:a 64k -ac 2 -flags +global_header \
-f flv "rtmp://localhost/live/500k live=1" \
-map [ob] -c:v libx264 -b:v 800k -preset faster -copyts \
-map 0:a -c:a aac -b:a 64k -ac 2 -flags +global_header \
-f flv "rtmp://localhost/live/800k live=1"

相关内容