Using different speaker layouts/number of audio channels in different outputs

sjo98

New Member
Hi! I'm making my first plugin, to solve a very specific problem I have. I would like to be able to record in 8 channel audio (7.1 surround) while simultaneously streaming in stereo (with my own downmixing function to handle the conversion). After digging through the docs and doing a little experimenting, though, I'm not sure it's possible. I could use a second opinion on this.
  • OBS sets speaker layout globally, so all outputs are receiving the same number of channels. AFAICT, there is no setting on the outputs for the number of channels. So just setting the number of channels on the individual outputs is not possible.

  • I then thought that I could add in a conversion callback using `audio_output_connect`, but I believe that is applied to the global pipeline, not an individual output. So again, that doesn't work.

  • My last thought is that I could interrupt the audio signal entering the individual outputs, and modify the channels/downmix there. But I can't seem to find a function that would insert a callback at that point in the chain. Even if there is an appropriate function, I'm not sure I would have any way to affect the number of channels actually being output. I could probably downmix to two channels, but I believe it would still be sending an 8 channel signal just with 6 empty channels.

  • For completions sake, I could technically do a complete overhaul of the audio pipeline to allow sending different audio signals to each output. But that's not exactly feasible.
Is anyone here familiar enough with the audio pipeline to know if this is possible, or if I missed something?

Edit: To clarify, I am recording/streaming both audio and video. My problem is only with the audio side though.
 
Last edited:

AaronD

Active Member
I haven't dug through the code to see what's actually there, but what you describe does line up with the behavior from the user's perspective.

All of OBS's audio chain runs at the same channel count, which is set in Settings -> Audio, with speaker assignments determined only by that channel count.
Each audio source is up/down-mixed to match that global format BEFORE ANY USER INTERACTION AT ALL. That wreaks havoc for those that have a bunch of individual mics on a multichannel interface...

So our standard recommendation for users is to use a DAW for audio, NOT OBS; connect all of the other apps, mics, and speakers to the DAW, NOT OBS; and send the final, finished soundtrack to record and/or stream from the DAW to OBS's global source to pass through completely unchanged. OBS's Monitor, then, is (ab)used to send video soundtracks and other things that originate in OBS, to the DAW, also completely unchanged.
If audio things need to be started, stopped, or modified mid-stream, either do that manually and explicitly in the DAW, or use something like the Advanced Scene Switcher plugin to send messages to the DAW in response to things happening in OBS.

For completions sake, I could technically do a complete overhaul of the audio pipeline to allow sending different audio signals to each output. But that's not exactly feasible.
That's probably what's required, unfortunately. There have been lots of requests to fix the wacky design or add immensely useful features that are incompatible with that design, and the answer has always been that OBS was never designed to be anywhere near what it is today.

it was originally much simpler, with probably no experience with the pro world and why it is the way it is, and the pile of band-aids and quick fixes means that it's effectively a complete scrap and rewrite worth of work anyway, even to do something that would normally be minor. The devs know this, and so they're looking at what that rewrite should be. I would not expect any changes to the existing audio system at all, until it's completely replaced.

Maybe you could connect with them and help with that???

---

I've come to the idea myself, mostly in agreement with one of the devs a while ago after offering my own specific suggestions, that OBS's audio needs to be split out into a sort of "large plugin" model. That is, ALL of the audio processing is in that one plugin, and OBS proper just shovels it in and out of there with no modification whatsoever. External connections - like other apps, mics, and speakers - would go directly to the plugin, so OBS proper knows nothing about them at all.

Probably ship a "default" plugin with OBS, that is a copypasta of the present mess, just so existing rigs don't break, with the idea that the community will make a series of much better ones for different purposes.
 
Last edited:

sjo98

New Member
Well that's unfortunate, but not unexpected.

That wreaks havoc for those that have a bunch of individual mics on a multichannel interface...
Yep, that's actually my situation, or rather a friend's situation. I don't know all the details, but I do know he actually is currently going through a DAW for audio processing. My understanding is he's currently downmixing everything to stereo in the DAW to fit the streaming service's requirements, but would like to be able to record the full 8 channel to make later editing easier.

OBS's audio needs to be split out into a sort of "large plugin" model.
Very interesting. My understanding is a lot of OBS's "core" functionality is actually already in plugins, so that would fit the pattern. Having the current pipeline available as a legacy system is definitely a good idea, but I also think it would be helpful to make a fresh one with more customizability - a simple, barebones framework that can then be easily modified. That would give the community a huge leg up for creating more specialized plugins. Though that's easier said than done, and maybe it's better left to the community... I'm sure the devs are already considering their options here. Regardless, I definitely think the "large plugin" model is the way to go.

Maybe you could connect with them and help with that???
Maybe haha, though I'm not sure how much help I would be. I have very little experience with the professional audio world, so I wouldn't be able to offer any insights. Plus this was my first foray into C++ since college, and it was definitely a challenge... I may find some other ways to contribute to the project though.

---

This was a very helpful writeup, even if the conclusion is disappointing. The extra context around it really helps understand why things are the way they are. Thank you!
 

AaronD

Active Member
My understanding is he's currently downmixing everything to stereo in the DAW to fit the streaming service's requirements, but would like to be able to record the full 8 channel to make later editing easier.
Maybe he can record the multitrack version from the DAW? It wouldn't include video of course, but at least one editor (that I know of) can automatically sync up a bunch of sources based on their soundtracks. Then you mute the "scratch tracks" and just use the good one.
 
Top