<p>Use</p>

<p><code>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</code></p>

<p>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.</p>

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

CC BY-SA 4.0
2019-06-26T05:30:20.593Z
2019-06-26T05:30:20.593Z
Gyan
<p>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. </p>

<p><a href="https://i.sstatic.net/Bapji.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Bapji.gif" alt="enter image description here"></a></p>

<p>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.</p>

<p>Here is my command to fade in image:</p>

<pre><code>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
</code></pre>

<ffmpeg><scale><zoom>
ffmpeg fade in from center (with scale image)
Thaian
# ffmpeg fade in from center (with scale image)

(Asked by: username_0 on 2019-06-25)

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. 

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

**Tags:** ffmpeg, scale, zoom


---

## 1 answers

### Answer by username_1 on 2019-06-26. Score: 1 | Accepted answer

Use

`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.


---

