How to Generate video with zoom and image movement from one still image?

1

I want to generate a video [let's say 1000x600] from a 1000x600 image.

The image has to zoom initially by double(2000x1200) from centre point and than to scroll to top left corner, again to centre point again to top right corner and so on.

I also need accelerator effect if possible.

I cannot find any documentation on this subject; could anyone give me a hint?

Jignesh Ansodariya

Posted 2017-08-08T08:49:02.040

Reputation: 111

1The effect you're looking for is called Ken Burns. – Tetsujin – 2017-08-08T09:11:35.107

Answers

3

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.

slhck

Posted 2017-08-08T08:49:02.040

Reputation: 182 472