Convert FLAC to MP3 using FFMPEG

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.

Objectives

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

Folder Structure

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)

Batch File

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.

Summary

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.

Author: BigGeek

Wayne is a self-proclaimed geek, IT Professional, father of two and husband who's still much closer to 40 than 50. When he's not busy in an otherwise hectic life he takes time to blog on all things that warrant an online opinion. Founded in 2012, ePINIONATED has been a guilty pleasure for Wayne, giving him an online voice in a very noisy Interweb – some of which might even be useful, maybe.

1 thought on “Convert FLAC to MP3 using FFMPEG”

We would love to hear from you...