VLC media source audio delayed only in output (not monitor)

I did some searching but can't find anything about this issue other than this (closed) bug: https://github.com/obsproject/obs-studio/issues/7552. However, that bug states that the issue only happens for the monitored audio, not the actual stream/recording, but I find the opposite to be true. I am using a VLC media source to just play a shuffled music playlist to use as background music on my streams. The files are all stored locally on my PC. The audio that I hear has no delay, but the audio sent to the stream is delayed by about 3 seconds. This results in two things: 1) I look a little silly humming to a part that hasn't happened yet, 2) the ducker I have set up on the music is completely useless as it doesn't duck the audio until 3 seconds later. I have attached a log file in case there's anything in there that helps. I realize there are a lot of errors in there from Stream Elements, but everything seems to work fine so I haven't messed with it.

The source does have a 400 ms network latency setting, but again, these are local files. And the delay is only on the output and significantly higher than 400 ms. Sync offset is set to 0. Any ideas?
 

Attachments

  • 2024-07-03 09-13-22.txt
    126.7 KB · Views: 18

rockbottom

Active Member
Get the low hanging fruit out of the way.

Disable HAGS

SE is nothing but errors. Java Script errors are known to cause issues. You need to fix or remove all of them.

Run a quick test, create a new Profile with just a VLC source. Make sure there are no audio filers in use & no SE. See if things improve.

Just a small sample.

