FFMPEG crop and crop detection

Ever wondered how much you can crop a video? How many pixels are those black bars? How to detect and crop!

FFMPEG crop and crop detection
ffmpeg -ss 150 -i input.mp4 -vframes 10 -vf cropdetect -f null -

-ss is how many frames we skip ahead before we start detecting. If the video has a very long intro, you might need to increase this considerably.
-vframes is how many samples (frames)
-vf means video filter "cropdetect", which is the filter we use to do the actual detecting.

Minor disclaimer. Some videos do change aspect ratio thru out the video, so take extra care before you do this, so you dont accidentally crop out sections that contained video at a later point.

ref: http://ffmpeg.org/ffmpeg-filters.html#cropdetect


Alright, so now we know how much we can crop. For instance we get:

All we need to do is pass a -vf (short for video filter), like so:
ffmpeg -i input.mp4 -vf crop=1920:800:0:0 output.mp4

ref: https://ffmpeg.org/ffmpeg-filters.html#crop