niedral
niedral

Reputation: 21

Splitting two channels of a WAV file into separate stereo files using ffmpeg

When activating RAW audio on a GoPro camera, you will get a WAV file with 4 channels. Channels 1 and two are the left and the right channel of the audio. Actually, I have no idea what channels 3 and 4 are doing. For me they are empty. Now I want to have the channels 1 and 2 as dedicated WAV files even turned into a stereo format. At the moment I achieved this with a two-step process using the ffmpeg command line tool like: Splitting the channels into separate files

ffmpeg -y -i source.wav -c pcm_s32le -filter_complex 'channelsplit=channel_layout=4.0[C1][C2][C3][C4]' -map '[C1]' channel1.wav -c pcm_s32le -map '[C2]' channel2.wav -map '[C3]' channel3.wav -map '[C4]' channel4.wav

and then convert the mono files into stereo

ffmpeg -y -i channel1.wav -c pcm_s32le -ac 2 channel1-stereo.wav

My question is now if I can do this in one step and even just ignore the two channels I don't care about?

Right now I need to create temporary files for all four channels and then do a second step to convert the two channels I'm interested in into stereo.

Upvotes: 1

Views: 1218

Answers (1)

Gyan
Gyan

Reputation: 93329

Add -ac 2 before each output filename.

ffmpeg -y -i source.wav -filter_complex 'channelsplit=channel_layout=4.0[C1][C2][C3][C4]' -map '[C1]' -ac 2 -c pcm_s32le channel1.wav -map '[C2]' -ac 2 -c pcm_s32le channel2.wav -map '[C3]' -ac 2 -c pcm_s32le channel3.wav -map '[C4]' -ac 2 -c pcm_s32le channel4.wav

Upvotes: 1

Related Questions