Question / Help Question: I set custom buffer to 32,000kbit, bit rate to 2000kbps

Videophile

Elgato
Hi,

So can anyone explain to me what the buffer does, and what increasing/decreasing it does to video quality/bitrate?

Thanks.

-Shrimp

P.S: At 32,000 my bit rate did not spike above 2500 from 2000, and the video quality was pretty damn good.
 

alpinlol

Active Member
been also playing around i cant achieve the same result as you do shrimp

it still fluctuates its even worse now as example if put the bitrate to 2500 and a buffer of 30000 it fluctuates even worse since its going from 1000 all up to 3500

when i set it to 2500 bitrate and 5000 buffer it fluctuates between 1700 and 3000

and with a 2500 bitrate and 2500 buffer it only fluctuates between 2000 and ~3100

i've even set vbv-maxrate and vbv-bufsize as custom commands and it literally did the same as if i would be using the options given in obs

and the cbr padding enabled or disabled didnt change anything.



is this simply how the encoder works or is there by any given chance to have a quite "Constant" bitrate? or does it need even more custom commands?
 

Sapiens

Forum Moderator
i've even set vbv-maxrate and vbv-bufsize as custom commands and it literally did the same as if i would be using the options given in obs
The GUI options in OBS are setting vbv-maxrate and vbv-bufsize so yes, it "literally did the same thing." You can try setting a more strict ratetol value but there is no magic to be had by setting an enormous buffer size and delaying your stream even further. Leaving the buffer size at its default value is the best choice unless you know what you're doing and know that you need to change it for a specific purpose.
 

Boildown

Active Member
I don't think x264 provides for a truly constant bitrate in live streaming. But anyways:

Small buffer means the stream stays closer to the nominal bitrate you set. But then it can't compensate as well for complex scenes, so quality goes down.

Large buffer means that the stream can vary more from the nominal bitrate, increasing quality but potentially spiking the bitrate to levels that may interfere with game traffic or the ability of viewers to download the stream.

Personally I noticed my pings in Planetside 2 spiked when I streamed to Twitch at 3000 bitrate with 3000 buffer. So I kept the bitrate at 3000 but reduced the buffer to 2000, and all was then well. The quality seems higher than doing something like setting a bitrate of 2500 and buffer of 2500 (qualitatively, I didn't do any measuring).

I have not bothered to min/max this. Its possible that the best combination for me is something different, like 3500/1500 bitrate/buffer. It would take some testing that I probably won't bother to do unless my channel somehow becomes super popular (not gunna happen).
 
Last edited:

alpinlol

Active Member
The GUI options in OBS are setting vbv-maxrate and vbv-bufsize so yes, it "literally did the same thing." You can try setting a more strict ratetol value but there is no magic to be had by setting an enormous buffer size and delaying your stream even further. Leaving the buffer size at its default value is the best choice unless you know what you're doing and know that you need to change it for a specific purpose.


used just as a test "ratelol=0.01" and set bitrate/buffer to 2500/2500 and it only fluctuated between 2300 and 2700

which is to be honest an massive improvement but cant really tell right now how much the quality actually suffered, gotta test it tomorrow
 

Videophile

Elgato
Here is a stream using those settings.

I will do more streams with it for more testing.

Settings: 720p45@2000kbps. 32,000kb buffer, 1080p60>downscale (36x lanczos) to 720p45

X264 custom settings:
Code:
rc-lookahead=120 keyint=120 bframes=4 d-adapt=2 ref=4 partitions=all direct=spatial opencl=true

After doing some testing, using ref=X and bframes=X can give a pretty huge increase in quality, however the CPU needed goes up a shit ton as well. With my 2600k@4.0Ghz, I cannot go above bframes=4 and ref=4. If either is at 5, my CPU peaks at 100% and it takes too long to encode. Maybe the new 5960x could do it. At bframes=16, which I tried, the quality looks godly.

frames are the ones that can look ahead at the coming frames, and then based off of that info, the X264 encoder chooses what to change, and how.

The way the base line encoding is I believe is IPBBBIPBBBIPBBB, but those B frames are costly. I think at medium preset, B frames are set to 3. anything slower, and it goes 8, then 16.
 
Last edited:

Sapiens

Forum Moderator
d-adapt eh?

bframes is set to 3 until you hit the veryslow preset, but b-adapt is changed to 2 at the slow preset which is where a lot of the extra CPU usage comes from (b-adapt 2 doesn't thread nearly as well). While b-adapt is set to 1 you can up bframes to 16 with a negligible performance impact. Keep in mind that this is the maximum number of consecutive bframes allowed, the encoder very rarely will use even a quarter of that while encoding regardless of your b-adapt setting.

Manually setting direct to spatial probably isn't even doing anything, I assume you wanted to set it to auto instead?

More reference frames can help as well but that may be better left to tune=animation when the content is appropriate so you can push subme instead.
 
Top