Question / Help Max Audio Buffer Reached

pada

New Member
Hi @iliketoDJ999 ,

I have not checked the logs recently, but so far I have not seen audio sync issues with my Blackmagic Intensity Shuttle USB 3 capture card and OBS 27.2.4 (and the Advanced Scene Switcher plugin) and using Blackmagic Desktop Video 12.2.2.
I had to switch from the Blackmagic input source in OBS to the generic "Video Capture Device" and then make use of the WDM device and set its properties to have the "Deactivate when not showing" option enabled. I then scripted the Advanced Scene Switcher plugin to switch to a blank scene for like half a second and then back to the scene that is using the capture card the moment that I either press Start recording or Start streaming.

I have not done longer than 2 hour streams yet, so I can't comment if the audio goes out of sync after many hours...
 
Interesting as we use Black Magic Design via the Atem Mini pro and have numerous audio sources . Would DEF need more info as I DO see quite a few sources and settings available via the OBS Audio mixer and advanced audio settings in OBS but we only activate a couple either local or remote as I have had trouble enabling too many inputs ! Don't think in about 9 months using OBS I have seen that or anything like that . We have 2 PTZ 30X cameras SDI/HDMI setup with Atem Mini Black Magic into OBS over the internet to Youtube. I DO know on initial set up audio can be tricky. We use an Audio amp with MIC 1 ( Line in set up ) into Atem Mini out to our Windows Enterprise pc ( Multiple settings here as well ) using audio settings as well on the local PC . Nothing special . Sorry but never heard of that ! Good Luck !
 

iliketoDJ999

New Member
After running some tests, it seems like this plug-in hasn't solved my issue. I highly suspect its my elgato capture card thats connected to my camera that i use as a webcam.
 

YorVeX

Member
To investigate cases like that a lot more info and context is needed, e.g. remote transmission sources like NDI or Teleport cause audio buffering for completely different reasons than a capture card, and that again for completely different reasons than one of the inbuilt sources like image or media source.

I'd suggest you head to a support channel on Discord and ask about your case there so that someone can walk you through investigation steps. Or if you want to continue here (which will probably take longer) it would be helpful if you could provide OBS logs of a session that had the audio buffering (the Help -> Log Files main menu in OBS has options to automatically upload the current or a previous log).
 

iamarra

New Member
Hi @YorVeX thank you for responding, here are my logs down below, I've been having two issues lately:
  1. My log always has a bunch of these messages: "warning: could not update timestamps for discarded samples." Like a million times over and over again, I cannot find a fix for 2 months now. I don't even know what is means!
  2. My log sometimes shows "Max Audio Buffering". This issue usually occurs if I stream for longer period of time.

https://obsproject.com/logs/wWs5JYxZfVuOTAiY

https://obsproject.com/logs/iXgvpfvFnPd4JWXU

https://obsproject.com/logs/PJfa4iTOxUcO9OwZ
 

YorVeX

Member
Hi @YorVeX thank you for responding, here are my logs down below, I've been having two issues lately:
  1. My log always has a bunch of these messages: "warning: could not update timestamps for discarded samples." Like a million times over and over again, I cannot find a fix for 2 months now. I don't even know what is means!
  2. My log sometimes shows "Max Audio Buffering". This issue usually occurs if I stream for longer period of time.

https://obsproject.com/logs/wWs5JYxZfVuOTAiY

https://obsproject.com/logs/iXgvpfvFnPd4JWXU

https://obsproject.com/logs/PJfa4iTOxUcO9OwZ
I am not familiar with the "Could not update timestamps for skipped/discarded samples" message, but by searching around a bit I found that it often seems to be related to media files (I would assume with a media source, might also be VLC source). My suggestion would be to go with a process of elimination and either disable the media and VLC sources you have one by one until the error stops (if it happens a lot by itself right from the start) or (re)play them one by one from start to and observe when the log message is triggered. To see the live logs while conducting these tests use Help -> Log Files -> View Current Log and keep that window open. Could also be one that you use as a (stinger) transition.

If it turns out not to be a media/VLC source, do the same with other source types, e.g. browser sources. If you found the offender it might be a corrupted media file, then you can play around with conversions and see whether that fixes it, e.g. if it's an AVI video try to convert to a different video format mpg, flv, whatever), if it's sound try ogg, mp3 or wave (those conversions can be done using the free software Audacity) and see whether that fixes it.

One that definitely causes problems including a big (but not the only) part of the audio buffering seems to be your bathroom BRB video:
Code:
22:45:27.872: Max audio buffering reached!
22:45:27.873: adding 896 milliseconds of audio buffering, total audio buffering is now 960 milliseconds (source: Bathroom BRB Video)
22:45:27.873:
22:45:29.974: Source Bathroom BRB Video audio is lagging (over by 158.19 ms) at max audio buffering. Restarting source audio.

Does that video by any chance contain transparency (an alpha channel)? As soon as a video file does, it is decoded by OBS using the CPU, which is really inefficient and often causes issues (but due to the inefficiency you will not necessarily see that as high CPU load in task manager, even though it creates a huge bottleneck for the whole OBS rendering pipeline), especially at a high resolutions like 4K.

Even if it doesn't contain transparency, loading media files during a running session is always a problem, because OBS does it in the same thread as it does its rendering. So if it contains transparency, get rid of it, if you're unsure about that (it could contain a bit of transparency without you even noticing on a black background) convert to a video format that simply doesn't support alpha channels (I think only webm and maybe mov do in OBS) and if the contents of the video don't actually need to be 4K (e.g. it only shows a smaller animation in the center) crop the video to the minimum necessary size for the content, then position it to the center in OBS, that also makes a huge difference.

One way that I personally use to work around OBS media loading lag is to not use a media or VLC source but to load them using a browser source that points to a simple HTML file that embeds the media file, because browser sources run in a separate thread, as soon as I started doing that I got rid of a lot of audio buffering.

I would say with that you already got a few things to work on. Another source that is causing audio buffering for you is your capture card, since I don't use one myself I am not sure whether I can help with this.

Code:
22:50:34.389: adding 618 milliseconds of audio buffering, total audio buffering is now 960 milliseconds (source: PS5 Elgato)
22:50:34.389:
22:50:34.412: Source PS5 Elgato audio is lagging (over by 1473.27 ms) at max audio buffering. Restarting source audio.

