From a162880eea0d6b5db75225e749e42cc1c8f7e86d Mon Sep 17 00:00:00 2001 From: Leaced Date: Fri, 24 Mar 2023 11:16:18 +0100 Subject: [PATCH] Add files via upload --- to_opus.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 to_opus.sh diff --git a/to_opus.sh b/to_opus.sh new file mode 100644 index 0000000..bc2f70f --- /dev/null +++ b/to_opus.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +shopt -q globstar; globstar_set=$? +((globstar_set)) && shopt -s globstar +shopt -q extglob; extglob_set=$? +((extglob_set)) && shopt -s extglob +# Note, 0 (true) from shopt -q is "false" in a math context. + +FORMATS=$@ + +for file in **/*.@(${FORMATS// /|}); do + ffmpeg -threads 4 -i "$file" -c:a libopus -b:a 128k "${file%.*}.opus" && rm "$file" +done + +((globstar_set)) && shopt -u globstar +((extglob_set)) && shopt -u extglob + +exit 0