From be8e9da1e1a9f65aa0d30d90d474bf170931224f Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 10 Nov 2018 19:01:40 +0100 Subject: [PATCH] copy existing mp3 files --- compress-music.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compress-music.sh b/compress-music.sh index bfc872e..1f7a3f6 100755 --- a/compress-music.sh +++ b/compress-music.sh @@ -13,8 +13,11 @@ cd "$source" # create directory structure find . -type d -exec mkdir -p "$destination/{}" \; +# copy existing mp3 files +find . -type f -name '*.mp3' -exec cp --reflink=always "{}" "$destination/{}" \; + # set +e because ffmpeg errors on .jpg, .txt, etc. # compress with opus set +e -find . -type f -not -name '*.opus' | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a mp3 -b:a 320 -map_metadata 0 ""$destination/{.}.mp3""' +find . -type f -not -name '*.mp3' | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a mp3 -b:a 320 -map_metadata 0 ""$destination/{.}.mp3""' #set -e