bozbez / win-capture-audio

An OBS plugin that allows capture of independant application audio streams on Windows, in a similar fashion to OBS's game capture and Discord's application streaming.
GNU General Public License v2.0
3.8k stars 209 forks source link

Audio crackling/popping stutter under load #31

Open ChloeDawn opened 3 years ago

ChloeDawn commented 3 years ago

Plugin version: v2.0.0-beta

When the captured application is under load (for example a game experiencing lag), the captured audio will crackle and pop, sometimes cutting out and back in depending on the severity of the lag. This happens with both a direct capture and an indirect capture ("Include process tree" unchecked and targeting another application). These audio issues do not occur when using a standard audio source capturing the audio device that the application is outputting to. The threshold of this crackling seems to be quite low, with even a slight dip below my v-sync causing problems, so I suspect some sort of bottlenecking?

I'm unsure if this kind of issue is resolvable, but I felt it was worth reporting regardless

bozbez commented 3 years ago

Interesting that it is only happening under load for you, but otherwise very similar to #21 and #22. This might be fixed by increasing the buffer size we are requesting from the IAudioClient, will try that in the next release to see if it solves someones problem.

bozbez commented 3 years ago

Try v2.0.0-beta.2, the buffer size is increased and the packet handling in general should be improved.

ChloeDawn commented 3 years ago

That fixed it! Thank you so much ❤️ This is such an amazing plugin 😁

ChloeDawn commented 3 years ago

On a triple check, there is still popping when loading environments, but it is a lot less frequent. Previously it was non-stop popping, stuttering, and cutting out when the game experienced any kind of lag.

I have attached a recording below to better show the popping. ❤️

https://user-images.githubusercontent.com/9869940/131903762-0f317762-fb44-4d46-a143-4a9cb6f042ec.mp4

The encoder settings, if relevant (CPU is i7 4790K):

obs64_02-09-2021_20-25-21

BuyMyMojo commented 3 years ago

Do you have OBS set to be above average priority and are you running as admin?

BuyMyMojo commented 3 years ago

In recent versions they released a fix that had high CPU and GPU loads breaking stuff in OBS but for it to work you needed to be running it as admin

ChloeDawn commented 3 years ago

I'm running as admin with high CPU priority ^^

BuyMyMojo commented 3 years ago

I'm trying to recreate this but not luck yet GPU encoding: https://streamable.com/m1jw42 CPU encoding: https://streamable.com/h07glw

IonicEcko commented 3 years ago

I might have something similar but I'm not sure... At random points I seem to be getting issues that are resolved by hiding and un-hiding sources. I'm not entirely confident its the plugin but thought I'd post it here in case I can check any logs or anything for you.

Edit: Just for completeness, its the version behind the most recent (updating tonight) and OBS is being run as admin.

https://www.twitch.tv/videos/1154850776

bozbez commented 3 years ago

If anyone encounters this could they post the OBS log of their session?

Soloplayersama commented 3 years ago

I noticed this the first day I tried it so I stopped using the plugin but still check this for updates. Decided to stream with it again so I could get you a log in hopes that it'll help. It's pretty unusable for me currently as this is too common. I'll be looking forward to updates <3. https://obsproject.com/logs/JpT8cH7zsKe52F2e https://clips.twitch.tv/FurryPrettiestTurnipKippa-AiZ7PE0OPynoY4uQ

bozbez commented 3 years ago

Could you see if it happens if you send your audio directly to your headphones or speakers without using the VB-cables?

Soloplayersama commented 3 years ago

I wasnt using VB during that stream, anything labeled as it was just left over from when I was reconfiguring / testing other set ups. Currently all VB cables are disabled and all my audio runs through my PCI sound card. I can run more streams/tests tomorrow(later today as its 5am here)and double check my sound set up in case I've made a mistake. If you have any other suggestions or things you would like me to try please let me know.

Soloplayersama commented 3 years ago

So the setup today was with a completely fresh OBS install with only this plugin added back in, all fresh settings, certain that I had all audio going through my default speakers. Exact same issue happens sporadically although infrequent. The majority of the stream audio is great over the course of a few hours but this did show up once or twice.

https://obsproject.com/logs/QmZA6o3QuDt0hRhP https://clips.twitch.tv/RenownedFrigidJuicePoooound-8BXT1C0eea_fRAu5

BuyMyMojo commented 3 years ago

could be related to using x264 slow. even on a 5950x that's not entirely recommended on a one PC setup? try doing medium for a while and report back please

...
[x264 encoder: 'streaming_h264'] preset: slow
...
BuyMyMojo commented 3 years ago

Like I see only 216 frames dropped but could be causing an issue with the audio capture?

BuyMyMojo commented 3 years ago

or if you keep using slow set the audio-capture-helper.exe process to have higher cpu priority higher then OBS?

Soloplayersama commented 3 years ago

Like I see only 216 frames dropped but could be causing an issue with the audio capture?

That's mostly from me alt tabbing in and out of fullscreen - typically I do get a few render (0 encoder drops) frame drops throughout a stream with my current settings but it's not the amount that is visible on stream. I'll drop my custom commands and use slow but change the priority of the exe and see what happens.

bozbez commented 3 years ago

Could anyone suffering from this try this build: win-capture-audio-2.1.0-beta-setup.zip

Changes a bunch of things but primarily switches to use an MMCSS registered audio capture work queue which has higher CPU priority, and runs the capture in-process.

Soloplayersama commented 3 years ago

Could anyone suffering from this try this build: win-capture-audio-2.1.0-beta-setup.zip

Changes a bunch of things but primarily switches to use an MMCSS registered audio capture work queue which has higher CPU priority, and runs the capture in-process.

I'll try this out tomorrow and get back to you, I do have a VOD I need to check for audio stutters from tonight that I talked about changing my settings for, just havent scrubbed through it yet.

-EDIT- https://clips.twitch.tv/CautiousFairFriesTTours-_n3YHAJ1bcLGld3O https://obsproject.com/logs/XQkNEXjmSSH5NK8t - ignore the render stalls as that was all gained when I alt-tabbed out of the game to shut down the stream. This clip was only about 5~ minutes into stream and the audio distortion lasts about a minute (EDIT- the next audio clipping/distortion was 1hr45mins later which also was about 1min duration, again in passive low load gameplay), this was with me setting the audio-capture.exe to high priority prior to playing. my GPU sits about 50-70% used in general and particularly it's low load during the point where it happens in the clip.

Soloplayersama commented 3 years ago

I tried 2.1.0beta this morning, same issue. https://clips.twitch.tv/ProductiveDelightfulWhaleStoneLightning-zOJr7w9dsgdjylZt

bozbez commented 3 years ago

Log of the session? Look in AppData\Roaming\obs-studio\logs for all the recorded logs.

Soloplayersama commented 3 years ago

Log of the session? Look in AppData\Roaming\obs-studio\logs for all the recorded logs.

https://obsproject.com/logs/f-AuJ38X8zOf9CWs

Soloplayersama commented 3 years ago

Alright here's my last test for now - tried one stream on medium just for you. https://obsproject.com/logs/y8Y8vJRViFUS3nVG https://clips.twitch.tv/PluckyCheerfulKumquatDoritosChip-FcSa69p99f3p2ptO

BuyMyMojo commented 3 years ago

would you say that happened about 5 minutes in?

Soloplayersama commented 3 years ago

would you say that happened about 5 minutes in?

No, that was much later in the stream overall, also happened multiple times.

LinkzVR commented 2 years ago

After Reading through the comments I can confirm this is happening to me as well. Just capturing Spotify as the source and this happens a random amount of time that OBS is open. I had it happen to me without even streaming/recording. Just all of the sudden cracks and pops start happening in the Spotify music and gets progressively worse. Closing Spotify and reopening it completely resolves the issue.

Marvin10193 commented 1 year ago

was there a fix found for this eventually? im using the newest version and still encounter it, but someone else might have discovered something :)