Sunday, February 19, 2017

Tutorial 04 - How to use the Crop detection to find the Black border of a video

This document explains how to find the black border around video and trim it during encoding

How to detect black borders


ffmpeg -hide_banner -ss 300 -i <Source_File> -vframes 10 -vf cropdetect -f null -
It will produce output of 10 frames as

[Parsed_cropdetect_0 @ 02d87c20] x1:78 x2:557 y1:60 y2:419 w:480 h:352 x:78 y:64 pts:12000 t:0.133333 crop=480:352:78:64

How to create a new output file without the black border

Find the crop settings from the previous command and use it as a video filter during encoding the video

ffmpeg -i <Source_File> -vf crop=480:352:78:64 -c:a copy output.mp4

No comments:

Post a Comment