The one thing that I know in general is that sources which don't output audio in the first place can't trigger audio buffering, so in case you have any other way of grabbing the audio and feeding it into OBS, try that and mute the capture card in OBS (I linked a plugin for this above, just setting it to mute or only monitoring in OBS could also help, but with the plugin you're on the safe side). This sounds like a funny workaround that would probably solve your issue.

But you could also try to solve the media file things first and see whether that's already enough to get your setup stable.
 

YorVeX

Member
Here's one of the HTML files to load a webm using a browser source, save as yourname.html and within the text change the file name of the .webm file to match the one you want to load, create one HTML file for each webm and load them using browser sources:

HTML:
<html>
    <head>
        <style>
            body { background-color: rgba(0, 0, 0, 0); margin: 0px auto; overflow: hidden; }
        </style>
    </head>
    <body>
        <div class="text-container">
            <div class="image-container">
                <video id="video" playsinline autoplay muted loop style="width:100%; height:100%"><source id="webm" src="Your Bathroom or whatever BRB video.webm" type="video/webm"></video>
            </div>
        </div>
    </body>
</html>
 

iamarra

New Member
Thank you so much for all the information and tips @YorVeX

I'll go through the process of the elimination tomorrow.

None of the videos that are causing buffering have transparency, but they are in webm. I also tried other video formats but the logs were the same. I'll try different audio formats too, forgot about that one!

Only one video has transparency and it is in the scene "Intermission" which doesn't show up a lot in the log so far.

I'll try out the html thing, that might fix everything actually.

Btw I forgot to mention that I use the GOXLR so basically there is just 1 audio source playing in my OBS. Before this happened I didn't know about the mute filter, so I'll apply that on everything except my GOXLR input and see if that helps out.

I'll report back here with my findings and solutions, once I'm done with all of the trial and errors.

Truly appreciate all of the things you wrote out for me!
 

iamarra

New Member
Hi @YorVeX long time no talk.

I spent some time working things out and trying out the things you suggested. The timestamps issues were definitely video/media source related - I created htmls for every media source and I am never getting the timestamp errors again! Thank you for this!

I also stopped getting audio buffers since I added muted filters on top of everything that I don't use. Since I use goxlr I just have 1 audio source active now and it has been working great so far!

Ever since I fixed those 2 things I've been having some other problems which I think are now related to my computer (this is just my guess for now)

I've been streaming regularly, and over the past 10 days I had 3 instances were my stream either slowed down completely or crashed.

Last week:
- Twice my computer completely slowed down to the point were I had to restart it to fix it - that was the only fix! I had similar symptoms to those when I reached the max audio buffer, but once I checked the logs, everything was perfect in them, even the OBS analyzer said so. I noticed these lags because of my facecam pro slowing down on my other monitor, it wasn't catching up to my head movements. So the only fix was a restart, but there were no issues in logs nor anything - very weird!

This week:
- The third thing that happened, my monitors completely went grey/black (like tv noise) after 2 hours of a perfect stream, then I lost signal on all 3 monitors from both my ps5 (elgato 4k60 pro) and from my PC (gpu display ports), the monitors were saying there was not input signal from anywhere and went black. The only fix here was also a restart, I tried plugging in and out the cables but only the restart worked. This time however, I had a crash file and a log file. The log file said "Error encoding with encoder 'advanced video recording'" & "AMF out of memory". I still have no clue what caused all of this, was my GPU failing? I was checking the task manager and all of the loads during the stream, and everything was under 30%, so IDK what to think :/

Here are the files for you to check if you end up having time, would love to hear your opinion on this, because as of now I have no new clues to investigate to solve this.
 

Attachments

  • 2023-10-20 15-21-22.txt
    24.4 KB · Views: 5
  • Crash 2023-10-20 17-29-43.txt
    150 KB · Views: 3

YorVeX

Member
Hi @YorVeX long time no talk.

I spent some time working things out and trying out the things you suggested. The timestamps issues were definitely video/media source related - I created htmls for every media source and I am never getting the timestamp errors again! Thank you for this!

I also stopped getting audio buffers since I added muted filters on top of everything that I don't use. Since I use goxlr I just have 1 audio source active now and it has been working great so far!

Ever since I fixed those 2 things I've been having some other problems which I think are now related to my computer (this is just my guess for now)

I've been streaming regularly, and over the past 10 days I had 3 instances were my stream either slowed down completely or crashed.

Last week:
- Twice my computer completely slowed down to the point were I had to restart it to fix it - that was the only fix! I had similar symptoms to those when I reached the max audio buffer, but once I checked the logs, everything was perfect in them, even the OBS analyzer said so. I noticed these lags because of my facecam pro slowing down on my other monitor, it wasn't catching up to my head movements. So the only fix was a restart, but there were no issues in logs nor anything - very weird!

This week:
- The third thing that happened, my monitors completely went grey/black (like tv noise) after 2 hours of a perfect stream, then I lost signal on all 3 monitors from both my ps5 (elgato 4k60 pro) and from my PC (gpu display ports), the monitors were saying there was not input signal from anywhere and went black. The only fix here was also a restart, I tried plugging in and out the cables but only the restart worked. This time however, I had a crash file and a log file. The log file said "Error encoding with encoder 'advanced video recording'" & "AMF out of memory". I still have no clue what caused all of this, was my GPU failing? I was checking the task manager and all of the loads during the stream, and everything was under 30%, so IDK what to think :/

Here are the files for you to check if you end up having time, would love to hear your opinion on this, because as of now I have no new clues to investigate to solve this.
Glad to hear that you were able to fix the audio buffering issues.

I'm afraid the other issues now are not only out of scope of this thread but also out of what I am able to help with. Only for the last part I can say that I know when the GPU driver crashes that this can also make OBS crash, since it's relying on the GPU to do its work, so I guess this is what happened and it's as you suspect more of a general issue with your system than with OBS. Then again, the GPU crash in the first place could have been somehow triggered by OBS. You could join the OBS discord and ask there in a support channel, people there have a lot of experience investigating such errors, bring your logs along and have someone look through them who might recognize the behavior you're seeing and maybe has an idea what could cause it.
 

AlphaPyxis

New Member
Here's one of the HTML files to load a webm using a browser source, save as yourname.html and within the text change the file name of the .webm file to match the one you want to load, create one HTML file for each webm and load them using browser sources:

HTML:
<html>
    <head>
        <style>
            body { background-color: rgba(0, 0, 0, 0); margin: 0px auto; overflow: hidden; }
        </style>
    </head>
    <body>
        <div class="text-container">
            <div class="image-container">
                <video id="video" playsinline autoplay muted loop style="width:100%; height:100%"><source id="webm" src="Your Bathroom or whatever BRB video.webm" type="video/webm"></video>
            </div>
        </div>
    </body>
</html>
This intrigued me when i read it as it seemed to have worked for OP, I have copied this HTML and pasted it into a notepad doc (changed the file extension to .html) then i used that as the local file in browser source. It did not show up. So when you say "name the file as your username" what username do you mean? like the one associated with our computer. Sorry noob question but i don't know what i am doing and don't know where to begin to search online for this. Thank you in advance For your reply!
 

YorVeX

Member
This intrigued me when i read it as it seemed to have worked for OP, I have copied this HTML and pasted it into a notepad doc (changed the file extension to .html) then i used that as the local file in browser source. It did not show up. So when you say "name the file as your username" what username do you mean? like the one associated with our computer. Sorry noob question but i don't know what i am doing and don't know where to begin to search online for this. Thank you in advance For your reply!
Not username, "yourname.html" as in "pick whatever name you want for it".
As long as you found this file when selecting it in the browser source this is not the step that failed for you. I would rather think one of the next things went wrong.
1. The contents of the HTML text above include this part: src="Your Bathroom or whatever BRB video.webm" - you need to put the name of the .webm file there that you want to load - between the double quotes. Make sure it is an exact match, don't forget any spaces or something.
2. This .webm file needs to be in the same folder as whateveryounamedit.html

The easiest way to keep it organized, especially if you load more than one .webm file this way, is to make the names match. For example if you want to load My Intro.webm, create an HTML file with the contents from above and name it My Intro.html. Then make sure that within the HTML file you change the relevant part to src="My Intro.webm". And to make consistency perfect, load it with a browser source that you name My Intro in OBS. That way you will always know what belongs together.
 

RSSCommentary

New Member
Also having this problem.

Absolutely not hitting CPU limits (always below 20%)

The issue is on an elgato capture card 4k for me.

When the issue occurs, if Unplug the device and plug it back in, all goes back to normal.

What appears to trigger it is a video/media source playing. But is intermitted so I can't currently re-produce on demand.

It is possible the device is not the issue, but is the one that ends up impacted due to whatever else is going on. So I actually suspect a broken media file causing the issue.

What is really annoying is that there is no way to DISABLE audio capture for the elgato in OBS. It just has 'capture only', output desktop, output waveout. I just want to entirely disable it and see if that resolves the issue.

Other threads and issues people have with 'media stuttering audio' lead me to think there may be an audio / ffmpeg issue that's really the cause, but it's 'killing' a device input as a result.

God I hope this gets fixed. I am at a loss now.
I tried to disable the Camlink audio device in the Windows Device Manger but it also disabled the webcam. You can disabled any audio device in Windows in the Sound Control Panel; the Windows 11 Sound options don't have all the configuration options. Just open the Control Panel, then click "Hardware and Sound" then "Sound". Click on the "Recording" tab, right click and click "Disable".
 
Top