You can do this with ffmpeg using the zoompan
filter. You'd need to figure out a complex mathematical expression that will calculate the required zoom (z
value) and pan (x
and y
values) for any given point in time.
You can see concrete examples in this blog entry:
ffmpeg -i in.jpg \
-filter_complex
"zoompan=z='zoom+0.002':d=25*4:s=1280x800" \
-pix_fmt yuv420p -c:v libx264 out.mp4
It quickly gets complicated when adding more pictures and transitions, e.g. for a one-second transition:
ffmpeg -i in1.jpg -i in2.jpg \
-filter_complex
"color=c=black:r=60:size=1280x800:d=7.0[black]
[0:v]format=pix_fmts=yuva420p,zoompan=d=25*4:
s=1280x800,fade=t=out:st=3.0:d=1.0:alpha=1,
setpts=PTS-STARTPTS[v0];[1:v]format=
pix_fmts=yuva420p,zoompan=d=25*4:s=1280x800,
fade=t=in:st=0:d=1.0:alpha=1,setpts=PTS-
STARTPTS+3.0/TB[v1];[black][v0]overlay[ov0];
[ov0][v1]overlay=format=yuv420" \
-c:v libx264 out.mp4
The author therefore posted a Ruby script to automate this process.
I also found diascope
, which is a dedicated tool for creating slideshows from the command line. It has a Ken Burns style feature. The code hasn't been updated in a while – I hope it works with recent ffmpeg. Haven't been able to try it yet.
1The effect you're looking for is called Ken Burns. – Tetsujin – 2017-08-08T09:11:35.107