<p>pad to square 1920x1920, then zoom to divisible by 2 value:</p>
<pre><code>ffmpeg -loop 1 -t 5 -r 30 -i img.jpg -vf &quot;
format=yuv444p,
pad=1920:1920:-1:-1,
zoompan=z='trunc(iw*10*(1+0.0015*in)/2)*2/(iw*10)'
:d=1
:x='iw/2-iw/zoom/2'
:y='ih/2-ih/zoom/2'
:s=1920x1920
:fps=30,
crop=1080
&quot; out.mp4
</code></pre>
<p>tested with jpg only</p>

CC BY-SA 4.0
2024-04-13T11:50:03.607Z
2024-04-13T11:50:03.607Z
Баяр Гончикжапов
<p>I'm trying to apply a smooth zoom effect to my 5-second video using FFmpeg, but I'm encountering a shaky/jittery zoom.</p>
<p>Here's the command I'm using:</p>
<pre><code>ffmpeg -i island_zoom.mp4 -vf &quot;zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=1080x1920:fps=30&quot; -preset ultrafast output_zoom.mp4
</code></pre>
<p>Input: <a href="https://streamable.com/jd6xmt" rel="nofollow noreferrer">island_zoom.mp4</a></p>
<p>Output: <a href="https://streamable.com/an92ei" rel="nofollow noreferrer">output_zoom.mp4</a></p>
<p>I am aware of the <a href="https://trac.ffmpeg.org/ticket/4298" rel="nofollow noreferrer">ffmpeg bug #4298</a>. According to the comments, it's possible to upscale the resolution before applying the zoom, for example, using scale=8000x4000 before the zoompan filter. However, I'm trying to avoid this approach because I have a large number of videos to process, and adding this extra scaling step would significantly increase the processing time.</p>
<p>Can anyone suggest an effective workaround? Thanks for help!</p>

<ffmpeg><video>
ffmpeg: smooth zoompan with no jiggle
Kataklycm
# ffmpeg: smooth zoompan with no jiggle

(Asked by: username_0 on 2024-04-12)

I'm trying to apply a smooth zoom effect to my 5-second video using FFmpeg, but I'm encountering a shaky/jittery zoom.
Here's the command I'm using:
ffmpeg -i island_zoom.mp4 -vf "zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=1080x1920:fps=30" -preset ultrafast output_zoom.mp4

Input: island_zoom.mp4
Output: output_zoom.mp4
I am aware of the ffmpeg bug #4298. According to the comments, it's possible to upscale the resolution before applying the zoom, for example, using scale=8000x4000 before the zoompan filter. However, I'm trying to avoid this approach because I have a large number of videos to process, and adding this extra scaling step would significantly increase the processing time.
Can anyone suggest an effective workaround? Thanks for help!

**Tags:** ffmpeg, video


---

## 1 answers

### Answer by username_1 on 2024-04-13. Score: 0

pad to square 1920x1920, then zoom to divisible by 2 value:
ffmpeg -loop 1 -t 5 -r 30 -i img.jpg -vf "
format=yuv444p,
pad=1920:1920:-1:-1,
zoompan=z='trunc(iw*10*(1+0.0015*in)/2)*2/(iw*10)'
:d=1
:x='iw/2-iw/zoom/2'
:y='ih/2-ih/zoom/2'
:s=1920x1920
:fps=30,
crop=1080
" out.mp4

tested with jpg only


---

