Sungju's Slow Life

Personal journal


How to convert Flac to MP3 on Mac

To convert FLAG files into MP3, you can find many good commercial software. But, if you don’t have many files and just need a quick and cheap way, you can try the below instead. It requires to have MacPorts installed, but it’s just for installing ffmpeg.

 
$ sudo port install ffmpeg 

Now, you just need to create the file named convert.sh on the directory you have flac files.

 
#!/bin/bash
DIR=$1

if [ -z DIR ]; then
    DIR="./"
fi

for f in "${DIR}"*.flac; do
    echo $f
    output="${f[@]/%flac/mp3}"
    ffmpeg -i "$f" -qscale:a 0 "${output}"
done

Now, set the mode and execute. That’s it.

$ chmod a+x convert.sh
$ ./convert.sh


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: