Question / Help Streaming hurts game fps + x264 settings optimization

Kharay

Member
What I think is that you already managed to push your limited bandwidth a great deal; the quality you arrived at is relatively speaking pretty solid. Sadly enough there remains, as always a limitation on what can be done on a bandwidth as limited as yours. What I mean is, at the moment the most gain could be had with a higher bitrate. Even just 200 - 300 Kbps would already improve the quality dramatically, I'd imagine.

But, well... I can most decidedly understand if that simply is not available to you at the moment. Either for financial or geographical reasons.

And, what I also think... is that I need a better CPU. Gief job! 8 logical cores, sheesh. ;) And here I am with an i5-760. pffft.
 

SHNS0

New Member
Thing is, Italy is absolute crap in terms of internet speed and quality. DSL is usually 7-10mbps down and 1mbps up, you can normally upgrade the dl bandwith to 20 megs but there isn't one single option among all ISPs that gives better upload. Only fiber plans have a decent upload, at 100/10 megs, but it's avaiable in only very few cities for consumers, and maybe a few more if you disregard money and go with a business plan. To be honest the only thing I can do is test thoroughly how much I can raise the bitrate while keeping it stable, I know for sure that it almost never gets under 780-800kbps, I could maybe be able to squeeze another 50kbps in there but to be honest all the work isn't worth it for such a small amount. That's why I can only rely on optimizing x264, the video quality at the moment isn't spectacular but it's much much better than anything I thought I could realistically achieve when I started the channel.

The i5-760 isn't bad at all. Could be worse, you could be stuck on a Pentium 4!
 

Kharay

Member
An asymmetrical fiber would be your only alternative? Well, I have you beat there then... *remains awfully silent about his 150 Mbit symmetrical line*. ;)

I'd have imagined Italy being more in line with modern times than that really. Heck, even Russians manage to stream DOTA2 in 720p without much of an issue and they're thousands of miles away from the nearest Twitch.TV server (Frankfurt). Sad state of affairs about Italy.

Well... time to move then! Although I would not recommend moving to the Netherlands (where I live). We may have awesome Internet here but... politics aren't much better than Italian politics. ;)
 

WayZHC

Member
Oooh okay now i know how that threads command works. Thanks.

Btw my mediaserver-pc has a Pentium 4 in it ;) Pentium 4 515 (prescott) to be exact.

E: btw lower fps will improve the image quality a lot. With low bitrate and high fps will cause every frame to be blurry.
 

Boildown

Active Member
Setting threads below the default is totally legit, I do it in Handbrake, and I do it in OBS, and it works to make sure some of the CPU is available for other things. You're not "depriving" OBS of anything, x264 simply uses what it is given and what it can use. In my actual testing, 12 threads is more than it can use. And actually (slightly) hurts performance on my i7 2600k that I use for encoding (also 4 core + hyperthreading as the OP's CPU). I generally set threads to between 8 and 10 and get fewer lagged frames than when I have it set to 11 or left at default of 12. The 1.5x rule wasn't intended for CPUs with so many cores and virtual cores, its a legacy setting from the days before so many virtual cores were common.

My 2600k is a stand-alone capture box, with a video capture card, that doesn't have to do anything else. I use the medium preset. It is much improved quality over "very fast". It is not the same as going from very slow to placebo as someone earlier suggested, it is far more worthwhile than that. There are important X264 features turned on in between there, but they are more CPU-costly.

That said, OP, you're going too far away from the presets before you've even figured out if your CPU can handle the presets available. You also have redundant settings in there. Just get rid of all of them and start with just a preset and your animation tune. Start with just a preset and once you verify it works, go one further. You want to find out which is the best preset your computer can handle, until you go one too far, then drop back to the one previous. Only then add things, and then add them one at a time.

And don't add things that are in the preset you're using by default, that just confuses the issue and makes it look like you don't know anything about the presets or settings you're using when you ask for help.

Since you're also playing a game, don't increase the process priority of OBS. Leave it at normal.

Here's another idea:

Do you need to live stream? In other words, is it bad if you stream delayed? If you want the absolute best quality, capture with a relatively easy setting at a high bitrate and full resolution and fps, but don't stream it, capture it to disk. Then when you're not playing, take Handbrake, and re-encode it at a constant bitrate just below what your connection can handle. You can safely go to town and use placebo if you want. Then use the video source plugin to stream the file you create in Handbrake. You can't have a higher quality stream than that, it just won't be anything you're doing live.
 

