Recursively transcode FLAC files to MP3
A quick script for recursively transcoding lossless FLAC files to MP3
I have an MP3 player that I use while I’m out. It uses a microSD card for storage. My personal media library is mostly FLAC, so when I want to transfer songs to the MP3 player, I need to transcode them to MP3.
The below script uses Python and mutagen to recursively transcode all FLAC files in a directory to MP3. It will confirm that the MP3 was correctly created, before deleting the original FLAC file.
It runs recursively in a directory, so I store it at the root of my microSD card. My process is:
- Transfer FLAC files to the microSD card
- Run the script
You could configure this to run on a schedule on your media drive, or tweak some of the code to not delete the FLAC file (search for the NOTE:
line and comment out the line below it).
This works for me, and it saves a ton of space on my microSD card.