You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
784 B
Bash
24 lines
784 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
#
|
|
# this script compresses everything in $source and saves it in $destination
|
|
#
|
|
|
|
source="$HOME/kskcloud/Musik/"
|
|
export destination="$HOME/music.tiny/"
|
|
|
|
cd "$source"
|
|
|
|
# create directory structure
|
|
find . -type d -exec mkdir -p "$destination/{}" \;
|
|
|
|
# copy existing files
|
|
find . -type f -and \( -name '*.mp3' -or -name '*.m4a' -or -name '*.ogg' -or -name '*.opus' \) -exec cp -a --reflink=always "{}" "$destination/{}" \;
|
|
|
|
# set +e because ffmpeg errors on .jpg, .txt, etc.
|
|
set +e
|
|
# compress with opus
|
|
find . -type f -not -name '*.mp3' -not -name '*.m4a' -not -name '*.ogg' -not -name '*.opus' | parallel --jobs $(($(nproc) - 1)) --eta --progress 'test -f ""$destination/{.}.opus"" || nice -n19 opusenc --bitrate 128 --music ""{}"" ""$destination/{.}.opus""'
|
|
#set -e
|