Skip to content

bug: vlc-video: 5.1 and 7.1 audio play through the wrong speakers (upstream #12579) #251

Closed

Description

@rdoupe

Upstream OBS bug, reported by Ezriilc in obsproject/obs-studio#12579. Code unchanged in this fork.

Location

Class

Wrong output (audio routed to the wrong speakers). No crash or data loss.

How it is reached

Play any 5.1 or 7.1 file in a VLC Video Source. libVLC's audio callbacks (amem) deliver samples in VLC's channel order, L R [SL SR] RL RR C LFE, while libobs reads 5.1 as FL FR FC LFE RL RR and 7.1 as FL FR FC LFE RL RR SL SR. With 5.1, centre and LFE come out of the rear speakers and the rears out of centre and LFE; with 7.1 the side pair swaps with centre and LFE. It happens with 5.1 back and 5.1 side sources alike, because VLC converts both to its own 5.1 layout before the callback. Media Source is not affected.

pkviet confirmed the misordering upstream with a Fraunhofer test file, and theking2 posted another test file.

Reproduced on Linux with libVLC 3.0.23: a generated WAV with each channel at its own level, played through the real vlc_source module with OBS in 7.1. Libobs channels 2 and 3 carry file channels 4 and 5 (5.1) or 6 and 7 (7.1).

Proposed fix and failing test

Fix: reorder each interleaved frame in place into libobs order in vlcs_audio_play() for 6 and 8 channels. Mono, stereo and 2.1 already match and are left alone. No libobs change.

RED test (cmocka, test_vlc_channel_order): unit checks of the reorder helper, plus end-to-end playback of generated 5.1 (back and side) and 7.1 files through vlc_source. 5 of 6 cases fail today; all pass with the fix. The end-to-end cases skip (exit 77) without libVLC or a display.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_vlc_channel_order (5 of 6 failing): generated 5.1 and 7.1 files with a distinct level per channel, played through the real vlc_source, each libobs channel identified by its level.
    2. GREEN: reorder 5.1 and 7.1 frames from VLC's channel order into libobs order in vlcs_audio_play().
      PR today.
  2. added 2 commits that reference this issue on Oct 11, 2026
    2e1bbcc
    ea6e28c
  3. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @Ezriilc you reported this in obsproject/obs-studio#12579, so a heads-up: it's fixed here in obs-rust by #252, merged today with a regression test.

    Cause, as pkviet's analysis in obsproject/obs-studio#12601 found: libVLC hands over 5.1 and 7.1 audio in its own channel order (L R [SL SR] RL RR C LFE), and the VLC Video Source passed it to OBS unchanged, so centre and LFE came out of the rear (5.1) or side (7.1) speakers and the other way round. Now each 5.1 and 7.1 frame is reordered into OBS's layout. The test plays generated 5.1 and 7.1 files with a distinct level on every channel through the real VLC source and checks where each one lands: 5 of 6 cases failed before, all pass now.

    Not covered: 4.0, 4.1 and 5.0 layouts. VLC's 4- and 5-channel layouts have no matching OBS layout, so those are unchanged.

    Workaround on stock OBS: use a Media Source instead of a VLC Video Source for surround files.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you try it, a short reply here on whether your channels land in the right speakers would really help.

  4. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    I'm sorry but I don't think I'm understanding what version to test. I've only ever used the standard release OBS on Windows, except for a beta with the problem fixed, but I've gone back to the standard release, which still has the issue as of now (v32.2.2).

    I'm afraid I don't have a Linux box working to test with Arch at this time - it's on my todo list but quite far down.

    Please let me know what else I can do.

  5. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Thanks for coming back to this, and no Linux box needed: obs-rust's CI builds Windows too. The fix is in every build of master since #252, including this one:

    1. Open https://github.com/obs-rust/obs-studio/actions/runs/38281117568 (you need to be signed in to GitHub to download).
    2. Under Artifacts, download obs-studio-windows-x64-b060c588a and unzip it to its own folder, separate from your installed OBS.
    3. It's an unsigned development build, so Windows SmartScreen may warn; to keep it from touching your normal OBS settings, create an empty file named portable_mode.txt next to the bin folder before starting it, then run bin\64bit\obs64.exe.
    4. The VLC Video Source needs 64-bit VLC installed, same as with stock OBS.

    Then add your 5.1/7.1 file in a VLC Video Source and check whether centre and LFE come out of the right speakers (the Advanced Audio Properties meters show each channel too). That's all it takes; a short "works" or "still swapped" here is plenty.

  6. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    It works!

    No problem - I'm happy to help. I got no ShartScreen warning.

    However, there is a bit of strange latency or delay in the audio and video playback, but oddly the audio meters seem unaffected. Video playback seems to start fine, but the audio takes a moment to come in, and both video and audio are delayed behind the meters by quite a bit.

    In fact, the meters are skipping ahead in time right from the start - they're literally ahead of video and audio playback. I can picture this causing problems in final outputs to streaming and recording.

  7. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Great, thanks for testing, and glad the channels are right now.

    The meters running ahead is very likely a separate, older VLC Video Source behaviour rather than something this fix added: libVLC decodes and hands audio to OBS roughly a second ahead of when it's due to play, the meter shows audio as soon as it arrives, while what you hear and see waits for the audio's timestamp. Upstream has a report of the same thing showing up as a delayed sidechain on VLC sources (obsproject/obs-studio#11711).

    To be sure it isn't something in this build, could you play the same file in a VLC Video Source in your normal OBS 32.2.2 and see whether the meters lead the same way there? If stock OBS behaves the same, it's that existing behaviour and I'll look at it as its own bug; if stock OBS is in sync and this build isn't, that points at our changes and I'll dig into it right away. Either answer helps.

  8. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    Fair enough.

    Yes, the meters seem to behave the same (ahead) in the stock OBS, although it's a slightly hard to tell with the channels wonky.

  9. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Follow-up on the meters running ahead: I've traced it. libVLC hands its audio to OBS one to two seconds before it plays (in bursts for Ogg and MP4 files), and the meters, obs-websocket's meters and audio filters such as a sidechain compressor react when the audio is handed over, while what you hear and record is placed by its timestamp. So stock OBS should behave the same, and it isn't from the surround fix. #405 makes the VLC source hand audio over as it plays (about 100 ms ahead) without changing the timestamps; in the test the lead drops from 1-2 s to under 0.2 s. Once it's merged I'll post here; a build of it on Windows would be the real check, since it was only tested with libVLC on Linux.

  10. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    #405 is merged, so the next master build has the VLC source handing audio over as it plays. The meters should now follow what you hear instead of running a second or more ahead. It'll be in the next Windows artifact on the Actions page (a run for a commit newer than b060c588a); same steps as before if you'd like to check it.

  11. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    Sorry, again I'm unclear exactly what to test. GitHub is a maze to me.

    By following the same steps, I seem to get the same version, and the meters in a VLC Video are still ahead of the audio and video.

    Is that intended? I feel like I missed something.

  12. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    A correction to my earlier pointers: rather than a CI build, the place to get obs-rust is the releases page: https://github.com/obs-rust/obs-studio/releases

    The Windows download there today is 0.1.0-beta.20261011, which was built before both fixes (the surround order fix, #252, and the meter fix, #405), so it doesn't have them yet. They'll be in the next beta release after 0.1.0-beta.20261011; I'll note the version here once it's out. Thanks again for testing.

  13. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    You didn't miss anything: the build you downloaded was made before the meter fix was merged, so the meters running ahead is expected in that build. Nothing more to do for now; when the next release is on the releases page I'll post its version here, and that one will have both the surround fix and the meter fix.

  14. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Sorry for making this harder than it needed to be. I sent you to a CI build instead of a proper release, and GitHub's Actions pages really are a maze. That's on me, not you.

    There's now an actual Windows release with both fixes (the 5.1/7.1 channel order from #252 and the VLC meter timing from #405): OBS-Studio-Rust 0.1.0-beta.20261012.

    1. Go to https://github.com/obs-rust/obs-studio/releases/tag/obs-studio-rust-v0.1.0-beta.20261012 and download OBS-Studio-Rust-0.1.0-beta.20261012-windows-x64.zip.
    2. Unzip it to its own folder. It doesn't install anything and doesn't touch your normal OBS.
    3. Before the first start, create an empty file named portable_mode.txt in that folder (next to the bin folder), so it keeps its own settings instead of sharing your normal OBS profile and scenes.
    4. Run bin\64bit\obs64.exe. It's unsigned, so Windows SmartScreen may ask; choose "More info" → "Run anyway".

    With your surround file in a VLC Video Source, the channels should come out of the right speakers and the meters should now move with what you hear. A quick "works" or "still off" here is all I need.

  15. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    It works! In both ways - channels are correct and the meter is synced.

    No worries! I appreciate your time and attention. Well done!

  16. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Thanks for sticking with it and testing on Windows. That confirms both fixes on a real Windows setup, which we couldn't check ourselves.

  17. Ezriilc commented on Oct 12, 2026

    @Ezriilc

    I have served.
    I will be of service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions