Created
August 22, 2022 18:30
-
-
Save cs01/d3aec9b691174696f266e2e4d26a37d5 to your computer and use it in GitHub Desktop.
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 | |
while getopts ":i:o:t:" opt; do | |
case $opt in | |
i) input="$OPTARG" | |
;; | |
o) output="$OPTARG" | |
;; | |
t) text="$OPTARG" | |
;; | |
\?) echo "Invalid option -$OPTARG" >&2 | |
exit 1 | |
;; | |
esac | |
case $OPTARG in | |
-*) echo "Option $opt needs a valid argument" | |
exit 1 | |
;; | |
esac | |
done | |
[[ -z "$input" ]] && echo "Must specify -i for input file" && exit | |
[[ -z "$output" ]] && echo "Must specify -o for output file" && exit | |
[[ -z "$text" ]] && echo "Must specify -t for text" && exit | |
ffmpeg -i $input -vf "drawtext=text=$text:x=(w-text_w)/2:y=(h-text_h)/2:fontsize=30:fontcolor=white:box=1:boxcolor=white@0.5: boxborderw=5'" -codec:a copy $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment