3

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 
"zoompan=z='zoom+0.001':x='if(gte(zoom,1.5),x,x+1)':y='y':d=125\"
 -y -shortest -c:v libx264 output.mp4 -y

Image Example

fixer1234
  • 27,064
  • 61
  • 75
  • 116
S. Kr.
  • 143
  • 1
  • 6

1 Answers1

4

Use

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.

Gyan
  • 34,439
  • 6
  • 56
  • 98
  • 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 '18 at 19:59
  • 1
    You did change `on/150` to `on/400`? – Gyan Oct 14 '18 at 20:00
  • yes, like you described... https://youtu.be/Qjn1LlLUZqM – S. Kr. Oct 14 '18 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 '18 at 20:57