18

I want SoX to record audio in .flac files. When I do:

rec -t flac ~/Desktop/myrec.flac

…it gives the following error:

rec FAIL formats: no handler for given file type `flac'

I have installed SoX from 'brew' and and I do have flac 1.2.1 installed.

I have gone though man pages at http://sox.sourceforge.net/sox.pdf but did not get the information that I am looking for.

How can I add support for .flac files?

I am on OS X 10.9.3

  • Today, when I installed sox from Homebrew (no extra options), FLAC support just worked out of the box. – Display Name Nov 12 '14 at 15:51
35

Keeping it simple.

Removing it using brew like so :

brew remove sox

Then installing it again with specific options, like so, did the trick for me:

brew install sox --with-lame --with-flac --with-libvorbis

You may want to remove the --with-lame option if you won't be using MP3s, or the --with-libvorbis if you won't be using OGG.

I hope this helps someone.

| improve this answer | |
  • 1
    Thank you, this also solves sox FAIL formats: no handler for detected file type `vorbis' . How strange those are not in by default. – qubodup Nov 29 '15 at 8:29
  • 4
    You can also just brew reinstall instead of brew remove, brew install. – shrx May 13 '16 at 12:21
2

Try this:

brew remove libogg flac sox
brew update
brew doctor
brew install libogg flac
brew install sox

This should recompile sox with libogg and flac present, and it will then find the FLAC support.

~$ brew info sox
sox: stable 14.4.1
http://sox.sourceforge.net/
/usr/local/Cellar/sox/14.4.1_1 (15 files, 2.1M) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/sox.rb
==> Dependencies
Build: pkg-config ✔
Required: libpng ✔, mad ✔
Optional: opencore-amr ✘, libvorbis ✔, flac ✔, libsndfile ✔, libao ✘, lame ✔
==> Options
--with-flac
    Build with flac support
--with-lame
    Build with lame support
--with-libao
    Build with libao support
--with-libsndfile
    Build with libsndfile support
--with-libvorbis
    Build with libvorbis support
--with-opencore-amr
    Build with opencore-amr support
| improve this answer | |
  • I have tried above steps. But still the same issue. – user3585284 Aug 23 '14 at 6:18
  • here is my output of brew info sox sox: stable 14.4.1 sox.sourceforge.net /usr/local/Cellar/sox/14.4.1_1 (15 files, 2.0M) * Built from source From: github.com/Homebrew/homebrew/blob/master/Library/Formula/sox.rb ==> Dependencies Build: pkg-config ✔ Required: libpng ✔, mad ✔ Optional: opencore-amr ✘, libvorbis ✘, flac ✔, libsndfile ✘, libao ✘, lame ✔ ==> Options --with-flac Build with flac support --with-lame Build with lame support --with-libao Build with libao support --with-libsndfile Build with libsndfile support --with-libvorbis . . . . – user3585284 Aug 23 '14 at 6:20
  • When I do the same, the only difference is that I have libsndfile and libvorbis as well. rec is working for me to create a .flac file. What happens if you repeat the steps above, but also install vorbis and libsndfile? brew install libogg flac libsndfile libvorbis – JustinParker Aug 29 '14 at 14:52
  • 1
    Following EgregiousClam's instructions did not work for me the first time around because trying to remove libogg failed with 'Error: No such keg: /usr/local/Cellar/libogg'. I did not pay much attention at the time and gave it another shot, now converting from FLAC does work. -- In other words: make sure the remove command does execute successfully (or you could try removing all three programs with separate brew remove commands.) – Fabien Snauwaert Jan 12 '15 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .