Skip to content

VLC Source volume meter broken when loading opus files #2406

Closed as not planned

Description

@univrsal

When the VLC source plays opus files the volume meter flickers on and off. The audio still gets recorded without any issue, so it just seems to be a visual bug. It doesn't seem to have anything to do with the file itself, since the issue didn't occur after converting it from opus to mp3.

Expected Behavior

The volume meter should work like it does with other files

Current Behavior

The volume meter seems to reset every second.

Steps to Reproduce

  1. Add a VLC source
  2. Add a file encoded in opus

example

Additional information

Opus file info:
Codec: Opus Audio
Sample rate: 48000 Hz
Bits per sample: 32

Mp3 file info:
Codec: MPEG Audio layer 1/2 (mpga)
Sample rate: 48000Hz
Bits per sample: 32
Bitrate: 320 kb/s

VLC version 3.0.8
OBS log

Activity

  1. added
    issue/confirmed
    on Dec 9, 2020
  2. WizardCM commented on Dec 9, 2020

    @WizardCM
    Member

    Verified in OBS 26.1.0-rc2 (fresh install, default profile & scene collection) and the Symphony No. 6 sample available here: https://filesamples.com/formats/opus

    Audio monitoring seems to play it fine.

  3. WizardCM commented on Jun 13, 2021

    @WizardCM
    Member

    Just confirming from my testing: this is still an issue in 27.0.1 with VLC 3.0.14.

  4. CodyJung commented on Jan 15, 2022

    @CodyJung
    Contributor

    I've done a little debugging here, and if I understand it right it looks like VLC sends OBS opus audio data in chunks - i.e. about every ~0.9 seconds. The volume meter updates when a source gets audio data and puts it in the buffer, not when it plays the audio data out of the buffer -- so we're hitting the detectIdle() check that causes the volume meter to reset after 0.5 seconds of no new data.

    It's tempting to adjust the idle detection threshold dynamically instead of hardcoding 0.5, but that still doesn't look great:

    Animation

  5. univrsal commented on Jan 16, 2022

    @univrsal
    ContributorAuthor

    The volume meter updates when a source gets audio data and puts it in the buffer

    Does update mean that it just refreshes/repaints the volume meter or also calculate the amplitude? If it's just a refresh/repaint maybe there's another way to force it to update, but since opus seems to be the only outlier it's probably not worth the hassle unless there's an easy fix.

  6. CodyJung commented on Jan 16, 2022

    @CodyJung
    Contributor

    The latter - it recalculates the amplitude falloff ("ballistics"?) every draw/paint, but the new peaks are only set when we get new data. One of the longer-term contributors might have a better idea what it would take to change that, but my initial impression was it wouldn't be trivial.

  7. kkartaltepe commented on Feb 20, 2023

    @kkartaltepe
    Collaborator

    just some more info as I noticed this today.

    VolumeMeter gathers this data from obs_source_add_audio_capture_callback, which directly hands off audio data as its delivered from sources including async sources. As an async source vlc can deliver lots of audio data periodically and rely on obs to mix everything together correctly. But the VolumeMeter generally expects sources to behave like sync sources and continuously deliver audio so it can avoid handling timing information (which is also missing from the audio_capture_callback).

    It doesn't seem like there is an easy way to solve this as any changes would either mean new callbacks to stream async data back in real time. Or add lots of timing and history into the VolumeMeter.

  8. Fenrirthviti commented on Oct 14, 2024

    @Fenrirthviti
    Member

    Closing as stale. If this is still an issue please open a new issue with updated reproduction steps on the latest version of OBS.

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

    issue/confirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions