From a0a7cfbd6f2547fd3abadcb0e9aa398fad472daa Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Fri, 11 Nov 2022 11:49:51 -0500 Subject: [PATCH] 1.07 - Use opusenc for opus conversion --- root/scripts/audio-pp.bash | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/root/scripts/audio-pp.bash b/root/scripts/audio-pp.bash index e846b61..b0927bf 100644 --- a/root/scripts/audio-pp.bash +++ b/root/scripts/audio-pp.bash @@ -2,7 +2,7 @@ export LC_ALL=C.UTF-8 export LANG=C.UTF-8 TITLESHORT="APP" -ScriptVersion="1.06" +ScriptVersion="1.07" set -e set -o pipefail @@ -156,6 +156,22 @@ Main () { echo "Converting: $converttrackcount Tracks (Target Format: $targetformat (${targetbitrate}))" for fname in "$1"/*.flac; do filename="$(basename "${fname%.flac}")" + if [ "${ConversionFormat}" = OPUS ]; then + opusenc --bitrate ${bitrate} --vbr --music "$fname" "${fname%.flac}.temp.$extension"; + echo "Converted: $filename" + if [ -f "${fname%.flac}.temp.$extension" ]; then + rm "$fname" + sleep 0.1 + mv "${fname%.flac}.temp.$extension" "${fname%.flac}.$extension" + fi + continue + else + echo "Conversion failed: $filename, performing cleanup..." + rm -rf "$1"/* + sleep 0.1 + exit 1 + fi + if ffmpeg -loglevel warning -hide_banner -nostats -i "$fname" -n -vn $options "${fname%.flac}.temp.$extension"; then echo "Converted: $filename" if [ -f "${fname%.flac}.temp.$extension" ]; then