09:13:26.160: [obs-browser: 'Latest static horizontal'] Error: [Report Only] Refused to load the script 'https://streamelements.com/z/i.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.160: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.166: [obs-browser: 'Latest activity'] Error: [Report Only] Refused to load the script 'https://streamelements.com/z/i.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.166: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.171: [obs-browser: 'Chat'] Error: [Report Only] Refused to load the script 'https://streamelements.com/z/i.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.171: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.216: [obs-browser: 'Latest static horizontal'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/vendor.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.216: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.284: [obs-browser: 'Latest activity'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/vendor.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.284: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.329: [obs-browser: 'Chat'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/vendor.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.329: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.531: [obs-browser: 'Chat'] Error: [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'none'".
09:13:26.531: (https://streamelements.com/overlay/scripts/vendor.js:47919)
09:13:26.546: [obs-browser: 'Latest static horizontal'] Error: [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'none'".
09:13:26.546: (https://streamelements.com/overlay/scripts/vendor.js:47919)
09:13:26.549: [obs-browser: 'Chat'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/app.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.549: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.556: [obs-browser: 'Latest static horizontal'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/app.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.556: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.679: [obs-browser: 'Latest activity'] Error: [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'none'".
09:13:26.679: (https://streamelements.com/overlay/scripts/vendor.js:47919)
09:13:26.689: [obs-browser: 'Latest activity'] Error: [Report Only] Refused to load the script 'https://streamelements.com/overlay/scripts/app.js' because it violates the following Content Security Policy directive: "script-src 'none'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
09:13:26.689: (https://streamelements.com/overlay/...xnY2fc54WygAaeKKokr6h1RNynakN18NoGS_QjenpUY:0)
09:13:26.880: [obs-browser: 'Chat'] Error: [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'none'".
09:13:26.880: (https://streamelements.com/overlay/scripts/app.js:397)
09:13:26.880: [obs-browser: 'Chat'] Error: [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'none'".
 
I know everyone always says to disable HAGS, but it is my understanding that, at least in Windows 11, it can have a dramatic effect on gaming performance. I really think this is advice that needs to be revisited or that OBS just needs to address so it's about the only program suggesting it. I also don't see what GPU scheduling would have to do with audio latency when the audio is a) not processed by the GPU except for encoding the video and b) other audio sources like games, even with the exact same effects chain, do not have the same delay. It is specific to the VLC source.

I booted up a separate instance of OBS that has nothing other than the desktop capture and the audio playlist and the issue persists. Interestingly, if I have the monitoring output set to output 1/2, aka the same output as the standard output, you can hear the delay there. That is, you hear the monitor output, then you hear the regular output. All on the same track, as if I added a delay plugin. So again, this is just an issue with the output, not the monitor.

Can you clarify what you mean by SE is nothing but errors? I know there are tons of errors in my log, but do you mean that SE generally will do this or that you suspect this is specific to my instance? I can't fix these errors, these are just browser sources.
 
Last edited:

rockbottom

Active Member
That may be, it may not. I'm on W10, HAGS is disabled.

I'm not a fan of your audio routing, it's suspect but HAGS, SE & the audio filters more of a concern.

Lots of errors, do you think they are free & there is no cost in resources? Looks like a security setting to me but no way to test. Java is not on my system.
 
Here is a log from the last recording, which doesn't have anything on it other than desktop capture and audio capture. There are no SE errors because it isn't there. No Java errors because it isn't being used. No audio or video filters. I even disabled HAGS for this one just to prove a point. The problem persists.

HAGS is required on many modern game engines, with frame rates absolutely tanking without it. Maybe it's not implemented very well in Windows 10, I don't know, but that's outdated advice.

And I'm not sure why you aren't a fan of the audio routing? Aside from it being irrelevant to the issue, it's done this way for a reason. My audio monitoring is set to outputs 3/4 because I can control these separately in the interface virtual mixer. It's like using Voicemeeter, but without needing to install it. I can listen to them on the monitor without that monitor feeding back into the regular output. In the case of this latest recording, however, I forgot to change the monitor output, so it was just routing to outputs 1/2. And that's where I noticed that the non-monitor output is still delayed even when they are running to the same set of outputs.
 

Attachments

  • 2024-07-03 12-32-03.txt
    26 KB · Views: 11

rockbottom

Active Member
So your Desktop audio is lagging. System may be overloaded. I noticed a downmix filter on the mic. Or, maybe a driver update would help. Have you checked the support page for your mobo in the last 6 months or so?

Before you search for the driver use just 1 Scene with a VLC source.

This happened 1 second after you opened OBS.

12:33:43.265: Max audio buffering reached!
12:33:43.265: adding 960 milliseconds of audio buffering, total audio buffering is now 960 milliseconds (source: Desktop Audio)
12:33:43.265:
12:33:43.287: Source Desktop Audio audio is lagging (over by 21550.73 ms) at max audio buffering. Restarting source audio.
 

rockbottom

Active Member
Here's the mic. It loaded & then failed.

12:32:05.539: [Loaded global audio device]: 'Mic/Aux'
12:32:05.539: - filter: 'Downmix makeup' (gain_filter)
12:32:05.540: [win-wasapi: 'Mic'] update settings:
12:32:05.540: device id: {0.0.1.00000000}.{00ca3039-bf51-4eb6-b589-072fb3b2f133}
12:32:05.540: use device timing: 0
12:32:05.541: [WASAPISource::TryInitialize]:[{0.0.1.00000000}.{00ca3039-bf51-4eb6-b589-072fb3b2f133}] Failed to enumerate device: 80070490
12:32:05.541: WASAPI: Device '{0.0.1.00000000}.{00ca3039-bf51-4eb6-b589-072fb3b2f133}' failed to start (source: Mic)
 

rockbottom

Active Member
Disable this stuff too. Game DVR may be interfering with your audio.

12:32:03.159: Game Bar: On
12:32:03.159: Game DVR: On
 
I'm just going to save us a bunch of time here since you don't want to just test and confirm it, but this is, in fact, exclusively limited to the VLC source. It does not happen with my desktop audio, game audio, or even the exact same music file in a media source instead of a VLC source (which I just tested having changed no other settings). The bug I linked to in the OP indicates that this was previously an issue with the audio monitoring, but it seems to still an issue with the output itself.

I do not know why I get those audio errors every time I use OBS, but they have not caused any problems with either my desktop audio or my mic, both of which use the same audio interface. Desktop audio is perfectly in sync in the recordings. It is only and specifically the VLC audio that is lagging behind and only and specifically on the output, not the monitoring. Even with a new scene that has nothing on it but the VLC source (as you suggested) which does not even route to Desktop Audio.

All drivers, firmware, BIOS, etc are up to date, but this isn't using the mobo audio anyway, it's a USB audio interface. The downmix filter is a simple gain filter, that does not account for nearly 3 seconds of latency.
 

rockbottom

Active Member
I use VLC as a source all the time & have absolutely no lag with it. I would be wasting my time testing.

Plenty to address in that last log. Desktop Audio lagged, mic failed, perhaps the Audient is actually the issue. Now you should test using the on-board audio.
 
Top