在 .mov 后面添加透明背景(然后转换为 mp4)

在 .mov 后面添加透明背景(然后转换为 mp4)

我正在努力为透明 .mov 视频添加纯色背景。值得注意的是,运行时生成的帧似乎没有限制。我的命令:

ffmpeg -y -f lavfi -i color=lightgrey:s=1690x3000 -filter_complex 'overlay=0:0' -i Male-Nervous-System.mov -c:v libx264 -b:v 2000k -pass 1 -an -f mp4 /dev/null && ffmpeg -f lavfi -i color=lightgrey:s=1690x3000 -filter_complex 'overlay=0:0' -i Male-Nervous-System.mov -c:v libx264 -b:v 2000k -pass 2 -movflags faststart -c:a aac -b:a 128k ../mp4/Male-Nervous-System.mp4

我缺少什么来将浅灰色背景图像/视频的长度限制为其他视频的长度(大约 5 秒)?

答案1

默认情况下,覆盖过滤器的运行时间与两个输入中较长的一个一样长。颜色过滤器是不确定的,因此必须告知覆盖过滤器以最短的流停止。

ffmpeg -y -f lavfi -i color=lightgrey:s=1690x3000 -i Male-Nervous-System.mov -filter_complex 'overlay=0:0:shortest=1' -c:v libx264 -b:v 2000k -pass 1 -an -f mp4 /dev/null &&
ffmpeg -f lavfi -i color=lightgrey:s=1690x3000 -i Male-Nervous-System.mov -filter_complex 'overlay=0:0:shortest=1' -c:v libx264 -b:v 2000k -pass 2 -c:a aac -b:a 128k -movflags faststart  ../mp4/Male-Nervous-System.mp4

相关内容