Two videos on image background I am sort of new to this. I am trying to create an output video using two videos and a background image.

 With a bit of gap around the videos and Video A having a larger scale than Video B. And, it should end at Video A's duration. Therefore, Video B should be cropped to Video A's duration.

This is what I have managed to do so far:



ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" Output.mp4




ffmpeg -i Test1.mp4 -i Test1.mp4 -filter_complex "[0:v][1:v]xstack=inputs=2:layout=0_0|w0_h0[v]" -map "[v]" -map 1:a Output.mp4
I managed to solve this after some pondering.

ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -i Test2.mp4 -filter_complex "[2:v]tpad=stop=-1:stop_mode=clone[v2]; [1:v]scale=640-20:360-20[a]; [v2]scale=320-20:180-20[b]; [0:v][a]overlay=10:(main_h/2)-(overlay_h/2):shortest=1[c]; [c][b]overlay=main_w-overlay_w-10:(main_h/2)-(overlay_h/2)[video]" -shortest -map "[video]" -map 1:a -vsync 2 Output.mp4