Question / Help NVENC streaming limited to 20k Bitrate for month

Julz2k

New Member
Hi guys,

maybe you can help me. I've streamed at 40k bitrate to youtube, using OBS for month half a year ago. For a few month now, maybe four month the max. bitrate is limited to 20k. Also the video encode usage from my 1060 won't go over 20% now (I'm not sure at how many usage it was before)
Any tips here what causes the issue?
 

Boildown

Active Member
No idea what you're talking about. Who are you streaming to? 40k (40kb/s ?) is way too low for anything but audio, do you mean 40Mb/s? How is OBS involved? This sounds like a problem with your ISP. Read the stickied posts on this subforum.
 

Julz2k

New Member
Yes I mean 40Mbit/s. 40Mb/s is around 400Mbit. My ISP is not the problem here. It's either OBS or Nvidia drivers.
 

Boildown

Active Member
Who (which service) are you streaming to? The third stickied post tells you to post your OBS log files.
 

Julz2k

New Member
I'm streaming to youtube.
Youtube is not the limiting factor here. It seems like either OBS/NVENC is using VBR isntead of CBR.
(When swtiching windows the bitrate goes up from 20k to 30+. In Windows capture it stays at 20k)
A few month ago I had stable 40k bitrate anywhere.

There is nothing from intereset in the log file.
https://pastebin.com/DLNCNufn
 
There is no streaming info in the log you posted. Please run a stream session for a few minutes, then stop the stream and upload current logfile.
 

Boildown

Active Member
19:02:34.064: [NVENC encoder: 'streaming_h264'] settings:
19:02:34.064: rate_control: CBR
19:02:34.064: bitrate: 36000
19:02:34.064: cqp: 0
19:02:34.064: keyint: 120
19:02:34.064: preset: bd
19:02:34.064: profile: main
19:02:34.064: level: auto
19:02:34.064: width: 1920
19:02:34.064: height: 1080
19:02:34.064: 2-pass: true
19:02:34.064: b-frames: 2
19:02:34.064: GPU: 0
19:00:52.386: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://a.rtmp.youtube.com/live2...
19:00:52.420: [rtmp stream: 'adv_stream'] Interface: Realtek 8812AU Wireless LAN 802.11ac USB NIC (802.11, 417 mbps)
19:00:52.775: [rtmp stream: 'adv_stream'] Connection to rtmp://a.rtmp.youtube.com/live2 successful
19:01:47.540: Output 'adv_stream': Total frames output: 2886 (3271 attempted)
19:01:47.540: Output 'adv_stream': Total drawn frames: 3192 (3308 attempted)
19:01:47.540: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 116 (3.5%)
19:01:47.540: Output 'adv_stream': Number of dropped frames due to insufficient bandwidth/connection stalls: 385 (11.8%)

You're streaming over wireless at 36Mb/s and over 15% of your frames aren't making it on time or are just dropped. Don't stream over wireless; get a wire.

Also, change the Preset to HQ, Profile to high and 2-pass to false.
 

Julz2k

New Member
You're streaming over wireless at 36Mb/s and over 15% of your frames aren't making it on time or are just dropped. Don't stream over wireless; get a wire.

Also, change the Preset to HQ, Profile to high and 2-pass to false.

My connection is not the problem here.
The problem is that OBS/NVENC won't stream at a constant bitrate. The bitrate stays at 20k and when I start opening windows, closing them the bitrate goes up to 36k and stays there stable as long as I'm popping and closing windows.
But when I stream like a normal person with constant movement the bitrate drops, goes up, drops, goes up. That what's causing frame drops/buffer.
The connection to the youtube ingest server is fine, constant 20ms even when uploading with 36mbit/s
I also tested my upload speed with 1 connection to some ftp servers. I had constant 39,8mbit upload for hours.
Only at the start when the connection is "buffering" it builds up slowly, few 100ms to reach 39,8Mbit. That what's causing the buffer at least that what I'm thinking cause it is reproduceable.
I show you in another Video what I mean.

I changed the Quality options like you mentioned, why no 2-pass encoding and why not preset at Bluray? I got the best quality out of Bluray preset a few month ago when everything was still working.
 

Julz2k

New Member
You have dropped frames, so your connection is the problem.

Of course that's the easiest to come to. But the dropped frames are not the main issue here and the dropped frames are only appearing cause of the "variable" bitrate. When I had constant 36000kb/s I had a few dropped frames once the upload started, for a few seconds. Then the connection was stable, cause there was no variable bitrate, going from 20k to 40k bitrate up and down.

That's the main problem I have. Please tell me how to fix this. I never had this issue a few month before (Maybe some settings have changed in the new version?)

Here is the new log file, tested with Wlan and also Ethernet at the End. The dropped frames are minimal here, still the problem exists of course.
https://gist.github.com/anonymous/c11430d0906e45bb384181f5585da86a

And please have a look at the latest youtube stream and keep track of the bitrate @ obs.
https://www.youtube.com/watch?v=ke9XaOri6HQ

Thanks.
 

Osiris

Active Member
NVENC not using all the bitrate when there isn't alot going on is a known issue in the NVIDIA drivers, but it won't cause the dropped frames. If the dropped frames are minimal you can try enabling the new networking code in Settings -> Advanced, or lower the bitrate a bit.
 

Julz2k

New Member
Well good to know, so it's a bug for almost 6 month now?! Why hasn't it be fixed and could I fix it with installing an old driver?

As I said, on the fly upload alignment without any buffer can cause dropped frames. Not every packet type is made for such huge bitrate changes e.g. 20k-40k or higher. I can tell cause I've also tested with another 500Mbit upload FTTH connection (8ms to youtube ingest) And keep in mind that there is only one established connection to youtube.
 

Julz2k

New Member
Sadly I haven't found any thread or even a hint that the problem Osiris mentioned exists on Nvidias end.
 

Boildown

Active Member
01:42:02.152: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://a.rtmp.youtube.com/live2...
01:42:02.180: [rtmp stream: 'adv_stream'] Interface: Intel(R) Ethernet Connection I217-V (ethernet, 1000 mbps)
01:42:02.547: [rtmp stream: 'adv_stream'] Connection to rtmp://a.rtmp.youtube.com/live2 successful
01:42:02.575: ==== Streaming Start ===============================================
01:45:47.791: [rtmp stream: 'adv_stream'] User stopped the stream
01:45:47.791: Output 'adv_stream': stopping
01:45:47.791: Output 'adv_stream': Total frames output: 13441 (13503 attempted)
01:45:47.791: Output 'adv_stream': Total drawn frames: 13539
01:45:47.791: Output 'adv_stream': Number of dropped frames due to insufficient bandwidth/connection stalls: 62 (0.5%)

Still dropping .5% frames with a wire, which is high. I think you're streaming at more bitrate than your ISP can handle. As a test, trying dropping the bitrate down to 20Mbps and see what happens.
 

Julz2k

New Member
Still dropping .5% frames with a wire, which is high. I think you're streaming at more bitrate than your ISP can handle. As a test, trying dropping the bitrate down to 20Mbps and see what happens.

This is not the problem here as I mentioned 3 posts over your head but thanks for the advise.
And if I would limit the bitrate to 20k I gain nothing from it, would probably stay at 20k cause Nvidia is setting the limit around 20k without any motion. Everything I want is constant bitrate.
 

Boildown

Active Member
Its a troubleshooting step, not a proposal for a permanent change. If there's still .5% drops at 20Mb/s then I know we're barking down the wrong tree. If not, then it will be interesting to see if the video quality is improved.

CBR is never perfectly constant. Not Quicksync, not x264, not NVEnc. My theory is your problems are the result of the bits backing up in the output queue because your ISP is barely able to handle it. Whether its because of spikes in the bitrate or not, I don't know.

Another problem is that when doing NVEnc, you're not allowed, in OBS Studio, to change the buffer size. As I recall though, it is possible in OBS Classic. Smaller buffer means closer adherence to the nominal bitrate. Larger buffer means the bitrate can change more to accommodate changing video complexity. The default is to have the buffer size equal to the bitrate. A few years ago, i only had 5000kb/s upload and I saw bad pings occasionally when I streamed at 3000kb/s with a 3000kb buffer. So I changed the buffer to 2000kb and the problems went away. The bitrate was always set to 3000kb/s, but changing the buffer size made the difference. I suspect this is the problem you're running in to, you need to change the buffer size in NVEnc to be smaller but OBS Studio doesn't let you except with x264.

I previously noted the NVENC / OBS Studio limitation here: https://obsproject.com/forum/threads/i-need-a-way-to-limit-my-bitrate-to-4000kbs.74636/#post-317425 In that thread, @R1CH said to use low latency mode. You might try that too. I thought I made a feature request post to re-enable custom buffer size for NVEnc in OBS Studio, but if I did I can't find it. And the other options would be to try x264 instead, or OBS Classic. But first, you should try my 20mb/s test.
 

Julz2k

New Member
There is no reason in trying out the 20mbit test. The only thing which is different is the Bitrate changing from min 12000 instead of 20000 and peaks will still be at 20k /40k like they should be anyway at a constant bitrate.
I never had this problem and I had constant 40k bitrate without any problems. It was stable back then it has nothing to do with my bandwith from my ISP. A bit packetloss is not a problem if it's under 1%. I never had any artifacts or damaged files in hour long streams.

Setting a buffer or low latency mode also does not help here. I could also limit the bitrate to 30k won't change the main problem.
But thanks for trying to help me out.
 
Top