Cut and crop videos with AVconv

film reel

AVconv is part of the Libav converter that converts both audio and video. The best part is it can even process video/audio streams live. I have already written about how to use Libav package to create a GIF images from videos. In this article we’ll take a look at how to cut and crop videos with AVconv.

Getting started:

You need to first download and install Libav package, if you don’t already have this on your computer. You can check this link to get downloads for linux and windows. But I am going to list the Windows installer here, http://win32.libav.org/releases/

There you can find the most recent updated one on the top for both 32 and 64 bit Windows. Download and install it.


Cutting videos:

That is the command you need to type in to get a cut portion of a video. The parameters are,

-i is input file name, followed by the file name present in the same directory, in this case its, input.avi.

-ss is starting time to initialize the cut.

-t is the time duration of the video at which you need to stop cutting. It’s not to be confused with the ending position. It is duration from the starting point of the video. Say if your starting position is at 1:03 and you want it to cut at 2:45, you need to enter the difference 1:42 and not 2:45.

-codec copy specifies that the output video is not to be re-encoded.

That’s it, you have a video cut to the starting and ending position you want.

Cropping videos:

This is the command you’d enter to get a cropped video output, the parameters are,

-i is input file name, followed by the file name present in the same directory, in this case its, input.avi.

-vf is used to specify a selection, say a rectangle to be used from the input video to process.

crop=out_w:out_h:x:y, this format is to crop the selection from the input. out_w is the output’s width and out_h is the output’s height and x and y are the selection to be cropped. So in the example above the cropped video will be 720px X 600 px but aligned from top at 360px. The remaining areas before the 0px X  360px are removed.

There you have it the cropped video.

 

(image credit: Pixabay)

Leave a Reply

Your email address will not be published. Required fields are marked *