Closed dencur closed 2 years ago
is it possible to get a sample of your source ? i'll have a look. It's quite odd. It 's probably that the channel layout is not correctly retrieved by swresample lib.
Thanks! Here's a public sample that has 5.1, and showcases the issue very well: https://drive.google.com/file/d/0BwxFVkl63-lETFVpOWRVVGNfeEU/view?usp=sharing&resourcekey=0-e9HrVO61IGkoTc_GBMNbww
Pulled from: https://kodi.wiki/view/Samples
Ok the issue stems from the fact that the speaker layout is 5.1(side) while we use 5.1(back) which is the default 5.1 layout. Media Source correctly identifies the layout while VLC Source doesn't give that info to obs. I'll check the vlc api; it's probably an easy fix.
I am having the exact same problem. Thank you @dencur for reporting this issue thoroughly. It seems to occur only on OBS 27.2.X. I can only add that downgrading OBS to version 27.1.3 solved it for me though I am aware that it's not the ideal solution. Let's hope it will be fixed in the next releases.
Bad news; libvlc API doesn't give any information about the speaker layout of the media source ... I've confirmed that with a vlc dev. So this can't be fixed easily. There are solutions though for a motivated user:
That's unfortunate. I've been streaming a movie night with friends for over a year now and I was really looking forward to a fix for the surround sound bug. A lot of the movies I stream if not all seem to be bugged on newer obs releases. I've downgraded obs back to 27.1.3 but I'd hoped that would only be only a temporary fix. I tried ffmpeg to downmix the audio to stereo myself but the balance always seemed off and doing that every time for every movie seemed tedious. As for the rematrix filter, I don't see an option for that in obs? How can I use it to fix the channels?
@pkviet Thanks for the update. Real downer, same sentiment as @TinFoilFox. What changed after 27.1.3 that caused the issue? If this were to be fixed, where would it be fixed?
Since this is a known issue that is reproducible and present in the current OBS release, wouldn't it make more sense to leave it open so that another contributor might be able to fix it?
I found a OBS plugin to rematrix sound channels and downloaded the 5.1 Dolby Surround Test and the DTS HD Master Audio Sound Check to test which channels go where and I have the same center channel issues with it coming out of the left side and I can't even hear the Rs channel. Using the standard OBS media source I can hear all the channels in their proper places but I can't use things like selecting different audio tracks or subtitles like with the VLC plugin.
Update: Using the rematrix-filter plugin I have successfully remapped the channels to their correct sources. The correct channel order for 5.1 is: 1, 2, 5, 6, 3, 4. Unfortunately I was never able to get any output from channel 4 from both the VLC plugin and the media source, whether that was the Rs channel (by default) or the LFE channel (once rematrixed).
However, I am still confused as to why this is happening? Every piece of 5.1 surround sound media I play with the VLC plugin gets its channels mixed up. Whether I play a movie or official Dolby test audio, the VLC plugin seems to change the ordering of the channels.
Addendum: I should also add that the rematrix filter only works if you have set OBS to 5.1 in OBS' audio settings. If you set your audio back to stereo, all your channel rematrix settings will not take effect. While streaming in 5.1 works in my specific application, it seems impractical to assume that everyone will be able to do the same, and I would really like to find out why the VLC plugin specifically is having issues where ever other media player seems to correctly order the channels.
Thanks for doing the work to figure out the workaround. Very hacky, requires a 3rd party plugin, and I agree nearly every video I play has this issue. Definitely think this is still worth being listed as a open issue to be fixed as it's not working as intended at the moment.
@pkviet so if this change renders VLC plugin unusable for sources with more than 2 channels, what is the reason to keep it?
@pkviet so if this change renders VLC plugin unusable for sources with more than 2 channels, what is the reason to keep it?
you should correct that sentence. It's plain wrong. That the plugin assigns wrong channels for some sources doesn't mean that it doesn't work at all for more than 2 channels. As long as you stick to: mono, stereo, surround (FL FR FC), 4.0 ((surround + BC), 4.1, 5.1(back) (=surround + BL + BR), 7.1(side) (= surround + SL +SR + FLE + BL + BR), there shouldn't be any issue. Libvlc only tells us the number of channels; how are we supposed to guess that it's 5.1(side) rather than 5.1(back) ?
Here's the explanation about the screenshots and I now understand why you would believe that surround sound worked before in vlc source.
Restoring that slider is NOT possible for a true surround sound source (ex: 5.1). There's no reason to restore behaviour to 27.1.3 because 27.1.3 removes ALL surround sound channels.
It couldn't work : the vlc plugin did not support surround sound at all. It would keep only the first two channels.
Ok, to test this out I have in front of me two instances of OBS. 27.1.3 and the most recent 27.2.4. I will play the test movie clip and Dolby test footage linked above.
When 5.1 surround sound is played on the earlier version of OBS it is as you say and only two channels are being output by OBS no matter what setting I use in the settings menu. However, it appears as though all channels are down mixed appropriately to stereo most notably with center dialogue coming out of both Left and Right.
When I play the same samples on the latest version of OBS I can now see all channels correctly and the settings menu actually works. But the most audible change is now that the center dialogue comes almost exclusively from the left ear. The order of the channels now seems wrong. Using the rematrix plugin linked above I can reorder the channels so that they sound as they did in the earlier version.
In 27.1.3 audio was properly downmixed to stereo. You were limited to only two channels but they were balanced. Now in 27.2.4 the audio does not downmix to stereo properly.
Thanks for an explanation @pkviet . But if I check the "Mono" option, the audio still seems to be outputted only via left channel.
ok @TinFoilFox i understand better the concern. I can fix that. I'm reopening.
once CI is done, please test whether the PR fixes the issue. Link to the builds: https://github.com/obsproject/obs-studio/actions/runs/2277949011 (there will be zips once the compilation is done)
so check whether:
Note: As I do not have surround sound setup I cannot test how this build performs on an actual surround sound stage. For this test I used my headphones and computer speakers.
5.1 and 7.1 audio tests are successfully down mixed to stereo on my headphones. Correctly placing the center channel between left and right. All back channels are on the appropriate sides.
Audio channels are back to having the center channel exclusively coming out of the left side of my headphones and channels seemingly out of order with Back Right missing (I'm assuming this is because OBS or VLC thinks BR is the LFE channel and discards it or something).
For me this fixes my issues, as I am more than content to set OBS to stereo and have the audio be downmixed when I am streaming. Neither I nor any of those viewing my stream have surround setups so the priority for me is a balanced stereo output.
Thank you for your help and I hope to see this merged into master. :)
@TinFoilFox note that the fix works by leaving the downmixing to vlc. But if someone does output to 5.1, my previous comment applies: one has to use rematrix unless the source has 5.1(back). For instance, the sample is 5.1(side) but since obs knows only 5.1(back) and since vlc doesn't provide the channel layout, there's no fix. So for checking 5.1 with the sample linked above, you have to use rematrix. So your result is consistent with what I'd expect.
Operating System Info
Windows 11
Other OS
Ubuntu 20.04, Windows 10
OBS Studio Version
27.2.4
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/wpBbuDdp4GsJhMtF
OBS Studio Crash Log URL
No response
Expected Behavior
Audio playback through the VLC Media Player Source that has 5.1 Audio should correctly output audio that balances dialog for L and R channels.
The Media Player Source does not have this problem, however it can not play subtitles. The only solution as of now is to Window Capture VLC, or Re-encode the video file so that subtitles are embedded and use the Media Player Source.
Current Behavior
When listening to any videos with 5.1 Sound (3F2M/LFE), the audio channels for dialog favor the Left speaker, unless multiple people are speaking, during which audio fades between Left and Right speakers. In a movie, this means most dialog comes out of the Left Speaker/Channel.
Steps to Reproduce
Anything else we should know?
This seems to have been attempted to be fixed here, but there are still issues noted above.
https://github.com/obsproject/obs-studio/pull/5881
I have tested this on Windows 10, Windows 11, and Ubuntu 20.04 which all exhibit the same issue.