-
using nullsrc + overlay to make a 2×2 multi-screen video – how can I set length to longest of the 4 input videos?
Hi folks, brand new to this forum, wanted to ask a question about the following recipe which I grabbed off the internet and am using to make a 2×2 multi-screen video from 4 input videos ..
ffmpeg -i vid1.mp4 -i vid2.mp4 -i vid3.mp4 -i vid4.mp4 -filter_complex “nullsrc=size=1920×1080 [base]; [0:v] setpts=PTS-STARTPTS, scale=960×540 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=960×540 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=960×540 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=960×540 [lowerright]; [base] [upperleft] overlay [tmp1]; [tmp1] [upperright] overlay=x=960 [tmp2]; [tmp2] [lowerleft] overlay=y=540 [tmp3]; [tmp3] [lowerright] overlay=x=960:y=540” -c:v libx264 vid1234.mp4
The original recipe had “shortest=1” against each of the “overlay” statements but I want my final video to be the length of the longest video not the shortest. Since “longest” is default I simply removed the “shortest=1” but what I’m now seeing is that this basically runs for ever (presumably because of the “nullsrc” input) or until I hit ‘q’.
How can I specify that I want my final video to be the length of the longest of the videos excluding the “nullsrc” input?
Thanks in advance for any help on this!