How to Extract Audio Channels Using FFmpeg Pan Filter

Working with multi-channel audio files can be challenging, but FFmpeg’s powerful pan audio filter makes it easy to isolate and extract specific channels. This guide provides a direct, step-by-step approach to using the pan filter to map, split, and extract individual audio channels—such as left, right, center, or LFE—from multi-channel tracks into new mono or stereo files.

Understanding the Pan Filter Syntax

The basic syntax for the pan filter is:

-af "pan=layout|outputs"

You can reference input channels either by their standard names (such as FL for Front Left, FR for Front Right, FC for Front Center) or by their zero-based index numbers (c0, c1, c2, etc.).


Example 1: Extracting a Single Channel to Mono

To extract a single channel from a multi-channel file and save it as a mono audio file, define the output layout as mono and map the desired input channel to the single output channel (c0).

Extracting the Center Channel from a 5.1 Track

In a standard 5.1 layout, the Center channel is typically the third channel (FC or c2).

ffmpeg -i input.wav -af "pan=mono|c0=FC" output_center.wav

Extracting the First Channel (Left) using Index Numbers

If you prefer to use channel indexes:

ffmpeg -i input.wav -af "pan=mono|c0=c0" output_left.wav

Example 2: Extracting Specific Channels to a Stereo File

You can also combine specific channels from a multi-channel track into a new stereo file. For example, if you want to extract the Left and Right channels from a 5.1 audio stream and ignore the rest:

ffmpeg -i input_51.wav -af "pan=stereo|c0=FL|c1=FR" output_stereo.wav

In this command: * stereo defines the output format (two channels). * c0=FL maps the front-left input channel to the left output channel. * c1=FR maps the front-right input channel to the right output channel.


Example 3: Extracting Rear Surround Channels to Stereo

If you want to extract the rear surround channels (usually BL and BR or SL and SR) and save them as a separate stereo track:

ffmpeg -i input_51.wav -af "pan=stereo|c0=BL|c1=BR" output_surround.wav

Tips for Working with the Pan Filter