8

I'd like to create a zoom-in animation over numerous frames of a video clip. I've tried a couple of approaches without much luck.

ffmpeg -i test-10s.mp4 -vf "zoompan=z='zoom+0.001'" zoompan-10s.mp4

The resulting file zooms in over 10s on a still of the first frame of the video, then goes all the way out and zooms back in on another still, presumably the second frame.

ffmpeg -i test-10s.mp4 -filter_complex "crop=(640-(n*10)):(360-(n*10))" crop-100-fc.mp4

Someone else reported success using this method but for me it just outputs a video identical to the input video. I also tried upping the multiplier to 100, and adding ,scale=640x360 to the end of the filter string, with identical results.

I've tried this on my Linux PC running what appears to be version 3.0.0 and also on my Android phone running version 3.0.2 under Termux. Same results.

How can I create this effect with ffmpeg? I'd like to zoom in over 10 seconds.

UPDATE

I've managed to make it zoom in over video, albeit shakily. Some discoveries/hypotheses:

  • It seems to treat a video input file as simply a series of images, applying the filter to each one
  • Setting the filter parameter d=1 causes each frame/image to be mapped to a single new frame. The filter is then enacted once for each frame.
  • The in variable can be referenced to create an effect that changes more or less steadily across frames.

Example:

ffmpeg -i test-10s.mp4 -vf "zoompan=z='1+(1.4*in/300)':x='70*in/300':y='190*in/300':d=1" zoompan-001-in-d1.mp4

There are about 300 frames in the example input video. The output file zooms from 1:1 to a zoom factor of 2.4 while panning to a top left corner position of (70, 190).

  • Which version of ffmpeg are you using? There was a bug with the zoompan filters as applied to video, which was fixed recently. – Gyan May 27 '16 at 10:33
  • Hmm.. aptitude says Version: 7:3.0.0+git2~trusty; ffmpeg says ffmpeg version N-80026-g936751b. 3.0.0? Looks like current version is 3.0.2. Any idea how recently that bug was fixed? – intuited May 28 '16 at 1:22
  • 1
    Looks like that bug was something else. I'll ping the author of the filter. – Gyan May 28 '16 at 7:35
  • 1
    Technically, you should use pzoom to animate a video zoom, but it doesn't work here. – Gyan May 31 '16 at 4:42
  • pzoom usage have been fixed. – Paul B. Mahol Sep 14 '16 at 10:57

Your Answer

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

Browse other questions tagged or ask your own question.