The crop filter takes crop=w:h:x:y — the output width and height, then the top-left corner where the crop begins. The corner is optional; leave it off and FFmpeg centers the crop automatically. Every value can use the input dimensions iw and ih as variables, which is what makes centering and aspect-ratio crops clean.
Key takeaways
crop=w:h:x:ysets size then top-left origin; omitx:yto center.- Use
iw/ihto crop relative to the source size. - Square:
crop=ih:ih. Vertical 9:16:crop=ih*9/16:ih. - Cropping re-encodes video; copy audio with
-c:a copy.
Crop to an exact size, centered
# 1280x720 region, centered automatically ffmpeg -i in.mp4 -vf "crop=1280:720" -c:a copy out.mp4 # exact region starting 100px from left, 50px from top ffmpeg -i in.mp4 -vf "crop=1280:720:100:50" -c:a copy out.mp4
Crop to a square (1:1) or vertical (9:16)
Reframing for Instagram or TikTok is the most common reason to crop. Drive the math off the input height so it works on any source resolution:
# square, centered ffmpeg -i in.mp4 -vf "crop=ih:ih" -c:a copy square.mp4 # vertical 9:16 from a landscape source, centered ffmpeg -i in.mp4 -vf "crop=ih*9/16:ih" -c:a copy vertical.mp4
Remove black bars (letterboxing)
If a clip has baked-in black bars, the cropdetect filter inspects the frames and prints a suggested crop you can paste straight into a second pass:
# step 1: detect the content region ffmpeg -i in.mp4 -vf cropdetect -f null - # step 2: apply the crop=... it printed ffmpeg -i in.mp4 -vf "crop=1920:800:0:140" -c:a copy out.mp4
Crop visually instead
FFmpegLab lets you drag a crop box over the preview and writes the matching crop=w:h:x:y for you — no guessing pixel offsets — and it runs fully offline. Pair it with scaling to hit an exact export resolution, or compress the result for delivery.