BSODs Notebook

Linux admin stuff and other shenanigans

Transcode FLAC Files

A small script I wrote to transcode my flac files to mp3 or ogg files for my portable audio player.

Don’t do this to your primary FLAC archive because it removes the FLAC files after conversion and you will probably not like that.

cpu_cores=4
find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'oggenc -q 5 "%" && rm -vf "%"'

or with ffmpeg:

cpu_cores=4
find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'ffmpeg -i "%" -c:a libmp3lame -q:a 2 "%.mp3" && rm -v "%"'