I have a video that shows the following
and I would like to crop it to this:
How can I do it?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4
Where the options are as follows:
out_wis the width of the output rectangle
out_his the height of the output rectangle
yspecify the top left corner of the output rectangle
So, for example, to crop a 640×480 window, starting from position (100, 100), you'd do:
ffmpeg -i in.mp4 -filter:v "crop=640:480:100:100" out.mp4
Be aware that FFmpeg will re-encode the video using x264, when the MP4 container is selected. With no additional options, this defaults to a constant rate factor (CRF) set to 23. To increase the quality—which could be necessary for screen recordings with sharp edges and text—use a lower value, maybe go down to 18:
ffmpeg -i in.mp4 -filter:v "crop=640:480:100:100" -crf 18 out.mp4
Handbrake is a free and open source cross-platform tool with a GUI. Load the input file, then use the Picture Settings to specify the crop:
You can use the Preview Window to visually adjust the crop.
Here, you can also adjust the output quality with the Constant Quality slider: