Crop a video by exact pixel coordinates
Admin ·
Crop a clip when the part you want fits inside one rectangle throughout the shot. The four-color sample makes it easy to see which edges stayed in the output.
Keep only the left half of the picture
Load the video example. The source is 320 × 240 pixels and lasts 2.50 seconds. Its top row is red and green and its bottom row is blue and yellow.
Set Left to 0, Top to 0, Crop width to 160 and Crop height to 240. The framing preview should show red above blue. You can also drag the box and its lower-right corner, then confirm the numbers in the fields.
Download the four-color video exampleFFmpeg crop filter and exact pixel options
Check the frame size and timing in the MP4
Choose Crop video, download the MP4 and open it in a player with a media information panel. The saved frame size should be 160 × 240 pixels and the picture should still last about 2.50 seconds.
Look for the small white marker in the red panel around 0.8 seconds. The tone begins at about the same time and ends around 1.6 seconds. Scrub beyond that point to confirm the picture remains cropped for the rest of the clip.
Download the four-color video exampleFFprobe stream and container information
Check the orientation before setting offsets
A phone video can store a landscape frame with a rotation flag for portrait playback. The crop coordinates follow the displayed frame, so measure left and top after opening the clip here.
Choose a portrait, square or landscape ratio when the shape matters more than a particular offset. The crop width and height must be even for the H.264 export. Check several points in the clip if the subject moves.
FFmpeg crop filter and exact pixel optionsFFmpeg video rotation options
Common questions
What happens to the original file?
The output is a separate MP4. Keep the original if you may need to change the rectangle or recover anything outside it.
Why does the MP4 report a slightly different duration?
The picture keeps its timeline. A media reader can report a few extra milliseconds because the re-encoded AAC track ends on an audio packet boundary.