Last active
January 29, 2020 23:45
-
-
Save nmrshll/29f52e84a98e4a7486c035fc07a32072 to your computer and use it in GitHub Desktop.
Convert all flac files in a folder/subfolders 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
for f in ./**/*.flac; do | |
# echo $f; | |
DIR=$(dirname "$f"); | |
NAME=$(basename "$f" | cut -d'.' -f1); | |
sox "${f}" -C 320 -S "${DIR}/${NAME}.mp3" | |
done | |
# or | |
# handles filenames with spaces | |
find . -type f -name "*.m4a" -print0 | while IFS= read -r -d '' f; do | |
DIR=$(dirname "$f" | sed 's/[[:space:]]//g'); echo DIR ${DIR}; | |
NAME=$(basename "$f" | cut -d'.' -f1 | sed 's/[[:space:]]//g'); echo NAME ${NAME}; | |
mkdir -p "/tmp/00_converted_mp3/${DIR}"; | |
# cp "${f}" "/tmp/00_copied_mp3_mnms" | |
# sox "${f}" -C 320 -S "00_converted_mp3/${DIR}/${NAME}.mp3" | |
ffmpeg -n -i "${f}" -acodec libmp3lame -aq 2 "/tmp/00_converted_mp3/${DIR}/${NAME}.mp3" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment