1

I have 2 videos of the same resolution, but I need to crop one of them and then merging them side by side, so that general height would be equal of height of non cropped video. I.e. they should look the same size after merge. Just cropped video should look like it zoomed in.

I tried to do that, but uncropped video being cropped during merge.
I cropped like that:

ffmpeg -i L.MOV -filter:v "crop=in_w-28:in_h-28" -c:a copy LC.MOV

Then merge which crops right video:

ffmpeg -i LC.MOV -i R.MOV -filter_complex '[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast LCR.MOV

Here I drew what I need: enter image description here

And here what I'm getting: enter image description here

2

Use

ffmpeg -i L.MOV -i R.MOV -filter_complex '[0:v]crop=in_w-28:in_h-28,scale=640:480,setsar=1,pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast LR.MOV

Since you want a zoomed-in effect, after cropping, you should rescale it back to 640x480. Your crop dimensions are disproportionate to the input dimensions so I have reset SAR to 1. You can skip this if you apply crop=in_w-28:in_h-21.


To apply the crop to the right video, use

ffmpeg -i L.MOV -i R.MOV -filter_complex '[1:v]crop=in_w-28:in_h-21,scale=640:480[int];[0:v]pad=iw*2:ih[left];[left][int]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast LR.MOV
  • I forgot that height not equals width. Thanks a lot. – R S Apr 17 '18 at 17:54
  • How to rewrite command if I would need to crop right one instead of left (I can't figure that out) ? – R S Apr 17 '18 at 20:45
  • Replace first [0:v] with [1:v] and [int][1:v] with [0:v][int] – Gyan Apr 18 '18 at 5:33
  • it crops both videos by half. – R S Apr 18 '18 at 8:50
  • 1
    Use my new command in answer. – Gyan Apr 18 '18 at 10:34

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.