Created
June 21, 2020 23:01
-
-
Save luxigo/a49a9c12b87f7ac20676e35a7129e000 to your computer and use it in GitHub Desktop.
Blend original video with edge detection filter output using multiply operator with ffmpeg
This file contains 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/bash | |
INPUT=$1 | |
OUTPUT=$2 | |
if [ -z "$OUTPUT" ] ; then | |
EXT=${INPUT##*.} | |
BASENAME=$(basename -- $INPUT .$EXT) | |
OUTPUT=$(dirname $INPUT)/$BASENAME-composite.$EXT | |
fi | |
# to add some processing steps using filter_complex below (eg color correction) | |
# check https://ffmpeg.org/ffmpeg-filters.html | |
ffmpeg \ | |
-i "$INPUT" \ | |
-filter_complex " \ | |
[0:v]sobel=planes=0xf:scale=1,negate [sob]; \ | |
[0:v][sob]blend=all_mode=multiply \ | |
" \ | |
-preset veryslow \ | |
-tune film \ | |
-crf 15 \ | |
-c:a copy \ | |
-pix_fmt yuv420p \ | |
-movflags \ | |
+faststart \ | |
"$OUTPUT" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment