How To Zoom In And Zoom Out Movies Utilizing FFmpeg
FFmpeg is an opensource, highly effective audio and video converter. Utilizing FFmpeg, we are able to encode, decode, transcode, mux, demux, document, resize, stream, filter, and play nearly all sort of media recordsdata. Not solely that, we are able to additionally seize dwell audio/video stream as properly. FFmpeg ships with a numerous filters to carry out totally different duties. One of many lesser recognized, but helpful filter is zoompan. Utilizing zoompan filter, we are able to simply zoom in and zoom out movies in Linux. Let me present you the way to do this utilizing an instance command.
Ensure you have put in FFmpeg in your Linux machine. We’ve got documented the steps to put in FFmpeg on well-liked Linux working techniques within the following hyperlink.
As soon as FFmpeg is put in, go to the placement the place you’ve got saved the video and run the next command to zoom in and zoom out it each X seconds:
$ ffmpeg -i enter.mp4 -vf “zoompan=z=’if(lte(mod(time,10),3),2,1)’:d=1:x=iw/2-(iw/zoom/2):y=ih/2-(ih/zoom/2):fps=30” output.mp4
The above command will zoom in towards the middle of the video to 2x zoom for the first 3 seconds of each 10 second block of time. Exchange enter.mp4 together with your filename. Additionally alter the values as per your requirement and set the FPS for the filter to match the enter. The default worth is 25.
You’ll find the FPS particulars amongst different particulars of a given video utilizing the next command:
$ ffmpeg -i enter.mp4
Discover FPS worth of a video utilizing ffmpeg
Right here is the precise enter video earlier than conversion:
And, right here is the transformed (zoom-in-out) video:
Did you discover the distinction? The video is zoomed in to 2X for the primary 3 seconds after which it went again to regular (zoom out). At precisely tenth second, the video is once more zoomed in for the primary 3 seconds and the cycle continues until the video ends.
You can too strive the next zoompan settings given within the FFmpeg zoompan filter assist part.
Zoom in as much as 1.5x and pan at similar time to some spot close to middle of image:
Zoom in as much as 1.5x and pan at all times at middle of image:
Similar as above however with out pausing:
Zoom in 2x into middle of image just for the primary second of the enter video:
For extra FFmpeg command examples, refer the next information:
Hope this helps.