user1908597
user1908597

Reputation:

Discard channels when recording from audio interface with FFmpeg

I'm calling ffmpeg from a program I'm writing in order to record audio from an audio interface. The audio interface has six channels and what I'd like to do is only record from the first two audio channels, discarding the rest. I can't work out how to do this or if it is even possible from the documentation.

The command I'm using is as follows:

ffmpeg -f alsa -acodec pcm_s32le -ac 6 -ar 44100 -i hw:CARD=K6,DEV=0 output.wav

Is this something that is possible? If so, how?

Upvotes: 0

Views: 308

Answers (1)

Gyan
Gyan

Reputation: 93181

Use

ffmpeg -f alsa -acodec pcm_s32le -ac 6 -ar 44100 -i hw:CARD=K6,DEV=0 
       -af "pan=2c|c0=c0|c1=c1" output.wav

The first argument to the pan filter is the number of output channels. Then come the individual channel mixes. Here it is first out channel is first in channel, and a similar assignment for the second.

Upvotes: 2

Related Questions