# Surround Downmixing Support



## velvitonator (Sep 18, 2016)

Note: I duped this thread of mine from the old OBS support forum, since I've actually found it in OBS Studio as well. The recorded samples sound much the same, so I'll reuse them; whatever issue OBS had, seems to be present in Studio as well.

I use a Logitech G930 to capture both my mic audio and the game audio. Trouble is, OBS seems to only get the left/right channels of the game audio.
Surprisingly, this actually seems to work well enough in a lot of games that I can only guess actually merely "upmix" to 7.1, but I've recently tried playing Deux Ex: Human Revolution Director's Cut, and it's plainly obvious that something's amiss--a lot of audio is too quiet, including the menu sounds, and Jensen's dialogue sounds reverberated.

I should note that en/disabling surround in the Logitech software doesn't seem to help--it looks like Windows 10 always sees the audio device as 8-channel, and so reports this to all applications. The game doesn't have any way of knowing to output Stereo. There's no way to configure it as a 2-channel device, either. =/

Here's two videos in the beginning of DX3 demonstrating the issue:
DX3 Recorded in Stereo
DX3 Recorded In Surround

Notice how quiet the menu is, as well as the general mix, comparatively. Note also that Jensen's lines seem a little muffled.

I know a lot of people use surround headsets, and some people even have proper surround setups. Indeed, some Googling reveals that this problem surfaces from time to time.
I understand that supporting 7.1 output benefits only a fraction of users--namely, those like me who largely record offline and upload later. While this would be nice, I think that at a minimum OBS should downmix to stereo on its own, so that the video at least sounds _like_ what I hear to viewers.

Thanks,
-Velvit


----------



## Suslik V (Sep 18, 2016)

You can navigate to the system Playback devices>Speakers>Configure speakers and change you system to output to Stereo configuration (and full-range if they are good enough to play low frequencies).


----------



## velvitonator (Sep 18, 2016)

You actually can't. The only option is 7.1 surround for the G930. My guess is that the driver tells Windows it's an 8 channel device and nothing else.

Even if it were possible to change it, I think ideally it should be possible to use OBS without having to degrade your own experience, thus why I decided to mark this as a feature request instead of a bug.

