How to Use FFmpeg crop videos [Step by Step Guide]

How can I remove black bars from videos? Can I crop videos for YouTube/Tik Tok/Instagram automatically?

Try this best AI-Based Video Cropper for Windows/Mac to auto reframe/resize/crop video to suit different social platforms.

Ffmpeg is a cross-platform project that comes with several libraries and programs that can handle your multimedia files. This free and open-source tool can be used for cropping and other tasks like transcoding, scaling, and more. Being a command-line tool, the process of video cropping using Ffmpeg is different from other tools. Keep reading to know how FFmpeg crop video.

Part 1. How to install FFmpeg on Windows 10/8/7 / Mac

Before you start cropping your videos using Ffmpeg, you need to install the program. Being a command-line tool, its installation is different from the other graphical interface software.

Steps to install Ffmpeg on Windows 10/8/7

Step 1. From the official FFmpeg website download, the latest Ffmpeg build. You can choose from a 32-bit version or a 64-bit version depending on your system. Tap on the Download button to start the process of downloading.

Step 2. To make Ffmpeg work on your Windows 10 system, a program to the system path using Environment Variables has to be added.

Step 3. Go to the downloaded folder where the zip file of Ffmpeg is saved. Right-click and choose extract.

Step 4. Again right-click on the extracted folder and tap Rename from the list with the name- FFmpeg-20180424-d9706f7-win64-static to FFmpeg.

Step 5. Next, copy the FFmpeg folder and paste the folder to the root of the C drive.

Step 6. No to use the Command Prompt of FFmpeg, added the bin folder having FFmpeg executable file to the path of Windows path.

Step 7. Move to the Advanced button and tap on Environment Variables.

Step 8. Choose the variable Path and tap on Edit to change the Path variable.

Step 9. Tap on the New and enter the path "C:\ffmpeg\bin\" and then confirm by hitting the OK button.

Step 10. As per the drive or the folder where your FFmpeg folder is saved, enter the path directory.

Step 11. The path will now be added to the Environment variables and to apply all the changes, click on OK.

Now finally to ensure if the FFmpeg is installed, type FFmpeg in the command prompt terminal and Enter. The details of the FFmpeg will be displayed by the command prompt.

Steps to install FFmpeg on Mac

FFmpeg on your Mac system can be installed using Homebrew which is a package manager for the Mac systems. The steps are as below.

Step 1. Install the Homebrew on your Mac system.

Step 2. Using the ffmpeg formula: brew install ffmpeg install the program.

Step 3. Multiple dependencies like x264 and others will be downloaded as well.

Step 4. Updating the ffmpeg can be done later- run: brew update && brew upgrade ffmpeg.

Part 2. How can I crop a video with FFmpeg?

After the FFmpeg program is successfully installed, FFmpeg crop video process can be done using the following command.

crop a video with FFmpeg 1

The above command will crop the video to the left side using the first 1920 X 1080 pixels.

crop a video with FFmpeg 2

Other options that can be used are as follows:

Some other options are:

  • For cropping 80×60 section, from the position (200, 100):

ffmpeg -i in.mp4 -filter:v "crop=80:60:200:100" -c:a copy out.mp4

  • For cropping bottom right quarter, following command can be used

"ffmpeg -i in.mp4 -filter:v "crop=in_w/2:in_h/2:in_w/2:in_h/2" -c:a copy out.mp4"

"ffmpeg -i in.mp4 -filter:v "crop=320/2:240/2:320/2:240/2" -c:a copy out.mp4"

"ffmpeg -i in.mp4 -filter:v "crop=160:120:160:120" -c:a copy out.mp4"

  • To crop 20 pixels from the top and the bottom, following command can be used.

ffmpeg -i in.mp4 -filter:v "crop=in_w:in_h-40" -c:a copy out.mp4

Part 3. An Easy Alternative to FFmpeg Crop You Should Know

FFmpeg can crop the videos, but the process is very complicated as you need to have a thorough knowledge of all the commands. Moreover, the changes made to the file cannot be previewed. Thus, to overcome these issues, Wondershare UniConverter is an easy alternative. Available for Windows and Mac, this professional software can be used for cropping videos without losing quality. A few clicks in a simple process and your video is ready.

You can choose the aspect ratio, target format, and even rotate the files. The latest version of the software has introduced a new Auto Reframe function where the videos can be automatically cropped based on your selection of Aspect Ratio.

wondershare uniconverter 13

Wondershare UniConverter — All-in-one Video Toolbox for Windows and Mac.

safe mov video converter free download Security Verified. 3,591,664 people have downloaded it.

Crop videos in lossless quality.

Choose the aspect ratio as desired.

Preview the edited files to check if the results are as per your requirements.

Supports a wide range of additional features like cutting, adding effects, watermark, and more.

Conversion in more than 1000 formats and devices supported.

Auto-Reframe function to crop the videos automatically based on the aspect ratio.

Steps for manual video cropping using Wondershare UniConverter

Step 1 Launch Wondershare Crop function and add video

Open the software on your system and from the Toolbox section click on the Crop function. Browse and select the video that has to be cropped.

Launch Wondershare Crop function and add video

Step 2 Crop and edit the video

After the video is added, an editing window will open. Here you can enter the Crop Area Size in terms of width and height or you can even drag the corners of the added video frame to adjust the needed area.

As you make the changes, the preview at the Output Preview window can be checked. Select the desired aspect ratio from its drop-down menu. Clicking on OK will confirm the changes.

Crop and edit the video

Step 3 Choose the target format and process video

At the Output Format tab, choose the desired target format from the sported list. File Location tab can be browsed to select the folder for saving the processed video. Finally, click on the Start All button to start the processing and crop the video.

Choose the target format and process video

Advanced Auto Reframe

The latest version of Wondershare UniConverter has a new Auto Reframe function where you can simply choose the Aspect Ratio and the videos will be cropped accordingly. Motion Speed can also be selected as required.

Auto Reframe

Part 4. Is it possible to auto crop the black borders of a video with FFmpeg?

To auto-crop the black borders of the videos using FFmpeg, the following command can be used:

@ffmpeg -skip_frame nokey -y -hide_banner -loglevel 32 -stats -i "%1" -vf cropdetect -an -f null -

An easier alternative here is to use Wondershare UniConverter's Auto Reframe function where you can simply choose the Aspect Ratio and the black borders will be removed automatically.

TRY IT FREE TRY IT FREE

Camera video tips

Full Video, Audio and Image Solutions for Camera Users

Still struggling with your shooting 4K video won't play on other devices or playing with audio and video out of sync? Wondershare UniConverter helps you out! Find your issues and get the full answer now.

You may also like
How to Make TikTok Compilation Videos for YouTube

Looking for tips on How to Make TikTok Compilation Videos for YouTube? Don't worry; you're at the right place because this article will teach you how!

Auto Reframe

Other popular articles from Wondershare