Working with audio channels

Not all file formats support multi channel audio, or work with it equally well. We found it easiest to work with raw wave files (for great support with Audacity, e.g.) or AAC.

To get AAC support, make sure to compile ffmpeg with AAC yourself.

If you want to work with audio channels in a way not listed here, this page is a great help. It lists all the possible combinations on merging, mixing, splitting channels.

Extracting channels

To extract the first two channels from the first audio stream, into two separate audio files:

ffmpeg -i inputfile.aac -map_channel 0.0.0 mono_left.wav -map_channel 0.0.1 mono_right.wav

Combining channels into a single file

The following combines to separate, mono streams into a single stream. One file becomes the left stereo channel, the other the right.

ffmpeg -i mono_left.wav -i mono_right.wav -codec:a aac -filter_complex "[0:a][1:a]amerge" stereo.aac

If you want both input streams to be played on both left and right, use amix instead of amerge:

ffmpeg -i mono_left.wav -i mono_right.wav -codec:a aac -filter_complex "[0:a][1:a]amix" stereo.aac