How to Use the FFmpeg bs2b Filter

The bs2b (Bauer stereophonic-to-binaural) filter in FFmpeg is an audio filter designed to improve headphone listening by processing stereo audio into a binaural signal. This article explains how the filter works, how to verify your FFmpeg installation supports it, and how to apply the filter using various built-in presets and custom parameters to reduce headphone listening fatigue.

What is the bs2b Filter?

When listening to stereo audio through headphones, the extreme channel separation (where the left channel only reaches the left ear, and the right channel only reaches the right ear) can cause acoustic fatigue. The bs2b filter applies a crossfeed effect, mixing a delayed and attenuated portion of each channel into the opposite channel. This emulates how we naturally hear stereo speakers in a room, creating a more cohesive, natural, and comfortable soundstage.

Verification

Before using the filter, ensure your version of FFmpeg was compiled with libbs2b support. Run the following command in your terminal:

ffmpeg -filters | grep bs2b

If the output lists bs2b, the filter is available. If no output appears, you must install or compile a version of FFmpeg that includes the --enable-libbs2b configuration flag.

Basic Usage

To apply the bs2b filter using its default settings, use the audio filter (-af) flag in your command:

ffmpeg -i input.mp3 -af bs2b output.mp3

Using Built-in Presets

The bs2b filter includes built-in profiles based on popular hardware crossfeed circuit designs. You can specify these profiles using the profile parameter:

To apply the Chu Moy preset, use:

ffmpeg -i input.wav -af bs2b=profile=cmoy output.wav

To apply the Jan Meier preset, use:

ffmpeg -i input.wav -af bs2b=profile=jmeier output.wav

Custom Parameter Configuration

If you want to fine-tune the crossfeed effect beyond the presets, you can manually set the low-pass filter cut frequency (fcut) and the feed level (feed):

To configure a custom setup with a cut frequency of 750 Hz and a feed level of 5.0 dB (entered as 50):

ffmpeg -i input.mp3 -af bs2b=fcut=750:feed=50 output.mp3