Thursday, March 6, 2008

Converting FLAC to MP3 with GStreamer

Handy one-line command to convert a FLAC file into an MP3 suitable for use with iTunes when you've only got access to the command-line:

gst-launch filesrc location = "song_name.flac" ! flacdec ! lame ! filesink location = "song_name.mp3"

I personally like CBR 320 bitrate MP3's, so my particular command-line looks like:

gst-launch filesrc location = "song_name.flac" ! flacdec ! lame vbr=0 bitrate=320 ! filesink location = "song_name.mp3"


You'll need gst-launch (or gst-launch-0.8 | gst-launch-0.10 if you're using Debian or Ubuntu) and the relevant codecs. (in this case, flac and lame)