Personally, I'd like proper multichannel output best--then I can futz with the mix myself offline (or let the video upload site deal with the downmix, assuming they do one). But that wouldn't benefit streamers at all (most livestream sites don't handle multichannel audio very well), so downmixing to stereo seems like a good compromise benefits everyone.

Though, after poking around the code and building a few local versions of OBS, it definitely looks like OBS is _trying_ to downmix, but something is going horribly wrong somewhere and I don't yet understand why or where.
It should actually be capable of downmixing whatever crazy audio setup you have to stereo, but something's wrong with the 7.1 downmix and I don't actually have other setups to test and see if it's just 7.1 or other ones as well.

-Velvit


----------



## Suslik V (Sep 18, 2016)

?

Impossible? How hard you are trying to make it stereo (headset)?

*Edit: *some info https://forums.wildstar-online.com/...4817-surround-sound-on-logitech-g930-headset/


----------



## velvitonator (Sep 19, 2016)

As in, there's no way to configure the G930 as anything other than 7.1:



 


That Wildstar thread seems to be a bug in Wildstar. The audio is perfectly fine for me when playing; it's just the recorded video that has problems, i.e. a bug in OBS's downmixing code.
The switch on the back of the G930 only changes whether the software performs Dolby processing or not; it doesn't actually change whether it appears as stereo or surround to applications, which is the relevant thing--OBS records what the game is outputting to the audio device it's using, and in the case of the G930 that will always appear to be a 7.1 audio stream.

-Velvit


----------



## Suslik V (Sep 19, 2016)

OBS Studio doesn't downmix anything. There is only Stereo and Mono outputs available for Studio. Application uses devices in shared mode, so what windows providing as request for sound that OBS records. Probably you hear only Left Front and Right Front in OBS. There is a lot of info on the internet about 930 and their surround.

Unplug headset and uninstall logitech software and see is it stereo or not (or ask logitech support how to use stereo mode on their device).

If all fails - buy 3.5 mm jack, dismount all "surround", solder headphone speakers to 3.5 mm jack and plug it in your PC. Use with OBS as stereo device. Good luck.

*Edit:* you need another one 3.5 mm jack for mic


----------



## velvitonator (Sep 19, 2016)

Suslik V said:


> OBS Studio doesn't downmix anything.
> There is only Stereo and Mono outputs available for Studio


Actually, it does. Audio goes through LibAV's swresample library, and OBS actually keeps it in the device format until that point. It's swresample that takes it from device to mono or stereo.



Suslik V said:


> Application uses devices in shared mode, so what windows providing as request for sound that OBS records. Probably you hear only Left Front and Right Front in OBS.


I thought so, too, but a few simple tests with audio in specific channels demonstrated that wasn't really the case before I ever looked at the code.

Also, it turns out that's not exactly how the Windows Sound API works--it tells _you_ what format the device you're trying to capture has, and it's up to you to decide what to do if you have specific output requirements. OBS would have to use this information if it wanted to use only left/right channels, but as mentioned above it turns out it's all being fed through a resampling library anyway.



Suslik V said:


> There is a lot of info on the internet about 930 and their surround.


And almost all of it is speculation, supposition, or outdated.



Suslik V said:


> Unplug headset and uninstall logitech software and see is it stereo or not (or ask logitech support how to use stereo mode on their device).


The screenshot above is independent of the Logitech software; the driver itself seems to report to Windows that it's a 7.1 device. It has no true "stereo mode".



Suslik V said:


> If all fails - buy 3.5 mm jack, dismount all "surround", solder headphone speakers to 3.5 mm jack and plug it in your PC. Use with OBS as stereo device. Good luck.
> 
> *Edit:* you need another one 3.5 mm jack for mic


No, I definitely think that enough people use surround headphones or have proper surround setups to warrant at a minimum a working downmix in OBS, instead of obnoxious, flippant non-solutions.


----------



## RytoEX (Sep 19, 2016)

velvitonator said:


> Actually, it does. Audio goes through LibAV's swresample library, and OBS actually keeps it in the device format until that point. It's swresample that takes it from device to mono or stereo.



Does that mean the issue likely lies within libswresample and not OBS Studio, or is that still not fully determined?


----------



## Suslik V (Sep 19, 2016)

Can you install device manually and select generic driver?


----------



## velvitonator (Sep 19, 2016)

RytoEX said:


> Does that mean the issue likely lies within libswresample and not OBS Studio, or is that still not fully determined?


Given that Libav is the core of ffmpeg, and people use ffmpeg for all sorts of insane shenaniganery, I'd be surprised if the issue was there. Also, looking at _its_ code, it seems like it should be doing the right thing.

Anyway, I did find that there was an issue with the speaker masks being used--what the Microsoft header calls "5.1/7.1" is actually a weird setup that nobody actually uses, and it looks like their macros for those are deprecated anyway in favor of some that _do_ represent typical 5.1/7.1 setups.
.
I've renamed a couple of special speaker masks OBS had to handle this sort of thing (only it was handling it backwards, if you will) and piped the "normal" 5.1/7.1 setups through to libav, which has its own set of speaker masks that OBS was also mapping to incorrectly in a few cases (libav has some similar names as OBS does, but for different setups).

I'll test it and upload a video of what that sounds like (in DX3, for consistency), but hopefully it gets close enough that, even if not exactly like stereo, it's a decent experience for viewers. I'll probably make a pull request either way, since there's a clear bug lying around here.



Suslik V said:


> Can you install device manually and select generic driver?


I tried this earlier and the generic driver only has stereo, which is to be expected, but I haven't listened to it.
I have a vague recollection, though, of having to manually install Logitech's driver to get the 7.1 to work, and I vaguely recall that the headset worked in this state, although it sounded a little weird.

Regardless, I'm getting pretty close to at least fixing the existing downmix. If that still doesn't work, I'll probably explore a plugin with some kind of custom downmixing, though I'm wary of straying from the usual matrix-downmix; it might be that all that's needed is a different set of coefficients that could be exposed in the UI.

I'll probably open a separate thread asking for proper multichannel output for standard formats like 2.1/quad/5.1/7.1.

-Velvit


----------



## sleepdotexe (Nov 3, 2016)

velvitonator said:


> Regardless, I'm getting pretty close to at least fixing the existing downmix. If that still doesn't work, I'll probably explore a plugin with some kind of custom downmixing, though I'm wary of straying from the usual matrix-downmix; it might be that all that's needed is a different set of coefficients that could be exposed in the UI.



Any luck with this? Currently also experiencing problems with trying to record whilst using a 7.1 headset. I also have a thread on this, but can't seem to get a reply.


----------



## The Classified Rebel (Apr 17, 2017)

I to am trying to get an answer since my stream and recordings feel like they are hearing my game through a tunnel..


----------

