Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques using nullsrc + overlay to make a 2×2 multi-screen video – how can I set length to longest of the 4 input videos?

  • using nullsrc + overlay to make a 2×2 multi-screen video – how can I set length to longest of the 4 input videos?

    Posted by Alec Turner on August 16, 2017 at 12:16 pm

    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!

    Gyan Doshi replied 8 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Gyan Doshi

    August 17, 2017 at 10:14 am

    Keep the shortest=1 in the first overlay filter i.e. [base] [upperleft] overlay=shortest=1 [tmp1]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy