Is it possible to zoom a video and save it using ffmpeg commands?

I searched a lot but I did not find any solution.

  • 4
    Yes it is possible to zoom. Does that help? Your questions are too vague. They cannot be answered unless you are more specific.
    – Rajib
    Dec 6, 2013 at 13:01

1 Answer 1


Zooming is a two step process. You want to:

  1. Scale the video by a factor of your choice.
  2. Crop the video back to its original size.

That'd look something like this, e.g. to zoom in with a factor of 2, assuming an input video of 1280×720 pixels:

ffmpeg -i input.mp4 -vf "scale=2*iw:-1, crop=iw/2:ih/2" output.mp4

Of course, you can change the factor here. The -1 means that the height will be set automatically.

You can use two additional parameters for the crop filter to set the position of the cropping window.

Have a look at the x264 encoding guide if you need to change the output quality (it will be reduced compared to the original, of course).

  • scale=2*iw:-1,crop=iw/2:ih/2 could be used for 2x zoom.
    – llogan
    Dec 10, 2013 at 0:36
  • Slhck thanks for ypur reply. That command is working perfectly, but where can I change the amount of zooming, and how can I use this command for zoo out?.
    – Gururaj
    Dec 10, 2013 at 11:25
  • @Gururaj I mentioned that in my example the factor would be 2, so you simply have to choose another factor. I'm not sure if zooming out is that easily accomplished with a factor between 0 and 1. I can't try it now.
    – slhck
    Dec 10, 2013 at 11:38
  • slhck I am getting some bars on video after zooming.
    – Gururaj
    Dec 12, 2013 at 5:38
  • @Gururaj If there's an issue with the command, you should probably post a new question, mention exactly what command you're using, and show the full, uncut command line output. Note that if you want to zoom out you have to scale down first and then pad the output.
    – slhck
    Dec 12, 2013 at 8:40

You must log in to answer this question.

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