我修改了这个示例代码( https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos ):
ffmpeg
-i 1.avi -i 2.avi -i 3.avi -i 4.avi
-filter_complex "
nullsrc=size=640x480 [base];
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];
[base][upperleft] overlay=shortest=1 [tmp1];
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];
[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];
[tmp3][lowerright] overlay=shortest=1:x=320:y=240
"
-c:v libx264 output.mkv
仅使用两个视频(左和右):
./ffmpeg -i 1.avi -i 2.avi -filter_complex "nullsrc=size=1856x578 [base]; [0:v] setpts=PTS-STARTPTS, scale=928x578 [upperleft];[1:v] setpts=PTS-STARTPTS, scale=928x578 [upperright];[base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright]overlay=shortest=1:x=320 [tmp2] " -c:v libx264 combo.avi
但我总是得到以下错误:
Filter overlay has an unconnected output
任何帮助都会很棒。非常感谢你。