I'm trying to apply the effect fade in and zoom/scale image for X seconds. I don't have problems with fade in but how to achieve effect to scale image during X seconds when the first frame is no image and then is zoom in on that image? I think that gif says more than my description.

enter image description here

I thought that upscale video 2x and image 2x and then zoom in will do it but the effect wan not as above in my gif.

Here is my command to fade in image:

ffmpeg -i file.mp4 -loop 1 -i image.jpg -t 5 -filter_complex "[1:v]format=rgba,fade=t=in:d=5:alpha=true:st=0[im];[0:v][im] overlay=x=10:y=10:enable='between(t,0,5)'" out.mp4

1 Answer 1



ffmpeg -i file.mp4 -i image.jpg -filter_complex "[1:v]pad=iw*2:ih*2:(ow-iw)/2:(oh-ih)/2:c=black@0,zoompan='1+on/125':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2':d=125:s=WxH,format=gbrap,fade=t=in:d=5:alpha=true:st=0[im];[0:v][im] overlay=x=10:y=10:enable='between(t,0,5)'" out.mp4

The image is padded to double width and height with the padding colour being transparent black. Then zoompan is used to zoom in over 125 frames (5 seconds). This result is overlaid on the video.

You have to replace W and H in the zoompan filter with the dimensions of your image.

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.