Converting FLAC to MP3 using FFMPEG doesn’t have to be difficult. I’ve been using FLAC for my audio collection now for a while but recently needed to convert some of them into MP3 for the in car audio system. I wanted to maintain any meta data and achieve a decent level of audio quality without a huge file size. FLAC audio is lossless which means you’re getting the same quality from your digital music as you are from your CD but as we know, MP3 can sound terrible if the wrong settings are selected.
I decided to take a look at FFMPEG to see if it could manage audio and not only can it manage audio, but it does a fantastic job of converting FLAC to MP3.
Using FFMPEG to convert FLAC to MP3
After some trial and error, I settled on the following batch file. The batch file is very similar to the video version I used in the article on how to Quickly Convert MKV to M4V. It will pick up any FLAC file in c:\source and write out the corresponding MP3 file in c:\output.
My in car audio system does not recognise FLAC so I needed to convert to MP3.
With this in mind, I wanted to achieve the following:
- Convert from FLAC to MP3 for free
- Achieve a variable bit rate of around 220
- Maintain meta data
- Be able to process a number of files at the same time
- Work quickly
I use the following folder structure:
c:\source (The folder I put all my FLAC files into)
c:\source\done (The folder the original FLAC is moved into after processing)
c:\output (The folder that the complete MP3 files are written to)
c:\ffmpeg\bin (The location that FFMPEG is installed in)
The batch file looks like this:
@echo off for %%a in ("c:\source\*.flac") do ( c:\ffmpeg\bin\ffmpeg -i "%%a" -aq 1 -map_metadata 0 -id3v2_version 3 "c:\output\%%~na.mp3" move "%%a" c:\source\done )
FFMPEG supports a number of quality presets for MP3, in this example I use -aq 1 which gives a variable bitrate of 190-250.
The resulting MP3 files work perfectly and are using a variable bit rate of around 220. The meta data has been maintained and my in car audio system reads this information and plays the tracks back perfectly.
FFMPEG can be downloaded from the FFMPEG website.
I hope this article has been of use and look forward to reading your feedback in the comments.