Gangmax Blog

Convert Flac to mp3 by Linux Command

From here.

Use the following command to convert the “flac” format audio files into the “mp3” format, with keeping the metadata.

1
for file in *.flac; do ffmpeg -i $file -ab 320k -map_metadata 0 -id3v2_version 3 ${file:r}.mp3; done

Updated on “2025-09-28”(from ChatGPT).

The following commands can be used as well.

1
2
3
4
5
6
7
# Convert "flac" files into "mp3" files.
find . -name "*.flac" -exec ffmpeg -i "{}" -b:a 320k "{}".mp3 \;

# Rename "*.flac.mp3" files into "*.mp3" files.
for f in *.flac.mp3; do
mv "$f" "${f%.flac.mp3}.mp3"
done

Comments