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????

1 Answer 1

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.

3
  • How would I combine the zoompan and blend filters in the -filter_complex?
    – jrkt
    Commented Sep 24, 2016 at 19:11
  • I've got a -filter_complex built from this post, superuser.com/questions/833232/… 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
    Commented Sep 26, 2016 at 17:30
  • I've opened a question about the above question and how to add the zoompan and blend filters into one command superuser.com/questions/1128563/…. I could really use some help.
    – jrkt
    Commented Sep 27, 2016 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .