What i have :

png picture dem.png (not transparent) and video cat.mp4. I need to put this png as a background to video with resizing video inside.

Current result :

enter image description here

by executing :

ffmpeg -i cat.mp4 -framerate 30 -i dem.png -filter_complex "[1][0]overlay=x=100:y=100" -c:a copy -movflags +faststart out2.mp4

How can i scale mp4 in case i know paddings/required height/width of scaled mp4 here?

Very beginner in ffmpeg. I know, i need to use scale param, but can't understand how to do it with my current ffmpeg command.

Maybe someone know how to do it?

Files are here if you need : https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing

1 Answer 1


This works like a charm :

ffmpeg -y -i cat.mp4 -framerate 20 -i dem.png -filter_complex "[0:v]scale=512x397,setsar=1[v0];[1][v0]overlay=x=45:y=45" -c:a copy -movflags +faststart out2.mp4

Result will be :

enter image description here

If anyone can step-by-step describe what each part of command do - will appreciate!

Your Answer

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

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