-
-
Save Rub21/3050fd10e5c12bc53fdc7e21b20446bc 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