I am trying to animate an image position and scale on top of background video. Moving between frames, say, 1 and 15. And scaling from frame 24 to frame 42.
overlay filter does its job moving the image at a time well.
I'm lost with the zoompan filter. Here's my current filtergraph:
video.avi >----------------------------------->|-------|
|overlay|-> out.mp4
image.png >-> scale >-> zoompan >-> zoompan >->|-------|
Scale up the image 10 times for jitter-free zoompan. The first zoompan is set to z=1
and enabled till start of zoom (frame 24). Second zoompan increments zoom by a step to reach from 1 to 2.3 in 18 frames (24..42). I would add third zoompan to keep the image at 2.3. If second one is prolonged further it starts looping the zoom-in effect.
ffmpeg -i $FOOTAGE -loop 1 -i $IMAGE -filter_complex \
"
[1:v]
scale=10*iw:-2
,zoompan=
z=1
:d=1
:s=500x100
:enable='lt(n,24)'
,zoompan=
z='min(zoom+1.3/18,2.3)'
:x='iw/2-(iw/zoom/2)'
:y='ih/2-(ih/zoom/2)'
:d=19
:s=500x100
:enable='gte( n, 24)'
[name];
[0:v][name]
overlay=
x = '1005 - 250 + 80 - min( 80 * n / 15, 80)'
:y='406-50'
:enable='lte(n,130)'
" -t 7 -y -hide_banner out.mp4
How can zoom an image between certain keyframes somewhere in the middle of the sequence? I.e. zoom goes from 1 to 2.3 between frame A and frame B.