10/11/2025
Crop videos with FFmpeg using exact dimensions, center crops, 16:9 crops, and square crops. Includes commands, crop syntax, and common troubleshooting tips.
How to Crop a Video Using FFmpeg
Use the FFmpeg crop filter when you need to remove black bars, crop a vertical video, make a square clip, or keep only a specific part of the frame.
For a form-based builder, use the FFmpeg crop video tool. For copyable commands, start below.
Basic Crop Command
ffmpeg -i input.mp4 -vf "crop=640:480:100:50" -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4
The crop syntax is:
crop=width:height:x:y
In the example above, FFmpeg keeps a 640x480 rectangle that starts 100 pixels from the left and 50 pixels from the top.
What the Values Mean
| Value | Meaning |
|---|---|
width |
Width of the output frame. |
height |
Height of the output frame. |
x |
Horizontal offset from the left edge. |
y |
Vertical offset from the top edge. |
The top-left corner of the original video is x=0:y=0.
Center Crop
You can use expressions instead of manually calculating offsets. This command crops a centered 1280x720 area:
ffmpeg -i input.mp4 -vf "crop=1280:720:(in_w-1280)/2:(in_h-720)/2" -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4
in_w is the input width and in_h is the input height.
Crop to 16:9
For a centered 16:9 crop from a larger video:
ffmpeg -i input.mp4 -vf "crop=1280:720:(in_w-1280)/2:(in_h-720)/2" -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4
If your source is not large enough for 1280x720, choose smaller dimensions such as 960x540.
Crop to Square
This command crops the largest possible centered square:
ffmpeg -i input.mp4 -vf "crop=min(in_w\,in_h):min(in_w\,in_h):(in_w-min(in_w\,in_h))/2:(in_h-min(in_w\,in_h))/2" -c:v libx264 -crf 23 -preset medium -c:a copy square.mp4
The backslashes before commas are needed inside FFmpeg filter expressions.
Can Cropping Avoid Re-encoding?
No. Cropping is a video filter, so FFmpeg must re-encode the video stream. You can still copy the audio stream with -c:a copy.
Common Problems
The crop is in the wrong place.
Remember that x and y start from the top-left corner, not the center.
FFmpeg says the crop area is outside the input.
Make sure x + width is not larger than the input width, and y + height is not larger than the input height.
The output looks lower quality.
Use a lower CRF value such as 18 or 20, or use a slower preset.
I do not know the right crop values.
Start with a center crop or use FFmpeg's cropdetect filter as a separate workflow.
Related FFmpeg Pages
- Build a custom command with the Crop Video tool.
- See the short recipe: Crop Video to 16:9.
- Learn how to change video resolution with FFmpeg.
Related tool
Crop Video with FFmpeg
Build FFmpeg crop filter commands for dimensions, offsets, and common aspect ratios.
Open the command generator