SHNS0

New Member
Boildown, these are my current settings:

preset=slow tune=animation bframes=16 b-adapt=1 ref=5 deblock=1:1 rc-lookahead=50 aq-mode=2 partitions=p8x8,b8x8,i8x8,i4x4 direct=auto me=umh merange=48 subme=10 psy-rd=0.5:0.0 trellis=2 no-fast-pskip threads=10 resize:width=640,height=480,method=spline

For some reason setting slow from the OBS drop window makes the game's framerate a bit more instable, so I just override it through the custom settings. To be honest my CPU is perfectly capable of handling these settings, actually I could make them even more hardcore without much problems. Right now I get an average of 30-35% load with peaks of 45%, which is pretty great if you consider how I've got umh, merange 48 and subme 10 going. The testing which settings I'm comfortable with and adding them one by one is pretty much what I already did. The game itself is ridiculously light on CPU so this stuff isn't really a problem.

As for uploading recordings, well, live streaming is the whole point and doing recordings would pretty much kill it. I already do that with my best replays on Youtube.
 

Boildown

Active Member
Right off the bat I see b-adapt=1. The slow preset uses b-adapt=2, unless I recall incorrectly (I'm at work at the moment, don't have my chart bookmarked here). So if I'm correct, you're setting the slow preset but setting an easier setting (b-adapt=1) than the slow default (b-adapt=2). That can account for why your "custom" slow runs faster than the unchanged slow preset. You're not running the full slow, you're actually at a custom medium that is almost but not quite "slow", even though it exceeds slow in other areas.

That's just a bad way to do things. The x264 people did an excellent job of doing cost-benefit analysis for their presets, adding the best per cycle features first, and the barely-makes-a-difference-but-costs-a-ton-of-CPU-cycles features last. So make sure to do things in the correct order for ideal results.

Just get rid of all that stuff. Here's what you put: "opencl=true preset=slow tune=animation". And set OBS to "slow". That's it. Nothing else. Let OBS take care of the resize and let the rest use the slow preset defaults. You don't even need "preset=slow", but if you think there's some magic in setting it in the advanced settings line, go for it.

See how that performs. If it does well, then increase the reference and b-frames a bit. If it can handle all that, then increase the "me=" to stronger modes. Don't change merange, subme, partitions, or anything else for that matter, from the defaults at any step.

What I think you'll find is that your computer won't be able to handle slow, and you'll have the revert to medium. That's fine. Do what I said above except change it to preset=medium instead. Then, after testing at each step, gradually increase ref, bframes, and me up to but not exceeding what the default is for the slow preset.

And because I went through all this effort typing this out, please post logs and keep us informed of your progress. I'm curious if your CPU really beats my OC'd 2600k. :P
 

SHNS0

New Member
In my first post I was saying that my old setting was slower with 12 bframes, and I had peaks of 65% load (which means I could take quite some more lol, possibly even going to veryslow).
Thing is, I've noticed that having hardcore settings on me, subme and merange really helps with my type of videos (very fast-paced, LOTS of bullets and stuff moving on-screen, etc), I prefer going with badapt=1 rather than badapt=2 and lots of bframs which is pretty tough and I probably wouldn't take it together with umh and subme=10. Tomorrow I'll do some settings tests and let you know.
 

SHNS0

New Member
Ah, I remember that website from some time ago when I started with encoding, thanks anyway. Apparently tune=animation works mainly on deblock and psy-rd.
I didn't understand one thing though, do presets and tuning override the other settings you specify, or is it the opposite? For example, if I hypothetically set preset=placebo which automatically brings bframes to 16, and I then specify bframes=12, which one does x264 actually use?
 

Boildown

Active Member
SHNS0 said:
Ah, I remember that website from some time ago when I started with encoding, thanks anyway. Apparently tune=animation works mainly on deblock and psy-rd.
I didn't understand one thing though, do presets and tuning override the other settings you specify, or is it the opposite? For example, if I hypothetically set preset=placebo which automatically brings bframes to 16, and I then specify bframes=12, which one does x264 actually use?

Medium setting is the default. Presets override the default. Tunes override the Preset. Any thing else you set overrides any default, preset, or tune.

Note that tunes have a much smaller scope of things they change than presets, and that the same tune changes depending on which preset you're using.
 
Top