g* auto git commands added, some encoding stuff as well

This commit is contained in:
2022-06-17 17:40:46 -04:00
parent d6c388bfb5
commit 75db2da32f
12 changed files with 262 additions and 2 deletions

38
bin/get_audio Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
err_file="/tmp/getaudio_$$"
if [[ -z "$1" ]]; then
printf 'Need a filename of a video\n' >&2
exit 1
fi
input_file="$1"
if [[ ! -f "$input_file" ]]; then
printf "Can't read %s\n" >&2
exit 1
fi
base_path="$(dirname "$input_file" 2>"$err_file")"
err="$(<"$err_file")"
if [[ -n "$err" ]]; then
printf '%s\n' "$err" >&2
exit 1
fi
audio_ext="$(ffprobe "$input_file" 2>&1 | sed -nr 's/.*Audio: (...).*/\1/p')"
if [[ -n "$2" ]]; then
if [[ "$2" == *.* ]]; then
audio_out="$2"
else
audio_out="${2}.${audio_ext}"
fi
else
out_file="$(basename ${input_file%%.*})"
audio_out="${base_path}/${out_file}.${audio_ext}"
fi
echo ffmpeg -i "$input_file" -vn -acodec copy "$audio_out"
ffmpeg -i "$input_file" -vn -acodec copy "$audio_out"