Created
November 9, 2020 08:50
-
-
Save coderofsalvation/bb922e8e9cfed101ad4e9e1700d9ef25 to your computer and use it in GitHub Desktop.
add gradient with angle on top of video or image using ffmpeg
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/bash | |
[[ ! -n $5 ]] && echo "Usage: [ROTATE=90] gradientvideo <input.mp4> <r> <g> <b> <output.mp4>" && exit | |
set -x | |
[[ -n $ROTATE ]] && ROTATE=",scale=w=1.5*iw:h=1.5*ih,rotate=angle=$ROTATE" | |
ffmpeg -i "$1" -filter_complex "[0]split[v0][v1];[v0]format=rgba,geq=r=$2:g=$3:b=$4:a=255*(Y/H)$ROTATE[fg];[v1][fg]overlay=(W-w)/2:(H-h)/2:shortest=1" -q:v 2 "$5" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment