Split stereo sound into two channels

Problem

Split a stereo sound file into its front left (FL) and front right (FR) channels.

Solution

ffmpeg \
    -i input_sound_file \
    -map_channel 0.a.0 \
    output_FL_file \
    -map_channel 0.a.1 \
    output_FR_file

Command syntax

ffmpeg
starts the command
-i input_sound_file
path, name and extension of the input sound file
-map_channel 0.a.0
grabs the left channel of a stereo sound
output_FL_file
path, name and extension of the output file for the left sound channel
-map_channel 0.a.1
grabs the right channel of a stereo sound
output_FR_file
path, name and extension of the output file for the right sound channel

Discussion

As usual in IT, the numbering of the sound channels starts at 0, not at 1 («zero-based numbering»).

Check with ffprobe the streams’ mapping to ensure the code is accurate, and invert the channels if needed.


2016–07–26