How to Compile FFmpeg with libbs2b
Compiling FFmpeg with the libbs2b (Bauer
stereophonic-to-binaural) library allows you to use the
bs2b audio filter, which applies crossfeed to stereo audio
to reduce headphone listening fatigue. This guide outlines the
prerequisites, dependency installation, source code configuration with
the --enable-libbs2b flag, compilation, and verification
steps necessary to build a working FFmpeg binary with
libbs2b support on Linux-based systems.
1. Install Build Tools and Dependencies
Before compiling, you need standard compilation tools, assembly
compilers, and the development headers for libbs2b.
On Debian, Ubuntu, or Mint systems:
sudo apt update
sudo apt install -y build-essential yasm nasm pkg-config git libbs2b-devOn Fedora, RHEL, or CentOS:
sudo dnf install -y gcc gcc-c++ make yasm nasm pkgconfig git libbs2b-develOn Arch Linux:
sudo pacman -S --needed base-devel yasm nasm git libbs2b2. Download FFmpeg Source Code
Clone the official FFmpeg Git repository to get the latest source:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpegAlternatively, checkout a specific stable release if preferred:
git checkout release/6.13. Configure the Build
Run the ./configure script, ensuring you include the
--enable-libbs2b flag. You can also include any other
optional libraries or flags your workflow requires.
./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-libbs2b \
--enable-nonfreeNote: Ensure pkg-config can locate
libbs2b.pc. If the script exits with an error indicating
libbs2b is not found, verify that the development package
was properly installed.
4. Compile and Install
Compile FFmpeg using all available CPU cores, then install it to your system:
make -j$(nproc)
sudo make installAfter installation, refresh your shared library cache if necessary:
sudo ldconfig5. Verify the Installation
Confirm that the new binary was installed and that the
bs2b filter is registered:
ffmpeg -filters | grep bs2bIf successful, the output will display the filter details:
... bs2b A->A Bauer stereophonic-to-binaural DSP.
6. Example Usage
To process an audio file using the default crossfeed profile (suitable for standard headphones):
ffmpeg -i input.mp3 -af "bs2b=profile=default" output.mp3Other available profiles include cmoy (Chu Moy circuit
simulation) and jmeier (Jan Meier circuit simulation).