diff --git a/dotfiles/bin/analyze-video-volume b/dotfiles/bin/analyze-video-volume new file mode 100644 index 0000000..8c69c5a --- /dev/null +++ b/dotfiles/bin/analyze-video-volume @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Use this to get a report on the video audio volume. You can use this info +# manually normalize or increase/decrease a video's volume using the +# change-video-volume script, supplying it the volume delta you want. Typically +# you use the delta from the analysis report this script provides, e.g. if the +# max_volume is -5 db then you would call change-video-volume with a value of +# 5. I find that the two pass normalize-video-audio script works better than +# this approach...but it will take longer to run! +# +# Inspired by https://superuser.com/a/323127 and https://superuser.com/a/1312885 + +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 + +if [[ $1 == "" ]]; then + printf "${BOLD}${RED}Usage: analyze-video-volume