Installing the iLBC codec (libilbc) on Mac OS X for use with FFmpeg

1

I'm trying to use FFmpeg to encode files with the iLBC codec, e.g.:

ffmpeg -i audio.wav -ar 8000 -acodec ilbc audio.lbc -y

This worked fine on Windows, however on Mac OS X I'm getting the error Unknown encoder 'ilbc'.

The official FFmpeg documentation has this to say about libilbc:

Go to https://github.com/dekkers/libilbc and follow the instructions for installing the library. Then pass --enable-libilbc to configure to enable it.

I've never compiled a library before so I tried my luck editing the brew recipe, adding these lines where appropriate:

option "with-libilbc", "Enable iLBC library
args << "--enable-libilbc" if build.with? "libilbc"

Then reinstalling ffmpeg with brew install ffmpeg --with-libilbc. However, that just causes the build to fail and I don't see any message error pertaining to iLBC. My assumption is that the library is simply missing at this point anyway.

Hence my questions:

  • How can I compile the libilbc mentioned in the FFmpeg doc for Mac OS X?
  • Can I then connect it to brew somehow so as to rebuild ffmpeg with it?

Fabien Snauwaert

Posted 2015-01-12T18:10:56.987

Reputation: 342

FYI, the error messages while building ffmpeg were not helpful quite simply because they were being truncated. Using the -v flag fixed that and helped see what the problem was. – Fabien Snauwaert – 2015-01-13T08:50:07.953

Would you consider making libilbc as a formula, and making that and your changes to ffmpeg a pull request? – slhck – 2015-01-13T16:18:32.770

Sure. I've never done it before but I'll try my hand at it. – Fabien Snauwaert – 2015-01-14T12:53:17.870

Would be nice. I can also try but I don't have so much time at the moment :) – slhck – 2015-01-14T14:47:10.650

Answers

3

The repository you linked is missing a configure file, even though the installation file mentioned it. This looks like a better repository https://github.com/Distrotech/libilbc-webrtc

so what you do is

git clone https://github.com/Distrotech/libilbc-webrtc.git
cd libilbc-webrtc
./configure
make
make install

then after don't forget to actually use the option you added in the brew file like so:

brew install --with-ilbc -v

Flip

Posted 2015-01-12T18:10:56.987

Reputation: 95

Regarding the libilbc repository mentioned in the FFmpeg docs: running autoreconf -fiv will create the configure file.

– llogan – 2015-01-13T01:10:35.880

1

I gave up of using ffmpeg for this. I solved the problem using afconvert (included by default on MacOS). For example:

afconvert test.mp3 -o test.caf -d ilbc

albertocsouto

Posted 2015-01-12T18:10:56.987

Reputation: 11

But the OP specified ffmpeg. – suspectus – 2015-04-17T16:12:27.997

I solved the issue with the selected answer but I'm glad to know about this alternative. – Fabien Snauwaert – 2015-04-17T16:27:39.747