diff --git a/dotfiles/bin/add-audio-to-video b/dotfiles/bin/add-audio-to-video new file mode 100644 index 0000000..1c1b798 --- /dev/null +++ b/dotfiles/bin/add-audio-to-video @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Re-encodes the video with a new primary audio channel. + +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) +fi +if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + MAGENTA="$(tput setaf 5)" + CYAN="$(tput setaf 6)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" +else + RED="" + GREEN="" + YELLOW="" + BLUE="" + MAGENTA="" + CYAN="" + BOLD="" + NORMAL="" +fi + +vid_filename=$(basename -- "$1") +audio_filename=$(basename -- "$2") +output_name="$3" + +if [[ $vid_filename == "" || $audio_filename == "" || $output_name == "" ]]; then + printf "${BOLD}${RED}Usage: add-audio-to-video