How can I use only one audio channel?

I have an alsasrc for a microphone with n audio channels (audio/x-raw,channels=n on the source pad). I want to use just the first channel, leaving a source pad with audio/x-raw,channels=1. How can I do this?

You could put a capsfilter element with caps audio/x-raw,channels=1 right after the alsasrc to put constraints on the caps.

Thanks. This seems to be either mixing all the channels together or choosing the wrong channel, though. How can I explicitly choose the single channel to use?

Upon further investigation, it seems that the channel mixing is being performed by ALSA itself, as I was using a plughw device.

If I use hw instead, to stop ALSA mixing channels, capability negotiation fails if I use a filter to change the number of channels.

I need an element that lets me use only a single channel.

Ah, it seems I need deinterleave.

1 Like