How to Apply Crossfeed in FFmpeg

This article provides a quick guide on how to use the crossfeed audio filter in FFmpeg to improve your headphone listening experience. You will learn the basic concepts of audio crossfeed, the primary parameters of the FFmpeg crossfeed filter, and practical command-line examples to apply this effect to your audio files.

What is Crossfeed?

When listening to stereo tracks on headphones, the extreme channel separation (left channel only to the left ear, right channel only to the right ear) can cause unnatural spatial imaging and listener fatigue. Crossfeed solves this by subtly feeding a portion of the left channel’s signal into the right channel, and vice versa, while applying a slight delay and low-pass filter. This simulates how we naturally hear stereo speakers in a physical room.

FFmpeg Crossfeed Filter Syntax

In FFmpeg, the crossfeed filter is applied using the -af (audio filter) flag. The basic syntax is:

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

This command applies the crossfeed filter using the default settings, which is often sufficient for a subtle, natural-sounding blend.

Customizing Crossfeed Parameters

You can fine-tune the crossfeed effect by adjusting its specific parameters. The syntax for applying custom parameters is:

crossfeed=parameter1=value1:parameter2=value2

Here are the key parameters available in the FFmpeg crossfeed filter:

Example 1: Pronounced Crossfeed

If you want a stronger crossfeed effect for tracks with extreme stereo separation (such as early stereo recordings from the 1960s), increase the strength parameter:

ffmpeg -i input.wav -af "crossfeed=strength=0.45:range=0.7" output.wav

Example 2: Subtle Crossfeed

For a very subtle reduction in headphone fatigue without altering the stereo image too much, lower the strength:

ffmpeg -i input.wav -af "crossfeed=strength=0.15:range=0.4" output.wav

Real-Time Playback Testing

To test how the crossfeed filter sounds in real-time before exporting a file, you can use FFmpeg’s sister tool, ffplay:

ffplay -i input.mp3 -af "crossfeed=strength=0.3"