Last active
August 29, 2015 14:05
-
-
Save dmytro/8e849df63949e91d8f19 to your computer and use it in GitHub Desktop.
Shell script to convert FLAC or APE files to MP3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
doit () { | |
NAME="$*" | |
echo $NAME | |
NAME=$(echo $NAME | sed 's;^\.\/;;') | |
DIR=$(dirname "$NAME") | |
FILE="$(echo $(basename ${NAME}) | sed 's/\.[^\.]*$//')" | |
OUT=tmp/$DIR | |
OFILE="${OUT}/${FILE}.mp3" | |
mkdir -p "$OUT" | |
if test -f "${OFILE}" ; then | |
echo "============================================ $OFILE already exists" | |
else | |
ffmpeg -loglevel panic -i "$NAME" -f mp3 -ab 192000 "${OFILE}" || true | |
echo "============================================ DONE ${FILE} " | |
ls -l "$OFILE" | |
fi | |
return 0 | |
} | |
export -f doit | |
/usr/bin/find -E . -regex ".*(ape|flac)" -exec bash -c 'doit "{}"' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment