Question / Help Stream starts lagging from time to time

maNii

New Member
So I started streaming reguraly a week ago, and I noticed that from time to time it stars lagging like crazy, for 10-20 seconds and it all fixes itself. Not sure what's the problem.
I attached the log file, doesn't say it lags too many frames? Log file is from 1:10 hour stream. Any ideas how to fix it? Thanks

Lag clip: https://clips.twitch.tv/DelightfulBoxySproutBloodTrail
 

Attachments

  • 2019-01-27 16-21-26.txt
    20.3 KB · Views: 15

Narcogen

Active Member
Windows is out of date and Game Mode is on by default and cannot be switched off. Follow the instructions in the signature below to update and deactivate game mode.

17:40:12.647: Output 'Replay Buffer': Number of lagged frames due to rendering lag/stalls: 7629 (2.8%)
17:40:12.648: ==== Replay Buffer Stop ============================================
17:40:12.662: [rtmp stream: 'adv_stream'] User stopped the stream
17:40:12.662: Output 'adv_stream': stopping
17:40:12.662: Output 'adv_stream': Total frames output: 276665
17:40:12.662: Output 'adv_stream': Total drawn frames: 269214 (276843 attempted)
17:40:12.662: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 7629 (2.8%)
17:40:12.670: ==== Streaming Stop ================================================
17:40:12.726: Video stopped, number of skipped frames due to encoding lag: 1334/276827 (0.5%)


Rendering lag can be caused by Game Mode.

16:23:18.649: [NVENC encoder: 'recording_h264'] settings:
16:23:18.649: rate_control: CBR
16:23:18.649: bitrate: 10000


You will get better performance and quality from the NVENC encoder by using CRF or CQP quality setting rather than constant bitrate. CBR is intended primarily for streaming since most platforms require it.

16:24:08.397: adding 23 milliseconds of audio buffering, total audio buffering is now 69 milliseconds
16:24:42.325: adding 116 milliseconds of audio buffering, total audio buffering is now 185 milliseconds
16:24:42.351: adding 46 milliseconds of audio buffering, total audio buffering is now 232 milliseconds


Increasing audio buffering is generally a sign of system overload.

16:23:18.649: 2-pass: true

Turning off 2-pass may reduce the encoding lag.
 

maNii

New Member
Thank you for your answer. Did all of the steps and it made it even worse. Streamed for 10 minutes and had to stop because of the lag. Log file attached.
 

Attachments

  • 2019-01-30 18-16-42.txt
    13.6 KB · Views: 9

Narcogen

Active Member
Also, I didn't notice but you seem to have the replay buffer feature on as well, that probably does not help. But I am not sure that would cause this, either.

18:35:22.274: Output 'Replay Buffer': Number of lagged frames due to rendering lag/stalls: 1896 (6.3%)
18:35:22.275: ==== Replay Buffer Stop ============================================
18:35:22.314: [rtmp stream: 'adv_stream'] User stopped the stream
18:35:22.315: Output 'adv_stream': stopping
18:35:22.315: Output 'adv_stream': Total frames output: 29946
18:35:22.315: Output 'adv_stream': Total drawn frames: 28207 (30103 attempted)
18:35:22.315: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 1896 (6.3%)
18:35:22.316: Video stopped, number of skipped frames due to encoding lag: 259/30090 (0.9%)


2-pass encoding is still on.

18:27:00.594: 2-pass: true

Is the framerate in Fortnite capped?
 

maNii

New Member
So I streamed with my old settings but 2-pass off. Same thing as before, I noticed it mostly lags when I use some kind of mobility ingame or if I'm gliding. I have my fps locked on 144 in Fortnite. I'm running replay buffer to save the clips if I do something crazy. Adding 2 hour long stream log file, it's named the same because I didn't restart the OBS after that laggy attempt.
 

Attachments

  • 2019-01-30 18-16-42.txt
    24.6 KB · Views: 4

Narcogen

Active Member
18:26:53.825: Output 'Replay Buffer': Number of lagged frames due to rendering lag/stalls: 6 (0.5%)

Lag in OBS caused by an in-game event means your frame cap isn't low enough.
 

maNii

New Member
I only noticed on those occasions, but it happens other times aswell. Tried capping it even lower but it didn't help. Any more ideas? :(
 

Narcogen

Active Member
How much lower did you cap it?

There aren't really any special tricks here. Rendering lag happens when OBS can't use the GPU because it's at 100%. If the framerate isn't capped, or isn't capped low enough, then when the game pushes the GPU 100% in order to try and hit the framerate it is trying for, then OBS isn't able to render its own frames, and you get stutter.

If having half of one percent of frames lag in a session is a problem (or about 3% as in your original log), then the way to do it is to reduce GPU utilization to the point that the scenes in your game that are the absolutely worst-- the most demanding-- can be rendered on your GPU at your target framerate set while still keeping GPU utilization at about 90% or so, so that OBS has overhead to work.

That can be done by: reducing capture frame size (canvas size), reducing capture frame rate, turning on vsync, capping framerate, reducing other fidelity options that reduce GPU load.

The only way to absolutely separate the GPU load of your game from the GPU load of OBS is a two PC setup, either with a capture card or use of other methods, like NDI (although that still has some system load).

The only other simple change I can think of is to make sure your GPU is in the right slot and is properly seated by checking PCI interface speed with GPU-Z, but I think if that was an issue you would not be able to run Fortnite at 144fps, so I'm pretty sure that's not it.
 

maNii

New Member
I tried 120, but I could already feel the difference when playing, since I have 144hz monitor, it didn't feel smooth at all. The thing is some of the times I have 144 fps without spiking and it still lags on stream, that's what confuses me...
 

Narcogen

Active Member
I imagine it is possible for a game to generate a frame that is easy for the game to render but hard for OBS to render, or times when OBS requirements go up so that the usual amount of overhead is not enough. The idea is to have enough overhead so that no matter how bad things get, OBS never drops frames.

Basically, unless you have a lot of extra headroom on a setup, trying to maximize game framerate is always at odds with having a completely smooth stream. This is an obstacle even for people who game only at 60fps. Because configuring the game and OBS properly to make surge lagged frames can never happen means, by definition, creating a situation where your game is not utilizing all the GPU resources it *could* be using to drive a higher framerate.
 

maNii

New Member
So a quick question, if I get like GTX 1070 8GB instead of my 1060 3GB now, would it fix the problem?
 

Narcogen

Active Member
I couldn't say, sorry. If you're not willing to cap framerate, possibly not.

If you cap at 60 does the problem go away? Because if not, then there may be an underlying problem that wouldn't be addressed by just adding GPU performance.
 

maNii

New Member
5-10min test stream with 60 fps locked in game. Doesn't really feel any better. The thing is, I lock my fps at 144, but it can be up to 200-300 if not locked, maybe even more
 

Attachments

  • 2019-02-02 15-56-09.txt
    17.4 KB · Views: 5

Narcogen

Active Member
Replay buffer is still on. Did you make any attempts with it off? Again, not sure it would help, but...

One attempt had massive network lag, not sure why.

15:57:17.934: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 52 (4.2%)
15:57:17.934: Output 'adv_stream': Number of dropped frames due to insufficient bandwidth/connection stalls: 568 (54.7%)

16:06:34.849: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 282 (1.3%)

My only other suggestion might be to remove the 2nd game capture scene to its own collection. I know that multiple game captures in the same scene degrade performance; not sure if it's a separate scene. Might be worth trying.
 

maNii

New Member
So I got new GPU last week, 1070 8gb. It didn't solve my problem. Upgraded to i7 8700k and problem fixed, smooth stream as well as gameplay, very happy!
 

Attachments

  • 2019-02-13 18-39-34.txt
    18.9 KB · Views: 7
Top