From 7a8e1ac41b4fa2e11fa9045003cc9294d66fbc5d Mon Sep 17 00:00:00 2001 From: fabian Date: Thu, 18 Aug 2022 22:22:48 +0200 Subject: [PATCH] new: files for re-encoding audio (removing covers, optimising for streaming (AAC)) change: made script less error-prone --- scripts/reencode_m4a.sh | 11 +++++++++++ scripts/reencode_mp3.sh | 7 +++++++ scripts/transcode_m4a.sh | 10 +++++----- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 scripts/reencode_m4a.sh create mode 100755 scripts/reencode_mp3.sh diff --git a/scripts/reencode_m4a.sh b/scripts/reencode_m4a.sh new file mode 100755 index 0000000..1302f76 --- /dev/null +++ b/scripts/reencode_m4a.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +for file in ./*.m4a; do + map=''; + if [[ $# > 0 && $1 == 'map' ]]; then + map='-map 0:0'; + fi + echo "ffmpeg -i '$file' -c:a copy $map -movflags +faststart '../reencode/$file'"; + ffmpeg -i "$file" -c:a copy $map -movflags +faststart "../reencode/$file"; +done diff --git a/scripts/reencode_mp3.sh b/scripts/reencode_mp3.sh new file mode 100755 index 0000000..d82977b --- /dev/null +++ b/scripts/reencode_mp3.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +for file in ./*.mp3; do + echo "ffmpeg -i '$file' -c:a copy -map 0:0 '../reencode/$file'"; + ffmpeg -i "$file" -c:a copy -map 0:0 "../reencode/$file"; +done diff --git a/scripts/transcode_m4a.sh b/scripts/transcode_m4a.sh index e8adb59..e095468 100755 --- a/scripts/transcode_m4a.sh +++ b/scripts/transcode_m4a.sh @@ -2,11 +2,11 @@ set -euo pipefail for file in ./*.$1; do - map='' - if [[ $# > 1 && "$2" == 'map' ]]; then - map='-map 0:0' + map=''; + if [[ $# > 1 && $2 == 'map' ]]; then + map='-map 0:0'; fi - echo "ffmpeg -i '$file' -c:a libfdk_aac -profile:a aac_he -b:a 64k -movflags +faststart $map '../m4a/${file%$1}m4a'" - ffmpeg -i "$file" -c:a libfdk_aac -profile:a aac_he -b:a 64k -movflags +faststart $map "../m4a/${file%$1}m4a" + echo "ffmpeg -i '$file' -c:a libfdk_aac -profile:a aac_he -b:a 64k -movflags +faststart $map '../m4a/${file%$1}m4a'"; + ffmpeg -i "$file" -c:a libfdk_aac -profile:a aac_he -b:a 64k -movflags +faststart $map "../m4a/${file%$1}m4a"; done