
If x and y are not specified, the command will default to start cropping from the center.
"crop=w:h:x:y" specifies that we are using the crop video filter where w is the width you want after cropping the image, h is the height of the cropped image, x is the horizontal position from where the cropping starts and y is the horizontal position from where the image cropping starts. -vf specifies we are using a video filter. -i is the input parameter and input.png is the input image that we want to crop. ffmpeg -i input.png -vf "crop=w:h:x:y" input_crop.pngįirst, we will take a look at what each of these parameters means to help us better understand how to use this tool. The same command can be used to crop videos after minor tweaks so pay attention to what each parameter in it represents. Below mentioned is the command that is used to crop images. Cropping Images using FFmpegįFmpeg tool can be used to crop images. So if you pay attention to how to crop photos using FFmpeg, you will not have a hard time understanding videos. Bear in mind that the command for cropping images and videos is almost the same. Now let’s take a brief look into how to crop images using the FFmpeg tool and then we will dive right into the video. To install FFmpeg tool on Redhat/ Centos Linux systems run the following command: yum localinstall Debian-based Linux Distributionsįor Debian-based Linux distributions run the below script to install FFmpeg: sudo apt install ffmpeg Redhat/ Centos based Linux In this tutorial we’ll quickly mention how to install it on Linux.
Note: You can install FFmpeg on Linux, Windows or Mac OSX. Cropping black borders using the FFmpeg toolįirst, we will take a look at the command to install the FFmpeg tool.