Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Ideally, I want to convert from MP3 to FLAC and back. I also need to be able to script this.

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

The fundamental tool for sound format conversions and simple transformations is SoX, the Swiss Army knife of sound processing programs.

sox foo.mp3 foo.flag

If you're running Debian, support for writing MP3 in sox is broken in lenny and squeeze (and as far as I know the same problem affects Ubuntu 10.04 and 10.10). This bug was fixed in early March 2011, so grabbing the latest source (or grabbing a binary for sox 14.3.1-1build1 or newer) and recompiling it should work.

An alternative for encoding to MP3 is lame. It doesn't read Flac, but you can use sox or flac to convert from Flac to wav and then lame from wav to MP3.

flac -d foo.flac -c | lame - foo.mp3
share|improve this answer
add comment

sox version 13 and up supports FLAC, along with many other formats. sox can do many things to an audio file, not just convert from one format to another. It is to audio what ImageMagick is to graphics.

share|improve this answer
    
great analogy, man. that got you an upvote. –  ixtmixilix Mar 21 '11 at 21:09
add comment

It's called flac, oddly enough. It's somewhat painful to use, or was back when I scripted a transcoding job with it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.