From ec5f7d9379baa1d826b6d22d2920515aaa18e9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Fri, 7 Oct 2022 22:52:55 +0200 Subject: [PATCH] strip_track_except: add a new script --- strip_track_except.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 strip_track_except.sh diff --git a/strip_track_except.sh b/strip_track_except.sh new file mode 100755 index 0000000..24f764f --- /dev/null +++ b/strip_track_except.sh @@ -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"