Thursday 22 March 2018

Zoom video using ffmpeg commands


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


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



Answer



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).


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...