Video – ffmpeg: smooth zoompan with no jiggle

I’m trying to create a basic 5 second zoompan to the center of an image (from the example on the ffmpeg.org website). The command below works, but jitters more than my hands after 5 cups of coffee:

ffmpeg -framerate 25 -loop 1 -i island.jpg -filter_complex "[0:v]scale=-2:480,zoompan=z='min(zoom+0.0015,1.5)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d=125,trim=duration=5[v]" -map "[v]" -y out.mp4

Input jpg.  Output mp4.

I’m aware of the ffmpeg bug #4298. The posted suggested workaround is to use the scale filter prior to zoompan. But as shown in my example, this still seems to have no effect.

It seems any arbitrary x or y values cause the jiggle/jerky/shaky effect.

Can anyone offer any kind of effective workaround?  Thanks!

Version info:

ffmpeg version 3.1.2-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers  built with gcc 5.4.0 (Debian 5.4.0-6) 20160609

Solution:

Avoid downscaling beforehand. Either apply a trunc function to the x and y expressions. Or upscale it before. Preferably the latter. This gets rid of most of the jitter for me.

ffmpeg -framerate 25 -loop 1 -i island.jpg -filter_complex "[0:v]scale=8000x4000,zoompan=z='min(zoom+0.0015,1.5)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d=125,trim=duration=5[v]" -map "[v]" -y out.mp4

Basically, the filter is rounding the values from the x and y expressions, which may be either rounded up or down. That’s creating an uneven motion due to changes in direction of pan. Increasing the resolution beforehand allows the rounding to be smaller.