


To crop a portion of a video using FFmpeg, the command looks like this:įfmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4 At its core is the FFmpeg command line program, which can be used for transcoding, basic editing, video scaling, and post-production effects. FFmpeg is a free and open-source project consisting of various libraries and programs for handling video, audio, and other multimedia files and streams. To be able to use these commands, you'll need to have FFmpeg installed on your system. This is possible because the same commands can also be used to crop. This can be done like this: ffmpeg -i in.mp4 -filter:v "crop=in_w:480" out.For each example command, the image is cropped using the actual FFmpeg crop command from that example, so you can see exactly what happens when using it. Once you get the video, it may be bigger than the expected 720x480 since you let ffmpeg compute the height, so you’ll have to crop it.

So you could type: ffmpeg -i in.mp4 -vf scale=720:-2 out.mp4 Actually, -2 is a better choice since the computed value should even. You can set the width or height to -1 in order to let ffmpeg resize the video keeping the aspect ratio. With a reasonably recent ffmpeg, you can resize your video with these options: ffmpeg -i in.mp4 -vf scale=720:480 out.mp4 I’m no ffmpeg guru, but this should do the trick.įirst of all, you can get the size of input video like this: ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width in.mp4
