1

Any ideas on the proper syntax to get crop to work with resizing and overlay all in one go?

The crop parameters are crop=1728:970:96:54 and I'm trying to work them into:

ffmpeg -loop 1 -i backgroundimage.png -i INPUTVIDEO.MP4 -filter_complex "[1]scale=1612:906[inner]overlay=154:170:shortest=1[out]" -map "[out]" -map 1:a -c:a copy -y -b:v 2000k -b:a 192K OUTPUT.MP4
2
  • Which input do you want to crop? backgroundimage.png or INPUTVIDEO.MP4. Where in the filtergraph should the crop occur? In other words, in which order should it occur? (Not immediately after crop obviously due to the crop being larger than the scale parameters.)
    – llogan
    Apr 17 '20 at 18:11
  • INPUTVIDEO.MP4 needs to be cropped. This example is taking INPUTVIDEO.MP4 and shrinking it down and placing it on top of the backgroundimage.png. Unfortunately, I need to crop according to the settings shown INPUTVIDEO.MP4 before dropping it onto the background. I realize the scaling will have to change to something else which I can figure out afterwards - it was just the ability to crop, resize and overlay in one go that I was wondering about. Thanks!
    – Dot Matrix
    Apr 17 '20 at 20:10
2

To crop before scaling INPUTVIDEO.MP4:

ffmpeg -y -loop 1 -i backgroundimage.png -i INPUTVIDEO.MP4 -filter_complex "[1]crop=1728:970:96:54,scale=1612:906[inner];[0][inner]overlay=154:170:shortest=1[out]" -map "[out]" -map 1:a -c:a copy -b:v 2000k OUTPUT.MP4
1
  • That was perfect - Thank you llogan!
    – Dot Matrix
    Apr 17 '20 at 22:17

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.