10/11/2025
Learn the fastest way to crop a video with FFmpeg. This guide provides a direct command, a clear parameter breakdown, and practical examples for precise video cropping.
How to Crop a Video Using FFmpeg: A Quick Guide and Parameter Breakdown
Have you ever needed to remove annoying black bars from a video, or wanted to keep only a specific area of the frame? You don't need to open a heavy video editor for that. FFmpeg provides a powerful and precise command-line solution. This guide will show you how to crop your videos with ease.
🚀 Quick Path: The FFmpeg Command
To crop a video, for example, to cut a 640x480
section from input.mp4
starting at the coordinates (100, 50)
, use the following command:
ffmpeg -i input.mp4 -vf "crop=640:480:100:50" output.mp4
🧠The Breakdown: What Each Parameter Means
This command might look complex, but each part has a clear purpose. Let's break it down in a table:
Parameter | Explanation | Example |
---|---|---|
ffmpeg |
The command to start the FFmpeg program. | ffmpeg |
-i input.mp4 |
-i is short for "input," followed by your source video file. |
-i my_video.mov |
-vf |
Short for "video filter," this tells FFmpeg you're about to apply a filter to the video stream. | -vf |
"crop=w:h:x:y" |
This is the core cropping filter, with its parameters separated by colons. | "crop=640:480:100:50" |
↳ w |
width of the output rectangle. |
640 |
↳ h |
height of the output rectangle. |
480 |
↳ x |
The X coordinate for the top-left corner of the output rectangle, starting from the top-left (0,0) . |
100 (100 pixels from the left) |
↳ y |
The Y coordinate for the top-left corner of the output rectangle. | 50 (50 pixels from the top) |
output.mp4 |
The filename for your new, cropped video. | cropped_video.mp4 |
FAQ & Variations
Q: How can I crop the video from the center?
A: Absolutely! You don't need to calculate the x
and y
coordinates manually. The crop
filter in FFmpeg allows you to use variables like iw
(input width) and ih
(input height) for dynamic calculations.
To crop a 300x300
area from the exact center of the video, use this command:
ffmpeg -i input.mp4 -vf "crop=300:300:(iw-300)/2:(ih-300)/2" output.mp4
Here, (iw-300)/2
calculates the x
coordinate for centering, and (ih-300)/2
calculates the y
coordinate.