5

I need to create a video with ffmpeg with various pans and zooms using the zoompan filter. I have to be able to create zoom in, zoom out, pan to, and pan from effects to all areas of the video such as: top-left, top-middle, top-right, right, bottom-right, bottom-middle, bottom-left, left, and middle. So far, I have only been able to figure out how to zoom in to a few areas, such as:

Zoom in top-left:

-vf "zoompan=z='zoom+0.001':x='if(gte(zoom,1.5),x,x-1)':y='y':d=125"

Zoom in top-right:

-vf "zoompan=z='zoom+0.001':x='if(gte(zoom,1.5),x,x+1)':y='y':d=125"

Zoom in bottom-left:

-vf "zoompan=z='min(zoom+0.0005,1.5)':y='if(gte(zoom,1.5),y,y+1)':x='x':d=125"

I have not been able to find a good resource to explain how these numbers work and how I can figure out the specific zoompan filters for all these variations.

Help????

jrkt
  • 181
  • 1
  • 1
  • 10

1 Answers1

11

The zoompan filter expressions are evaluated each frame. The variables referenced in the expressions contain the last calculated value, or the default if it's the first frame.

The value of the evaluated zoom expression represents the ratio of the resulting dimensions to the original dimensions i.e. zoom = 3 means the zoom window has a third of the width and height of the input.

x and y represent where the top-left corner of the zoom window is placed within the input image.

d is the duration in frames that the zoom is evaluated and applied.

You should, as a matter of course, specify the output framerate fps and size s of the filter (see its documentation), else the filter will apply its defaults of 25 fps and 1280x720, which may not be what you want.

For smooth zooms, you may need to upscale the image beforehand.

Eric Platon
  • 190
  • 1
  • 9
Gyan
  • 34,439
  • 6
  • 56
  • 98
  • How would I combine the zoompan and blend filters in the -filter_complex? – jrkt Sep 24 '16 at 19:11
  • I've got a -filter_complex built from this post, http://superuser.com/questions/833232/create-video-with-5-images-with-fadein-out-effect-in-ffmpeg and I can't figure out how to include the zoompan filter in it in addition to the blend filter so I can apply both at the same time. – jrkt Sep 26 '16 at 17:30
  • I've opened a question about the above question and how to add the zoompan and blend filters into one command http://superuser.com/questions/1128563/ffmpeg-create-mp4-from-images-with-blend-and-zoompan-filters. I could really use some help. – jrkt Sep 27 '16 at 14:11