To crop a video with ffmpeg, run the crop video filter and tell it the output size plus where the crop box sits:
ffmpeg -i in.mp4 -vf "crop=w:h:x:y" -c:a copy out.mp4crop=w:h:x:y reads as width:height:x-offset:y-offset. The origin (0,0) is the top-left corner of the frame, x grows to the right, y grows downward. So a 500x500 crop anchored at the top-left of a 1920x1080 clip is:
ffmpeg -i in.mp4 -vf "crop=500:500:0:0" -c:a copy out.mp4The -c:a copy keeps the original audio stream untouched. I add it on every crop because crop is a video filter and ffmpeg will otherwise re-encode the audio for no reason (more on the re-encode below).
Let ffmpeg center the crop
If you give crop only a width and height and omit x:y, ffmpeg centers the box automatically. Internally it sets x = (in_w - out_w) / 2 and y = (in_h - out_h) / 2, which is exactly what you want most of the time:
# 1280x720 cut from the middle of the frame
ffmpeg -i in.mp4 -vf "crop=1280:720" -c:a copy out.mp4That covers the common case where you are trimming the edges off symmetrically and do not care about the exact offsets.
Crop relative to the input size with expressions
Hardcoding pixel values means redoing the math for every source resolution. The crop filter exposes the input dimensions as variables, so you can express the crop in terms of the frame instead. The two you reach for constantly are in_w (the input width, aliased iw) and in_h (the input height, aliased ih).
To shave 100px off the left and right (200px total) while keeping full height:
ffmpeg -i in.mp4 -vf "crop=in_w-200:in_h" -c:a copy out.mp4Because x:y are omitted the remaining strip stays centered, so you lose 100px from each side. The same idea trims top and bottom with crop=in_w:in_h-200. These commands work on a 720p clip and a 4K clip without edits, which is the whole point of writing them relative to in_w/in_h.
Crop to a square for social
Instagram and a lot of social embeds want a 1:1 square. The cleanest way to get one is to crop to the height (the shorter dimension on a landscape video) and let ffmpeg center it:
# Square crop, centered, sized to the frame height
ffmpeg -i in.mp4 -vf "crop=in_h:in_h" -c:a copy out.mp4For a fixed aspect ratio rather than a square, drive the height off the width. A centered 16:9 crop is:
ffmpeg -i in.mp4 -vf "crop=in_w:in_w*9/16" -c:a copy out.mp4If you need a specific area and not a centered one, find the offsets first. Open the clip in a player, note the pixel coordinates of the top-left corner of the region you want, and feed them as x:y. There is no preview in ffmpeg itself, so I usually crop once, eyeball the result, and nudge x/y by a few dozen pixels until it lands.
Strip black bars automatically with cropdetect
When a video has letterbox or pillarbox black bars, you do not have to measure them. The cropdetect filter scans the frames and prints a suggested crop=... string to the log. It is a metadata filter, so it does not change the video; it just reports what it would crop:
ffmpeg -i in.mp4 -vf cropdetect -f null -The -f null - discards the output (you only want the analysis). Watch the log and you will see lines ending in something like crop=1920:800:0:140. Let it run over a chunk of the video so it settles on a stable value, then copy that string into a real crop pass:
ffmpeg -i in.mp4 -vf "crop=1920:800:0:140" -c:a copy out.mp4cropdetect detects black borders by default; on a clip where the bars are not pure black you can loosen its threshold, but the default works for standard letterboxing.
Cropping always re-encodes the video
There is one expectation to reset. You cannot pair a crop with -c:v copy. Stream copy (-c copy) muxes the existing compressed frames straight through without decoding them, and a filter like crop has to decode each frame, modify the pixels, and encode them again. So a crop is always a video re-encode, which means it takes real time and you should set the quality:
ffmpeg -i in.mp4 -vf "crop=1280:720" -c:v libx264 -crf 18 -preset medium -c:a copy out.mp4-crf 18 is visually near-lossless for libx264 (lower is higher quality; the sane range is roughly 18 to 28). The audio still gets -c:a copy because cropping never touches the audio. This is the difference from a trim: a trim with -ss/-t and -c copy can be instant and lossless because it cuts on keyframes without decoding, whereas a crop cannot.
Crop and scale in one pass
Often you crop to a region and then want it at a specific output size. Chain crop and scale in the same filter graph with a comma so ffmpeg decodes once:
# Crop a centered square, then downscale it to 1080x1080
ffmpeg -i in.mp4 -vf "crop=in_h:in_h,scale=1080:1080" -c:v libx264 -crf 18 -c:a copy out.mp4Order matters: crop first to pick the region, then scale to resize it. Running them as one filter chain is faster and avoids a second generation-loss encode you would get from cropping to a file and scaling that file.
For the rest of the command syntax (trimming, converting, muting, rotating), the ffmpeg command cheat sheet collects the canonical 2026 forms in one place.
FAQ
See also
- Trim and cut a video with ffmpeg: the lossless
-ss/-tcut with-c copy, and why that is instant while a crop is not. - Convert a video to a high-quality GIF with ffmpeg: the two-pass palettegen/paletteuse method, and crop a region before the GIF for a tighter result.
- The ffmpeg command cheat sheet: convert, crop, trim, scale, and compress in one reference.
Sources
Authoritative references this article was fact-checked against.





