You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VLC Source volume meter broken when loading opus files #2406
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
Add a VLC source
Add a file encoded in opus
Additional information
Opus file info:
Codec: Opus Audio
Sample rate: 48000 Hz
Bits per sample: 32
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:
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.
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.
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.
Activity
WizardCM commentedon Dec 9, 2020
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.
WizardCM commentedon Jun 13, 2021
Just confirming from my testing: this is still an issue in 27.0.1 with VLC 3.0.14.
CodyJung commentedon Jan 15, 2022
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:
univrsal commentedon Jan 16, 2022
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.
CodyJung commentedon Jan 16, 2022
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.
kkartaltepe commentedon Feb 20, 2023
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.
Fenrirthviti commentedon Oct 14, 2024
Closing as stale. If this is still an issue please open a new issue with updated reproduction steps on the latest version of OBS.