Convert FLAC to MP3 on Linux

This is the script I use to convert FLAC files to MP3. After converting, it moves all the FLAC files into a subdirectory named .flac:


# Converts all FLAC files in the current folder to high-quality VBR MP3s.
# Moves all .flac files into a folder named .flac.

for f in *.flac; do  
    avconv -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"

mkdir .flac
mv *.flac .flac/

echo Done.

This script requires avconv, which is in the libav-tools package. Install using:

sudo apt-get install libav-tools

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Linux, Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *