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:

#!/bin/bash

#------------------------------------------------------------------------------
# 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  
    ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"
done

mkdir .flac
mv *.flac .flac/

echo Done.

This script requires ffmpeg. Install using:

sudo apt-get install ffmpeg

 

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 *