dimtpap / obs-pipewire-audio-capture

🔊 Audio device and application capture for OBS Studio using PipeWire
https://obsproject.com/forum/resources/pipewire-audio-capture.1458/
GNU General Public License v2.0
346 stars 12 forks source link

Capture problems for devices with multiple ports #56

Closed chalkwalk closed 4 months ago

chalkwalk commented 5 months ago

TL;DR: Something is not working correctly when attempting to capture multiple disjoint audio streams from a single multiple port audio interface, in particular I get a mix of all the audio received by the pipewire sinks configured for the device in some capture sources. The audio streams are indeed disjoint when correspondingly recorded in Audacity.

I'm using OBS 30.1.2 and the 1.1.4 binary release of the pipewire audio capture.

The interface (Berhginer UMC404HD) has 4 input and 4 output ports, which appear in Pipewire as:

My goal is to recreate my jack setup; 4 sources corresponding to a stereo mic pair (through filters, and direct) and a stereo line input (through filters and direct) which are captured in 3 audio streams in the output video: a mix of the filtered mic and line audio, and a stream each for the unfiltered mic and line audio.

To do this I create 4x Pipewire input sources, all with the same device selected (UMC404HD 192k). This results in 4 new Nodes in the Pipewire graph (viewed with qpwgraph),"OBS Audio Capture [OBS]" and co. By default they each have 4 audio sources (monitor{FL,FR,RL,RR}) and 4 audio sinks (input{FL,FR,RL,RR}) which are connected to the corresponding "capture_" sources from the audio interface; in this configuration, all 4 sources receive the same audio (a mix of all 4 inputs) as one might expect, but this is not what I want, I therefore disconnect all the links to the OBS Audio Capture nodes and reconnect as follows:

If I look at the Audio Mixer volume meters (or correspondingly the audio in a recorded video), my filtered mic pair and raw mic pair both capture only the mic audio. The filtered line in pair and raw line in pair both capture the line audio and the mic audio.

My hope is to get to the bottom of the problem, and potentially see a more refined configuration mechanism to allow the routing to be part of the OBS configuration (vs me having to wire things up using the pipewire command line, or qpwgraph).

dimtpap commented 4 months ago

This sounds a bit too advanced for the simple use cases covered by this plugin.

You can configure PipeWire to split the interface into nodes, each having the ports you want from the interface, and then have a capture source for each of those nodes.

There's a guide exactly for this in the PipeWire wiki https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#behringer-umc404hd-speakersheadphones-virtual-sinks

Some other starting points https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#what-is-the-pro-audio-profile https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Guide-Split#split-capture-device-into-multiple-sources https://docs.pipewire.org/page_module_loopback.html