This is a packaging-friendly copy of the iLBC codec from the WebRTC project. It provides a base for distribution packages and can be used as drop-in replacement for the code from RFC 3591.
libilbc requires the following to compile:
- A C compiler
- A C++ compiler supporting C++14 or later
- A CMake-compatible build system; some options are:
Abseil Common C++ Libraries is also a prerequisite, but it comes bundled with release tarballs (or provided as a submodule for Git users) so there's no need to install it separately.
If you are not using a release tarball, you can clone this repo with:
git clone --depth=1 https://github.com/TimothyGu/libilbc.git git submodule update --init
Generate build files:
If you instead want a static library, instead run
cmake -DBUILD_SHARED_LIBS=OFF .per CMake docs.
cmake --build .
You should now get a library file (.so, .dylib, .dll, .a, or .lib depending on your platform) as well as a ilbc_test program.
(optional) Try it out. This repo comes a sample.pcm audio file that is in a form ilbc_test accepts (raw signed 16-bit PCM, mono, sampled at 8000 Hz). The following command encodes sample.pcm to encoded.ilbc, and then decode it again to decoded.pcm.
./ilbc_test 20 sample.pcm encoded.ilbc decoded.pcm
You can try to play the before/after audio with mpv:
mpv --demuxer=rawaudio --demuxer-rawaudio-rate=8000 --demuxer-rawaudio-channels=1 sample.pcm mpv --demuxer=rawaudio --demuxer-rawaudio-rate=8000 --demuxer-rawaudio-channels=1 decoded.pcm
You can create your own sample file too. The command I used was:
ffmpeg -f pulse -i default -f s16le -filter:a "pan=1|c0=c0+c1,aresample=8000" sample.pcm
which gets the audio input from Linux's PulseAudio, and then remixes and resamples it.
(optional; for Unix-like systems) Installing. If you want to install the library and the ilbc_test utility to system locations, run either
make installdepending on which build system you chose (or
cmake --install .on CMake 3.15 or later). By default, the library gets installed to /usr/local; to tweak the install prefix, set
cmake; see docs.
The following platforms are regularly run on CI and are thus supported:
- ARMv5–7 (32-bit; soft and hard float)
- ARMv8 (64-bit)
- PowerPC (little-endian) (64-bit)
- MIPS (little-endian) (64-bit)
- macOS on x86-64
- x86-64 with Visual C++ 2019
- x86-64 with clang-cl
The following architectures get cross-compiled on CI and thus probably work. But we don't know for sure if it actually runs:
- MIPS (little-endian) (32-bit)
- PowerPC (big-endian) (32/64-bit)
- RISC-V (64-bit)
- SPARC (64-bit)
- ARM64 with Visual C++ 2019
These platforms are known to not work:
- MIPS (big-endian) (32-bit)
- ARM with Visual C++ 2019 (32-bit)
All other platforms may work out of the box. If they don't, a simple change to rtc_base/system/arch.h will most likely fix it up.
There are some additional CMake options available to the fine folks packaging this library. For the most part, we use the GNUInstallDirs CMake module to determine where things are installed, which should generally do the right thing. If it doesn't, try:
-DCMAKE_INSTALL_PREFIX=<dir>for the prefix (usually defaults to /usr/local)
-DCMAKE_INSTALL_BINDIR=<dir>for executables and Windows DLLs
-DCMAKE_INSTALL_DOCDIR=<dir>for various Markdown documentation files
-DCMAKE_INSTALL_INCLUDEDIR=<dir>for C headers
-DCMAKE_INSTALL_LIBDIR=<dir>for static libraries (
.a), Windows DLL import libraries (
.lib), and non-Windows dynamic libraries (