1

I'm trying to concat two videos, side by side, using ffmpeg. One of them is 1280x720, and the other 1920x1080. One will be left, one will be right side. The higher resolution will be resized to the lower resolution one.

What is the command to do that?

I tried this command (they used 4 videos, I tried to edit it for 2), but somewhere is wrong and it cuts the first video:

ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=720" -c:v libx264 output.mp4
1

Use

ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=x=720" -c:v libx264 output.mp4

The shortest should be applied only to the first overlay.

Also, you can skip scale for the video which is already 1280x720. This output will only audio from one of the inputs.

  • Your command gives me the same output as before! Did you forget to change anything?! – Tina J Nov 7 '18 at 15:44
  • Command corrected. – Gyan Nov 7 '18 at 15:47
  • No still not working. I guess x=1280 for shortest which works now. – Tina J Nov 7 '18 at 15:48
  • Heh. I did not check your co-ordinates. – Gyan Nov 7 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.