strip_track_except: add a new script

This commit is contained in:
Lukáš Kucharczyk 2022-10-07 22:52:55 +02:00
parent e6bd94c27d
commit ec5f7d9379
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 14 additions and 0 deletions

14
strip_track_except.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
colorprint() {
echo -e "\e[31m${1}\e[0m"
}
SCRIPT_NAME=$(basename "$0")
test -z "${1}" && echo "File not specified or doesn't exist, aborting. Usage: $SCRIPT_NAME \$FILENAME \$LANGUAGE_TO_KEEP" && exit 1
FILENAME=$1
# default language to keep is second parameter, or japanese if unspecified
LANGUAGE_TO_KEEP="${2:-jpn}"
echo -n "Processing "
colorprint "$FILENAME"
FILENAME_WITHOUT_EXT=${FILENAME%.*}
ffmpeg -i "$FILENAME" -map 0:v -map 0:a:m:language:${LANGUAGE_TO_KEEP} -map 0:s -c copy "${FILENAME_WITHOUT_EXT}.converted.mkv"