fzwoch / obs-teleport

An OBS Studio plugin for an open NDI-like replacement. Pretty simple, straight forward. No NDI compatibility in any form.
GNU General Public License v2.0
445 stars 16 forks source link

Sound issues on OBS 28 #59

Closed Kiran-GC closed 1 year ago

Kiran-GC commented 1 year ago

Been using teleport for over a week now, and im facing issues where the audio lags behind the video even if it was a seperate source. Sometimes there is also a delay in video output where there is like a straight 5 second difference between main source and teleport source. Note : I was using ndi until version 28 and there seemed to have no issues at that time.

fzwoch commented 1 year ago

Depends on how you use it.

Audio should not lag behind - when using in filter mode there may be a chance perhaps. Filters seem to behave quite weird at times.

Audio and video can never be in sync if you use them in different streams. If they are, it is by chance.

Use the regular output if possible.

Kiran-GC commented 1 year ago

I was using the regular output without using a seperate audio stream, but then as i said above there is sometimes a 5 second delay from main output to teleport pc for some reason

Kiran-GC commented 1 year ago

Do u suggest any fix or possible troubleshoot methods for this?

fzwoch commented 1 year ago

The plugin itself does not introduce any extra latency. The only exception is that audio and video get interleaved before being rendered so audio and video can be delayed if one of those streams is late. Imo that should never happen with the regular output.

So it may be something with the network or how OBS decides to render the stream.

Kiran-GC commented 1 year ago

Does teleport use up more resources than ndi? Just asking cause the stream was not late when using ndi.

mmadmike commented 1 year ago

To contribute to this, i kinda have the same. First off, thanks for this plugin! It really works.. for the most part :) I try to discribe my situation. I have a game pc and stream pc connected to a network. The only thing my game is sending to my streampc in obs is a desktopcapture wit Teleport. When i pick that signal up on my streampc it al works like a breeze. But after a while i can see the preview of my game-pc gets out of sync with the preview on my stream pc. i would say its a bout 1 second. im running gigabit router.

Normally this isnt that big of an issue because as mentioned the audio and video are together so my stream is fine. The main problem i have with this is the fact that the audio i hear thru my headset (connected to my streampc) gets behind on the video preview on my game pc.

I hope that clarifise my problem. And i think its what Kiran-GC is describing aswell.

I tried to lower the quality on my gamepc but that didnt help. The only temporary solution i found is to restart the obs on my game pc.

Sorry for my English.

OBS: 27.2.4 (im still using previous OBS because in the new obs i still have some plugins not updated) Output OBS Stream pc: 1920x1080, Bilinear, 60fps

--

Update: I am trying quality 80 in Teleport wich is is still very good (was on 90) to see if it helps with the decoding. So far, so good.

fzwoch commented 1 year ago

@mmadmike a few remarks here:

mmadmike commented 1 year ago

Yes that makes sense. Thank you. I can confirm that the last hour with quality on 80 in Teleport gives a stable sync between game and stream pc. Not sure if that has any effect on it. Fingers crossed because i tend to jinx stuff :) Again, thank for your work

PipeL1n3 commented 1 year ago

Hi, i read this here and i have something to try for the people that have problems with desyncing. I am using obs-teleport regulary as delivering gaming content from gaming PC to Streaming PC, but i always got desyncs after a while. I found out that there are two types of desync that occur. One is the obs-teleport stream might got delayed after time exspecially if heavy cpu usage occurs. So Videos + Audio on receiving OBS will be shown later, but video and audio is still in sync. Viewer won't notice this if there is no reference. As i use monitoring on streaming PC to get Gaming-PC-Audio to my Ears, i am heavily impacted if Audio-Monitoring is desynced, which also occurs randomly, but it start after a few minutes and after some time it gets noticeable. After hours it could reach like 5 secs.

I am now using two Plugins to keep things going: One is obs-async-audio-filter which add samples to audio if they mismatch, so there won't built up desyncing after time. I am using it as filter on teleport-source on receiving OBS. https://github.com/norihiro/obs-async-audio-filter Then i am Using Python script for OBS which toggles monitoring on and off after time. I set it to ~2mins and let it toggle monitoring of teleport-source. its avaible here https://github.com/MechanicallyDev/OBS-Anti-Mic-Monitoring-Desync Since i use this combo, i didn't encounter any desyncing problems.

Sending OBS: 28.1.2 on Windows 10 Receiving OBS: 27.2.4 on AlmaLinux 9 Was using OBS-Teleport 0.6.0 (will update to latest now)

YorVeX commented 1 year ago

I have been kind of "researching" this drift problem for a while, because I need to trigger an effect in OBS on the streaming PC, but matching the timing when something happens on the gaming PC. Since the streaming PC is a bit delayed, e.g. say 100 ms, I started off by simply executing the effect 100 ms later and it was fitting well. Then the drift kicks in, meaning that the delay between gaming and streaming PC slowly increases, so some time later the delay is 300 ms and my effect with its 100 ms static delay is now triggered 200 ms too early for the streaming PC feed.

I thought there would be only very few people trying to do something like this so nobody else would care about that drift. I am really surprised not only that other people notice this as an issue, but even more about the reason why this is an issue for them.

Why in the world would someone get the idea to plug their headphones into the streaming PC to begin with? What about just plugging it into the gaming PC, all problems gone?

As @fzwoch has already pointed out by that setup you don't run into only one but two problems. One is the drift and the other one is that OBS also has a problem with audio buffer buildup specifically for the monitoring device as described here.

Also how is this not a problem for you before the drift and monitoring issues come in? Even with a very fast and stable network setup you still need a small amount of buffering, the latency will always be considerably higher than zero. In my attempts to work on the drift problem I created myself a system that makes the delay measurable and I found out that the lowest I was able to get after a fresh reset was 85 ms. For the average human that's somewhere between subconsciously disturbing and annoying and from there it will increase to be worse very fast.

Don't get me wrong, I am quite happy that more people see the drift as an issue, the more attention it gets the more likely we all find ways to improve it (though I believe you're in the wrong place here, it's more likely happening due to OBS mechanisms than Teleport, if it's worse with Teleport compared to NDI then that's because the drift is aggravated by high CPU loads and Teleport causes a bit more of it, for the same reason the issue gets better with lower Teleport quality settings as they cause less CPU load). I am just genuinely curious, there must be something I am missing here. What is the use case for this?

My take on this would be:

For sure I can't think of every scenario you might be in or problem you want to solve, but whatever it is, using the monitoring audio from the streaming PC as a replacement for the original gaming PC audio is always the worst option.

mmadmike commented 1 year ago

Thanks for your answer. Let me tell you about the reason i monitor the sound from my gamepc on my streampc. I have everything streamrelated on my streampc; obs, webcams and also microphone. The reason for thatbis because i use elgato wave link software on streampc and it manage all audio there inclusing my microphone. My gamepc only shows the monitor output and sends audio with it over the network and my gamepc picks it up. But, since all my audio is managed on my streampc with the elgato wavelink software/mixer i need to hear the feedback in my headphones… connected to the streampc.

On a sidenote. If you start like 4 tabs on youtube and play audio the delay kind of kicks in immediately.

Again, maybe this is bot the place to discuss this as i dont believe it has something to do with the plugin. All im trying to find is a solutiin to monitor my gamepc audio while it is connected to my streampc. I could always go with a capturecard solution but for now i believe there is a way to get rid of the delay. Thanks

mmadmike commented 1 year ago

I forgot to mention, i have been testing a lot this week back and forward between Teleport and NDI tools 5 screen capture. What i found with NDI, since it is not using OBS, i have no delay but the audio crackles once in a while. So yeah, i think this delay thing is OBS related after all. Again, we could always discuss this further in private instead of on this forum

YorVeX commented 1 year ago

I have everything streamrelated on my streampc; obs, webcams and also microphone. The reason for thatbis because i use elgato wave link software on streampc and it manage all audio there inclusing my microphone. My gamepc only shows the monitor output and sends audio with it over the network and my gamepc picks it up. But, since all my audio is managed on my streampc with the elgato wavelink software/mixer i need to hear the feedback in my headphones… connected to the streampc.

Same thing, even with the initial "small and good" but still existing unavoidable delay I personally couldn't cope with hearing myself delayed that way, it would throw me off every time I would start to speak. I couldn't finish a single sentence without my brain going into weird loops and confusion, I know because I tried. But I get that everyone is different so I guess I have to accept that being able to tolerate this is some kind of skill that I just don't have. Either way I would probably still try to find a different solution. If this was for monitoring reasons, like being able to tell whether there are crackling noises in my mic feed, I'd use the occasional monitoring as described above. If this was for personal convenience because you are using noise blocking headphones and otherwise can't hear your own voice I'd still find a different solution to get this mic feed from the streaming PC mixer into my headphones plugged into the gaming PC with less delay, if hardware is not an option because of the price tag then e.g. with VBAN protocol from the VoiceMeeter world which has a lot lower delay, better stability and works all the time regardless of OBS being running. Granted, it's a bit more complicated to set up, but as I said, any solution is better than running this through OBS so it's worth the time and effort.

On a sidenote. If you start like 4 tabs on youtube and play audio the delay kind of kicks in immediately. ... I forgot to mention, i have been testing a lot this week back and forward between Teleport and NDI tools 5 screen capture. What i found with NDI, since it is not using OBS, i have no delay but the audio crackles once in a while. So yeah, i think this delay thing is OBS related after all. Again, we could always discuss this further in private instead of on this forum

I've been having this theory that OBS just reacts very badly to situations where the CPU is too busy to fully handle all frames and what you're saying would further confirm that. I was also able to show in other experiments that OBS sync can even get killed by its own sources being busy. And basically any lag spike that you have on your PC, which are more common than one might think, even on high-end systems that usually average on 20% CPU load. This might be what happens when you start the YouTube tabs.

My layman view would be that if data is missing because e.g. the gaming PC was too busy to produce data for a few frames on time NDI will still keep its pace and timings and work with "blanks" through that phase, which for a video feed would show some distortions and for audio produce noise/crackling. That's the real-time approach where you assume that your hardware can always handle the data (usually the case in professional production environments) and accept audio/video distortions for the unlikely event that it can't.

Maybe because OBS is tailored more towards consumer grade it takes a different approach, but from my point of view that approach has failed on so many levels that it betrays its original idea (whatever that was). Whatever unexpected event occurs during frame calculations, OBS will eventually end up increasing the drift to intolerable levels or cause A/V desync in either the stream/recording or at least the monitoring audio, sometimes for itself, sometimes for other OBS instances receiving the feed through NDI or Teleport. There is a 100 ways how the current approach can and will go wrong.

And for most GitHub issues or forum posts that are created for related problems the devs usually respond with lots of good reasons why OBS works the way it does - which does nothing to change the fact that the outcome is bad in 99% of real-world scenarios. Or they tell you that you need to fix the original problem of the lag spikes, which is simply impossible, and even a bit of a mocking answer as long as OBS itself can be lagged by its own sources.

I just wish I was smarter and could figure out how to improve this part of OBS myself, it's open source after all. NDI (standalone, the OBS implementation of it suffers from the same OBS behaviors) shows that it's technically possible, everything else is an excuse, so it's only a question of someone being smart enough to implement it.

The only thing that gave me a little hope was the latest change with OBS 28 where you now can configure OBS to use fixed audio buffering, unfortunately that seems to be incompatible with Teleport. Nevertheless that was a first step in the direction of taking a more real-time processing approach into OBS.

fzwoch commented 1 year ago

Closing, as there is little to be done from this plugin point of view.