1

I have many videos and I need to put an image in them for about 20 seconds, I am adding them manually and it works fine if only the image is small in size.... please, help me out to set height and width on the image

The original command is this

ffmpeg -i in.mkv -i 3.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause

But it give me output as these image below

Image - 1 Image - 2

1

1 Answer 1

4

You can add a scale filter. This will scale the image to 50x50:

ffmpeg -i in.mkv -i 3.png -filter_complex "[1]scale=50:50[b];[0][b] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause

If you want to scale the width or height and maintain the aspect ratio, use -1. For example, this scales the width to 50 and the height according to the aspect ratio.

scale=50:-1

Conversely, this scales the height to 50 and the width is adjusted by aspect ratio.

scale=-1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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