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.
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=1causes each frame/image to be mapped to a single new frame. The filter is then enacted once for each frame.
invariable can be referenced to create an effect that changes more or less steadily across frames.
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).