How to Compile FFmpeg with Libspeex Support
This article provides a straightforward, step-by-step guide on how to
enable the libspeex audio library during the FFmpeg
compilation process. By following this guide, you will learn how to
install the necessary dependencies, configure the FFmpeg build options
with the appropriate flags, and verify that the Speex encoder and
decoder are successfully integrated into your custom FFmpeg build.
Step 1: Install System Prerequisites and Libspeex
Before compiling FFmpeg, you must install the build tools and the
development headers for libspeex.
On Ubuntu/Debian systems, run:
sudo apt update
sudo apt install build-essential yasm pkg-config libspeex-devOn CentOS/RHEL/Fedora systems, run:
sudo dnf groupinstall "Development Tools"
sudo dnf install yasm pkgconfig speex-develOn macOS (using Homebrew), run:
brew install xz speex pkg-configStep 2: Download the FFmpeg Source Code
Clone the official FFmpeg Git repository or download the latest release tarball. Cloning via Git ensures you have the latest stable codebase:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpegStep 3: Configure the Build with Libspeex
To enable the Speex library, you must pass the
--enable-libspeex flag to the ./configure
script. Because Speex is an external library, you must also include the
--enable-gpl flag.
Run the configuration script:
./configure --enable-gpl --enable-libspeexNote: If you plan to use other libraries, you can append them to
this command (e.g., --enable-libx264 or
--enable-libmp3lame).
Step 4: Compile and Install FFmpeg
Once the configuration completes without errors, compile the binaries using your system’s available processor cores to speed up the process:
make -j$(nproc)After the compilation finishes, install the compiled binaries to your system:
sudo make installStep 5: Verify the Installation
To confirm that FFmpeg was compiled successfully with
libspeex support, check the enabled configuration flags and
the available audio codecs:
ffmpeg -versionLook for --enable-libspeex in the configuration
output.
Next, verify that the Speex encoder and decoder are available:
ffmpeg -codecs | grep speexYou should see output indicating that both the Speex decoder and
encoder (libspeex) are ready for use.