Is there a good command line tool for converting to and from FLAC audio format?

5,284

Solution 1

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

sox foo.mp3 foo.flac

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

Solution 2

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.

Solution 3

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

Share:
5,284

Related videos on Youtube

Matthew
Author by

Matthew

Updated on September 17, 2022

Comments

  • Matthew
    Matthew over 1 year

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

  • Matthew
    Matthew about 13 years
    great analogy, man. that got you an upvote.