Question / Help Switching from NVENC to x264 endcoding (Stream & local recording) - Best settings?

I thought that was the case but then thought that I was mistaken when I saw the performance. I can't think of any reason why the card would be overloaded. I'm not using any NVMe drives or anything like that, only the one card (an evga 1070 SC) which is running at x16 without issues, and is the only expansion card in the system. I have a few SATA drives and USB devices, nothing out of the ordinary. Any suggestions as to where I should look to find a potential bottleneck here?

Is it normal to see windows' scheduler handle x264 (or other heavy loads while gaming) poorly (requiring affinty set to avoid frametime variation) as I mentioned? I haven't made any kind of changes to Windows in this regard, so I don't see why my experience should differ to others', but this seems very poor.... That being said, I don't imagine that many people constantly monitor frametimes, and with my frame rate remaining unchanged, I can imagine that many people wouldn't even notice this issue.
 
Following up on this, others I have asked are also seeing 5-10% FPS decrease in-game, when using NVENC - either through OBS or shadowplay.
Likewise I've had a couple of friends monitor frametimes and indeed they have seen a significant increase in variation when the CPU is under heavy load.
It seems like we have all the tools we need, to make things work as expected.... Just nobody knows how to do it. Everyone I ask, suffers the same issues, but nobody really knows what to do about it all. Shadowplay 'just works', until it doesn't, and then people try OBS but can't get it to work either, and the deeper we look, the more problems we find :(
 

Boildown

Active Member
Too much theorycrafting and not enough log files here. Do a five minute or longer test stream / recording using the best settings you've been able to manage on your own, make sure you're encoding high action gameplay (not just standing around in-game), and then post that log file along with the VOD link (if applicable).
 
I'll happily follow whatever instructions can get this resolved, so I will do that shortly, thanks for your reply mate. I don't really have a "best settings I made on my own" because every setting I've ever tried has suffered the exact same behaviour. I'll just do it as instructed by Harold above.

However, I see these problems long before I even begin to play. The framerate drops from NVENC occur immediately upon recording/streaming and the frametime variation from x264 is the same. Even if I'm just standing there doing nothing staring at a wall on an empty server.
 
Here's the log: https://gist.github.com/c3d79b46a917ec71746661e71dac91ef
And the stream: https://www.twitch.tv/videos/179561706 (Warning NSFW adult language)

Yes, the stream looks awful, I think that's to be expected given that it's 1440p downscaled to 720. The video looks gorgeous but is 18GB for 8 minutes. A bit extreme. I don't really care about image quality too much right now.

What concerns me is the load on the machine and how it's handled.

I start the recording about 15 seconds into the stream. Around 8:45 in the stream, you can see me stop the recording. Note my frametime graph in the bottom right corner flatten right out? I know you can't read the numbers there, but when I'm using x264 my CPU usage never goes over 80%, and rarely over 70%. Plenty of overhead, one would think.

At the end of the stream, I stare at a spot and get about 130FPS. When I stopped the stream, the same spot was more like 145.

VSync and game mode are off. Edit: Since you only really need to watch the stream at 0:15, 8:45, I should add that I do alt-tab in and out of the game here and there.

Thanks for any advice.
 
Last edited:

BK-Morpheus

Active Member
"my CPU usage never goes over 80%, and rarely over 70%. Plenty of overhead, one would think."
If that's overall CPU Usage, there is no overhead.
Overall 70% often means that the Gaming threads and some OBS Threads reach over 80% (maybe you don't have FPS Limit or Vsync enabled and so you let the CPU or GPU run into full Utilization which means Bottleneck).
 
That's overall, as in the game is using 40% and OBS is using 30% and there's 30% left over. (Edit: and that's at heavy times. It's usually more like 60% all up, meaning almost half my CPU is unused) You shouldn't bottleneck until you hit 100 (or darned near) unless the scheduler is failing. If the CPU were overloaded, the bottleneck would cause a drop in GPU utilisation too, and that's not happening.
 

BK-Morpheus

Active Member
If you have a CPU with SMT or Hyper Threading, you can also bottleneck at 50% total CPU load (for example 100% on four real cores and 0% on four hyper threads).
Games often use 2 Threads. If those were at 70% and if the Hyper Threads that belong to those real Threads which the game is using, there is already a bottleneck.

I got 8 cores and 16 threads, so it's even more obvious. Even with "slower" x264 preset I can see that my total core load is way under 80%, but the lags and lost frames in the video/stream are very heavy.
 
Processors measure utilisation by means of idle time. If it's at 60% that means it's idle 40% of the time. Sounds like you are seeing the same windows scheduler problem I am.
 

BK-Morpheus

Active Member
I remember when the Win7 update process was producing a problem where one Core/Thread was under full load and the systemw was very slow, although people reported, that there is only 25% CPU load. That was on systems with 4 cores, where only one core was under full load which equals 25% CPU load in Taskmanager.

With hyper threading it gets even harder to see cpu bottlenecks, because the splitting from core count to thread count always makes it look like there is still a lot of headroom, where in reality there is not.
 
I definitely just found one major cause to this: MSI Afterburner, HWInfo64, HWMonitor and every other monitoring tool I tried, report my CPU usage about 15-20% lower than windows does. When I was on "80%" (according to AB) I was actually on 100% (according to task manager). What the.....

Edit: It's worse than I thought - Even windows doesn't agree with itself. It's saying I'm at 35% utilisation and 75% idle.
 
Last edited:
I remember when the Win7 update process was producing a problem where one Core/Thread was under full load and the systemw was very slow, although people reported, that there is only 25% CPU load. That was on systems with 4 cores, where only one core was under full load which equals 25% CPU load in Taskmanager.

With hyper threading it gets even harder to see cpu bottlenecks, because the splitting from core count to thread count always makes it look like there is still a lot of headroom, where in reality there is not.

That's just windoze being trash. If there's one physical core busy out of four, that's only 25% busy and the system should happily push other work to the other 3 cores. Same applies here, if the system is 80% busy the scheduler should be moving threads to utilise the other 20%. The threads aren't active 100% of the time, on the contrary, they run and stop and run and stop constantly. Hyperthreading should not change this situation at all - at least not in the case of multi-threaded applications, which my game and x264 both are. Sure, if it's a single threaded application and that thread is maxing out one physical core there may be problems, but that's really a problem for the past (given that practically everything is multithreaded these days). I don't see how it would apply here.
 
Yeh, running procmon and task manager side by side, they report up to 7% difference in idle time (System Idle Process). Obviously my windoze install is borked, I should stop wasting all of your time and come back later when I've reinstalled. Thanks for your help so far... I'll be back :)
 

Boildown

Active Member
My new Specs:
CPU: i9 7900X
MB: X299 MSI Gaming Pro Carbon
RAM: 32 GB G-Skill Ripjaws 4
OS: Windows 10 (64-Bit)
Graphics: KFA GTX 1080

12:54:08.870: CPU Name: Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz
12:54:08.870: CPU Speed: 3292MHz
12:54:08.870: Physical Cores: 6, Logical Cores: 12

12:54:08.896: Adapter 1: NVIDIA GeForce GTX 1070

That's a 6-core, not a 10-core, CPU there. Also a GTX 1070, not a 1080.

Or you sent us a log from the wrong PC, which is not a mistake I can understand to be possible to make. This is why after a half-page or so I refuse to theorycraft further and ask for logs.

Anyways, this is a problem:
14:10:23.488: [x264 encoder: 'streaming_h264'] tune: zerolatency

Turn off the zerolatency tune.

From here: https://superuser.com/questions/564402/explanation-of-x264-tune

You can see that the zerolatency tune alters your settings to do the following:
- zerolatency:
--bframes 0 --force-cfr --no-mbtree --sync-lookahead 0 --sliced-threads --rc-lookahead 0

All of which are terrible for quality (except force cfr). Turn it off, you don't want it on.


Also, you said you have V-Sync off. You need it On so as to not overload your GPU. Change that too.
 
Last edited:
Hah, thanks. I read one site and it says to use zerolatency for streaming... I read another and it says don't. LOL See what I mean about under-documented XD

I'm aware it's a 6core, did we say something about 10?
 

Boildown

Active Member
I'm aware it's a 6core, did we say something about 10?
Well that explains it, you're not even the OP. Why didn't you make your own thread? The OP, which I didn't double check when I finally saw a log file, said he had an i9 7900X.

Nowhere on the OBS site did you see anything about using the zerolatency tune. If that was written on the OBS forums, any one of at least ten different posters certainly would have jumped all over it to say how wrong it is.
 
Same thread because originally, it was the same question.
Is there an area of the OBS site which documents this stuff aside from the forums? I can tell the load on you guys is really heavy here on the forums and if I can help with that by reading stuff somewhere I'd like to do that.
 
Top