I need to zoom to a special point of an image. What do i have to change in this existing Script for example Y:81% X:27%?

 ffmpeg -r 25 -i image.jpg -vf 
 -y -shortest -c:v libx264 output.mp4 -y

Image Example

1 Answer 1



ffmpeg -i image.jpg \
       -vf "zoompan=z='min(zoom+0.01,2.5)':x='iw/2-iw*(1/2-27/100)*on/150-iw/zoom/2':y='ih/2-ih*(1/2-81/100)*on/150-ih/zoom/2':d=150" \
       -c:v libx264 output.mp4 -y

150 is the duration of the zoom (and the movie), and it zooms from the centre to the target point. zoompan won't generate smooth motion if the animation is short, so consider increasing the length.

  • Seems to work, but even with higher duration not smooth . i tried to change all "150" nums with 400, but even uglier then before :-(
    – S. Kr.
    Oct 14, 2018 at 19:59
  • You did change on/150 to on/400?
    – Gyan
    Oct 14, 2018 at 20:00
  • yes, like you described... youtu.be/Qjn1LlLUZqM
    – S. Kr.
    Oct 14, 2018 at 20:17
  • Ok i just upscale it with no jiggle effect: ffmpeg -i image.jpg -vf \"scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':x='iw/2-iw*(1/2-88/100)*on/150-iw/zoom/2':y='ih/2-ih*(1/2-94/100)*on/150-ih/zoom/2':d=150\" -c:v libx264 -t 5 -s \"800x450\" output.mp4 -y
    – S. Kr.
    Oct 14, 2018 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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