Skip to content

libobs, win-wasapi: Enable channel routing for Audio Input Capture#12942

Open
pkviet wants to merge 3 commits intoobsproject:masterfrom
pkviet:channelselect
Open

libobs, win-wasapi: Enable channel routing for Audio Input Capture#12942
pkviet wants to merge 3 commits intoobsproject:masterfrom
pkviet:channelselect

Conversation

@pkviet
Copy link
Copy Markdown
Member

@pkviet pkviet commented Dec 21, 2025

Description

On libobs side, this adds the capability for the audio resampler (relying on swresampler lib) to
set a matrix for routing of channels.
On win-wasapi side, this applies the new capability to enable channel selection.
This brings parity to wasapi input capture with coreaudio input capture on macOS.

Screenshots

obs64_2025-12-17_17-35-57 obs64_2025-12-17_17-36-14

Motivation and Context

One motivation for that feature are devices which separate stereo inputs.
So if a mike is connected to , say, Input 1 while nothing is connected to Input 2, wasapi usually treats them as
stereo pairs and when obs audio is set to Stereo, the captured Right channel will be silent.
With channel routing capability, it is now possible to duplicate the left channel to the right and have a consistent level.
The issue was brought to my attention by @Fenrirthviti

How Has This Been Tested?

Tested on windows 11 pro 25H2 w/ a logitech webcam + USB sound board.
Disabling the downmix cehckbox enables channel routing.
Swapping between devices resets the channel selections.
Changing the channel selections updates the captured channel.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@pkviet pkviet added Seeking Testers Build artifacts on CI platform/windows Categorizes issue or PR as affecting Windows specifically kind/feature Functionality or other elements that the project doesn't currently have. labels Dec 21, 2025
@pkviet pkviet added this to the OBS Studio 32.1 milestone Dec 21, 2025
Copy link
Copy Markdown
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me overall, also tested this with an virtual 6-ch audio device and allowed me to map them as expected.

Haven't done in-depth checks whether the audio is correctly routed though.

Comment thread plugins/win-wasapi/win-wasapi.cpp Outdated
Comment thread plugins/win-wasapi/win-wasapi.cpp Outdated
Comment thread plugins/win-wasapi/win-wasapi.cpp
@pkviet pkviet force-pushed the channelselect branch 2 times, most recently from b044cb4 to 0922dcc Compare January 16, 2026 14:15
@RytoEX RytoEX removed this from the OBS Studio 32.1 milestone Jan 16, 2026
@psyirius
Copy link
Copy Markdown
Contributor

Just wondering,
Why don't we have speaker-layout selection like obs-asio has?

image

@psyirius
Copy link
Copy Markdown
Contributor

Just built this pr from the current master.
Can't able to select channels in the channel comboboxes.

@pkviet
Copy link
Copy Markdown
Member Author

pkviet commented Feb 19, 2026

Just built this pr from the current master. Can't able to select channels in the channel comboboxes.

yes there was a regression but it is fixed with last push

@pkviet
Copy link
Copy Markdown
Member Author

pkviet commented Feb 19, 2026

Just wondering, Why don't we have speaker-layout selection like obs-asio has?

Because I want to avoid an uncontrolled upmix or downmix.
In obs-asio , if the input audio format differs from obs format (set in Settings > Audio), there is automatically an swresampler called in the audio pipeline which will make the conversion. The channel weights are sane only for the most common conversions (xxx ==> stereo, stereo ===> xxx ) as stated explicitly by the swresampler API. There can be surprising defaults with odd channel volumes otherwise.
There is no conversion though if the input speaker format is the same that is set in obs settings.
Channel routing is imo an advanced feature for people who want fine grained audio control; so the uncontrolled upmixer/downmixer insertion defeats that purpose and that is why I have avoided that here, very deliberately.

pkviet added 3 commits March 20, 2026 18:56
This adds a function allowing to set a custom channel matrix, allowing
channel rerouting. This is useful when sources provide layouts not
supported by obs or to correct incorrect channel assignments.

Signed-off-by: pkv <pkv@obsproject.com>
This adds a hint for the 'downmix' checkbox.
It is likely unclear to users what this checkbox does or does not.
When disabled, it allows channel selection; when enabled it lets obs
deal with speaker layout mismatches between source and obs.

Signed-off-by: pkv <pkv@obsproject.com>
This adds the capability to select input channels exposed to obs.
(The same is already possible for coreaudio input sources.)

Signed-off-by: pkv <pkv@obsproject.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Functionality or other elements that the project doesn't currently have. platform/windows Categorizes issue or PR as affecting Windows specifically Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants