DistroAV / DistroAV

DistroAV (formerly OBS-NDI): NDI integration for OBS Studio
https://distroav.org/
GNU General Public License v2.0
3.33k stars 366 forks source link

Reason for Microstutter and Lags on my Setup #161

Closed joschariedl closed 6 years ago

joschariedl commented 6 years ago

First off, I would like to thank you for this great plugin. I am really looking forward to updates, new features and bugfixes in the near future! I want to support your work and you should feel free to ask me, If you need a guy for some serious testing your new builds! Thank you!

So, I did a bunch of tests with your plugin and different games. I've used the filter and the NDI output aswell. I've found out, that the gpu acceleration of the inscene embedded NDI sources on the receiving PC caused a lot of lag. So far, so good. Turning off the acceleration fixed most of it, but there is still some minor lag and stutter occuring, especially in gaming scenarios where there is a rapid change in detail or scenery.

For example walking from an inside to an outside scenario. So I checked the network traffic, when these lags occured and saw that they correlate with high/low bitrates transferred over the network. It is very obvious when you step from a low detail and dark scene (60mbits) into a very light and detailed scene (140-180mbit) ingame or vice versa. First the lags are pretty heavy with the bitrate spikes, and when the bitrate 'calms down' to a more stable rate, the microstutters are just kicking in in regular intervals. Same goes for high framerate games and spikes, which NDI or the plugin doesn't seem to like eather.

I've ruled out, that the gaming PC OBS installation had issues with rendering the scenes I've justed for the tests, just so you now. Might it better for OBS to handle a constant bitrate of 50mbit at 1080p 60fps? Is a constant bitrate even possible with NDI? My gaming PC is a X99 5820k and my streaming pc is a Ryzen 1800x.

Cheers from Germany, Joscha

Palakis commented 6 years ago

OBS Studio usually tries to get all GPU resources which it can get while the game also tries that

OBS' frame rate is always capped (with the frame rate set in settings), so that's not true. Instead, that's the game running at uncapped framerate that is causing issues.

While the OS takes care of balancing CPU resources between apps, there's no such thing for the GPU. So if you have several apps running that use the GPU, even a single app running with uncapped framerate will try to use as most GPU resources as possible and disturb itself and the other apps.

Palakis commented 6 years ago

@CHEF-KOCH

Nope, what you called 'capped' is set to 350 FPS (default)

Where did you find this information?

I'm not sure if GPU not get handled the same way like the CPU, that's in both cases a job for the driver which is regulated and monitored by the OS.

I'm no GPU engineer, so I'll believe you on this.

joschariedl commented 6 years ago

Thx for the answers guys! That would explain everything.

The framerate capping was also necessary, when I had only a one pc setup for streaming. especially when playing newer and/or graphical sophisticated games, obs was really fighting to keep the rendered framerate at 60fps, when the game was not capped or I would dial down the graphics presets ingame instead.

Unfortunately I can't keep down the framerate in my use case, since I am streaming fps games where high framerates are basically necessary. I would've really liked to use your plugin, but had to buy a capture card for now. But still, If you need someone for testing purposes, I am still here! ;-)

Helgaiden commented 6 years ago

@joschariedl I use the plugin just fine without issues streaming 720p60 with games that can go way over 60fps. I do use vsync, but vsync on a 120 or 144hz panel isn't really a loss of any kind. That's plenty of fps.

joschariedl commented 6 years ago

@Helgaiden can you provide me a sample video of some sort? Because your method shouldn't be any different from mine, since the issue isn't on the streaming computers end. Or do you got a beefier machine or SLI in your system?

But since I go for higher quality and want to dive into the realm of 1080p60fps streaming some day (at least when twitch will give us the bitrate we need for an acceptable compromise), I will stream in 900p60fps at 8MBits with the medium preset in the x264 settings.

And secondly, when using vsync you will introduce input lag, as far as I know. I don't want that, when playing on a low latency panel in the first place. Sure, I can compromise on that to, at least for the streaming purpose, but there is also the issue with keeping the appropriate frame rates with this method, in order to keep vsync working at high refreshrates. One dip in FPS and you will have a tearing feast on stream. :-(

Here you can see a sample with my current settings. Other than the unoptimized game with the poor framerate from time to time, it runs pretty smooth: https://www.twitch.tv/videos/281852056

Helgaiden commented 6 years ago

Vsync on a high refresh rate panel won't negatively impact input lag the way you think it might, nowhere near as significant as you seem to think it might. My gaming system is a Xeon e5-1620v2 aka i7-4930k at 4.5ghz at 1080p with a 980ti.

Https://www.twitch.tv/coalitiongamingcrew Every stream in the VODs is done with OBS NDI at 720p60, feel free to have a look.

golgoo13 commented 6 years ago

@CHEF-KOCH thanks you i have downgrade FPS 30 < 24 it's perfect for me my connexion is usuless for you ?