<p>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.</p>

<pre><code>ffmpeg -i test-10s.mp4 -vf "zoompan=z='zoom+0.001'" zoompan-10s.mp4
</code></pre>

<p>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.</p>

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

<p><a href="https://stackoverflow.com/questions/29432393/how-to-create-zoom-in-effect-using-ffmpeg">Someone else reported</a> success using this method but for me it just outputs a video identical to the input video.  I also tried upping the multiplier to <code>100</code>, and adding <code>,scale=640x360</code> to the end of the filter string, with identical results.</p>

<p>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. </p>

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

<h3>UPDATE</h3>

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

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

<p>Example:</p>

<pre><code>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
</code></pre>

<p>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).</p>

CC BY-SA 3.0
2016-05-27T10:33:08.793Z
Which version of ffmpeg are you using? There was a bug with the zoompan filters as applied to video, which was fixed recently.
Gyan
CC BY-SA 3.0
2016-05-28T01:22:19.317Z
Hmm.. aptitude says `Version: 7:3.0.0+git2~trusty`; ffmpeg says `ffmpeg version N-80026-g936751b`.  3.0.0?  [Looks like](https://ffmpeg.org/download.html) current version is 3.0.2.  Any idea how recently that bug was fixed?
intuited
CC BY-SA 3.0
2016-05-28T07:35:58.867Z
Looks like that bug was something else. I'll ping the author of the filter.
Gyan
CC BY-SA 3.0
2016-05-31T04:42:33.573Z
Technically, you should use `pzoom` to animate a video zoom, but it doesn't work here.
Gyan
<ffmpeg>
How to produce a zoom animation of a video source with ffmpeg?
intuited
# How to produce a zoom animation of a video source with ffmpeg?

(Asked by: username_0 on 2016-05-27)

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).

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Which version of ffmpeg are you using? There was a bug with the zoompan filters as applied to video, which was fixed recently.  
> **username_0**: Hmm.. aptitude says `Version: 7:3.0.0+git2~trusty`; ffmpeg says `ffmpeg version N-80026-g936751b`.  3.0.0?  [Looks like](https://ffmpeg.org/download.html) current version is 3.0.2.  Any idea how recently that bug was fixed?  
> **username_1**: Looks like that bug was something else. I'll ping the author of the filter.  
> **username_1**: Technically, you should use `pzoom` to animate a video zoom, but it doesn't work here.  

---

## 0 answers

