Last active
August 22, 2017 06:27
-
-
Save dardo82/06d64f21a5be36e7cc20230c912133af to your computer and use it in GitHub Desktop.
Edit at black frame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TS="$1";BN="${TS%.*}";ED="$BN-edit";LOG="${TS%/*}/ffmpeg.log";VF="blackdetect" | |
ffmpeg -i $TS -vf $VF=d=0.04 -f rawvideo -y /dev/null 2>&1 | tr \\r \\n > $LOG | |
eval $(awk -F ':| ' 'BEGIN {be=0.00} /black/ {print "ffmpeg -i $TS -ss "be" -to "$5" $BN-"NR".ts;"; be=$7}' $LOG) | |
for FILE in $BN-*;do ffprobe $FILE 2>&1 | grep -q " 00:0" && rm -fv $FILE;done | |
cat $BN-* > $ED.ts; ffmpeg -i $ED.ts $ED.mp4; rm -fv $BN-*.ts $LOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment