Need to detect if a video has black borders
by GPGAgent from LinuxQuestions.org on (#5HB95)
I can detect the black borders on a video and create a crop= parameter for ffmpeg like this:Code:# detect the cropping parameters
FFREPORT=file=CROPDATA.txt:level=32 ffmpeg -hide_banner -loglevel quiet -ss $1 -i $2 -vframes 2 -vf "cropdetect=24:16:0" -f null -
# Extract the cropping paramaters for the -vf switch
CROP=`awk '/crop=/ {print $14}' CROPDATA.txt`
This works just fine Code:$ echo $CROP
crop=976:720:156:0What I want to do is to check the last two crop parameters x and y and if both are zero the vdio has no black borders.
How can I extract these two values, 156 and 0.
What i would do is add these together and if their sum is zero then there is no border. If it's greater thatn one there is a border and my script can take the appropriate action
Seems simple, but I can't figure it out!


FFREPORT=file=CROPDATA.txt:level=32 ffmpeg -hide_banner -loglevel quiet -ss $1 -i $2 -vframes 2 -vf "cropdetect=24:16:0" -f null -
# Extract the cropping paramaters for the -vf switch
CROP=`awk '/crop=/ {print $14}' CROPDATA.txt`
This works just fine Code:$ echo $CROP
crop=976:720:156:0What I want to do is to check the last two crop parameters x and y and if both are zero the vdio has no black borders.
How can I extract these two values, 156 and 0.
What i would do is add these together and if their sum is zero then there is no border. If it's greater thatn one there is a border and my script can take the appropriate action
Seems simple, but I can't figure it out!