Crop a video to remove edges, watermarks, or unwanted regions
The crop filter cuts a rectangular region from each frame: crop=W:H:X:Y, where W and H are the output size and X, Y are the top-left corner of the crop region. The most common uses are letterbox removal, watermark cropping, and reframing for a different aspect ratio.
The command
ffmpeg -i input.mp4 -vf "crop=640:480:100:100" output.mp4What it does
FFmpeg extracts a 640x480 region starting at (100, 100) from each frame and re-encodes. The output is a smaller video containing only the cropped region. The source's audio is preserved (or re-encoded, depending on whether you pass -c:a copy).
When to use it
For removing black bars from a letterboxed source (the crop should target the visible video area), for cropping out a logo or watermark in a known position, and for reframing a 16:9 source to 1:1 for social media. For dynamic cropping (a region that moves), use the cropdetect filter to find the right coordinates and a more complex expression.
Video and audio requirements
Any decodable video. The crop region must fit within the source frame: X+W <= source_width and Y+H <= source_height. If the crop extends past the frame, FFmpeg will error. Use iw-2*X to compute width relative to the source.
Things to avoid
- Hardcoding coordinates that do not match the source. A 1920x1080 source and a 1280x720 source need different X/Y values. Use
in_wandin_hin the expression:crop=iw-200:ih-200:100:100crops 100 pixels from each edge of whatever the source is. - Cropping without re-encoding. The default is to re-encode video. If you want to remux instead, use trim or seek; cropping is a pixel operation, not a packet operation, and cannot be stream-copied.
- Forgetting that crop changes the display aspect ratio. A 16:9 source cropped to 640x480 becomes 4:3, which some players will letterbox. Set the SAR explicitly with
setsar=1if you want the output to play as the cropped size without letterbox. - Combining crop with other filters without checking the order. The filter chain applies left to right; cropping first and scaling second is different from scaling first and cropping second.