Add script to fix one-sided audio channel in a vid
This commit is contained in:
parent
da7ef55309
commit
f499dfad96
20
aliases
20
aliases
|
@ -173,17 +173,19 @@ dl_youtube_playlist() {
|
||||||
shift 3
|
shift 3
|
||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" || $dir_name == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: cmd <url> <directory name> <optional args>\n"
|
error "Format: cmd <url> <directory name (optional)> <optional args>\n"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
opts+=" --all-subs --embed-subs"
|
opts+=" --all-subs --embed-subs"
|
||||||
|
|
||||||
|
if [[ $dir_name != "" ]]; then
|
||||||
make_vid_dir_and_cd_into $url "$dir_name"
|
make_vid_dir_and_cd_into $url "$dir_name"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
printf "${BOLD}Downloading playlist${NORMAL}\n"
|
printf "${BOLD}Downloading playlist${NORMAL}\n"
|
||||||
local name_format="v%(playlist_index)s--%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s"
|
local name_format="v%(playlist_index)s--%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s"
|
||||||
|
@ -351,14 +353,6 @@ dl_instagram_vid_and_hflip() {
|
||||||
rm $temp_name
|
rm $temp_name
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_virtualenv() {
|
|
||||||
if [ -f venv/bin/activate ]; then . venv/bin/activate;
|
|
||||||
elif [ -f ../venv/bin/activate ]; then . ../venv/bin/activate;
|
|
||||||
elif [ -f ../../venv/bin/activate ]; then . ../../venv/bin/activate;
|
|
||||||
elif [ -f ../../../venv/bin/activate ]; then . ../../../venv/bin/activate;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# Git Functions
|
# Git Functions
|
||||||
###################################
|
###################################
|
||||||
|
@ -464,12 +458,6 @@ br() {
|
||||||
b $@ ; r
|
b $@ ; r
|
||||||
}
|
}
|
||||||
|
|
||||||
alias bd='if [ -f build ]; then ./build -data 1 ; else test -f build.sh && ./build.sh -data 1 ; fi'
|
|
||||||
alias bbd='if [ -f build ]; then ./build -o 1 -data 1 ; else test -f build.sh && ./build.sh -o 1 -data 1 ; fi'
|
|
||||||
#alias bl='brew link --overwrite'
|
|
||||||
#lias bld='brew link --overwrite --dry-run'
|
|
||||||
alias bower='noglob bower'
|
|
||||||
|
|
||||||
if [[ "${platform,,}" == *'ming'* ]]; then
|
if [[ "${platform,,}" == *'ming'* ]]; then
|
||||||
_checksum() {
|
_checksum() {
|
||||||
local algo="$1"
|
local algo="$1"
|
||||||
|
|
51
bin/fix-audio-in-one-channel
Normal file
51
bin/fix-audio-in-one-channel
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Use this to fix the audio of a video that has audio in only the left or right
|
||||||
|
# channel. This does not re-encode the video.
|
||||||
|
|
||||||
|
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 "\n${BOLD}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename=$(basename -- "$1")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
output_name="$2"
|
||||||
|
|
||||||
|
if [[ $output_name == "" ]]; then
|
||||||
|
output="${filename}_repaired_audio.$extension"
|
||||||
|
else
|
||||||
|
output="${output_name}.$extension"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Repairing audio in $filename.$extension | output: $output${NORMAL}\n"
|
||||||
|
|
||||||
|
ffmpeg -i "$filename.$extension" -c:v copy -ac 1 "$output"
|
||||||
|
|
||||||
|
printf "\n${GREEN}${BOLD}Done repairing audio in $filename.$extension | output: $output${NORMAL}\n\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user