Thomas' Tech Tips

Convert FLAC to MP3 using ffmpeg while retaining all ID3 metadata

30 June 2022 - Thomas Damgaard

I have ripped my CD collection to Free Lossless Audio Codec (FLAC) I even made the effort of typing in all the metadata such as artist, album, song title, etc. that could not be easily found by MusicBrainz Picard

FLAC is a really nice format because it is lossless and it and free. Unfortunately, some audio players will not play it and will only play MP3 files. Recently, I had to play some music on such a device.

Thus, I needed to export a bunch of FLAC audio files to MP3. But I did not want to lose all the metadata stored in the ID3 tags.

FFmpeg to the rescue!

The following command will convert the FLAC file audio.flac to MP3:

ffmpeg -i audio.flac -ab 320k -map_metadata 0 -id3v2_version 3 audio.mp3

In order to do this for a whole album:

for file in album/*.flac; do
    ffmpeg -i "$file" -ab 320k -map_metadata 0 -id3v2_version 3 "$(basename "$file" .flac).mp3"
Filed under: audio, ffmpeg, flac, tips

Back to article list