Question / Help OBS overrides max bitrate.

ruxxar

New Member
Hey!

With Xsplit when I set my max bitrate to 3000, and vbv buffer to 3000 my bitrate would never override this value by much.

However in OBS i see spikes up to 4700 bitrate and such.

How do I prevent OBS from overriding the bitrate i've set?
 

ruxxar

New Member
Any way to change that? I really like the way xsplit sets a hard limit and instead degrades your quality instead of increasing bitrate in high motion scenes.

Like any x264 command line options i can put in?

I did a little search and found a command line option called "qcomp" which specifies :

qcomp: qcomp trades off the number of bits allocated to "expensive" high-motion versus "cheap" low-motion frames. At one extreme, qcomp=0 aims for true constant bitrate. Typically this would make high-motion scenes look completely awful, while low-motion scenes would probably look absolutely perfect, but would also use many times more bitrate than they would need in order to look merely excellent. At the other extreme, qcomp=1 achieves nearly constant quantization parameter (QP). Constant QP does not look bad, but most people think it is more reasonable to shave some bitrate off of the extremely expensive scenes (where the loss of quality is not as noticeable) and reallocate it to the scenes that are easier to encode at excellent quality. qcomp is set to 0.6 by default, which may be slightly low for many peoples' taste (0.7-0.8 are also commonly used).

Could I somehow use this to get what I want?
 

Muf

Forum Moderator
If you want to enforce the max bitrate more strictly, reduce the buffer size. A bigger buffer allows more variance for peaks.
 

ruxxar

New Member
What would you recommend for a 500 kb/s max variation?

Currently I'm sitting at 3000/3000 (bitrate/buffer)
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
if you see higher numbers than expected on the status bar, they are sometimes miscalculations, so as long as you're not dropping frames I wouldn't worry too much. if you are dropping frames however then it's more likely not a miscalculation
 

ruxxar

New Member
A question. When I try to enter custom x264 encoder parameters such as vbv-maxrate and vbv-bufsize they don't seem to take effect at all.

How do I make them take priority over the settings i've entered in the encoding tab?

EDIT: I actually typed it wrong. I thought I had to include the quotation mark, but you simply have to type

vbv-maxrate=x vbv-bufsize=y
 

Muf

Forum Moderator
ruxxar said:
A question. When I try to enter custom x264 encoder parameters such as vbv-maxrate and vbv-bufsize they don't seem to take effect at all.
vbv-maxrate and vbv-bufsize aren't "custom" x264 parameters at all. In the settings, "Max bitrate" is vbv-maxrate, and "Buffer size" is vbv-bufsize. I suggest you only add custom parameters if you know what you're doing, and it seems you don't (fully).
 

ruxxar

New Member
You're right I don't understand it that well, but I'm trying to find my way. You mentioned earlier that reducing the buffer would lower the spikes. Care to explain the relation between buffsize and spikes?

EDIT:

I searched and I found this IRC QnA : https://trac.handbrake.fr/wiki/VBVRateControl

They discuss how vbv-maxrate and bufsize are related to spikes.

A lot of useful information there for anyone curious about the topic.

Here's a little excerpt :

<06/06/07 12:57pm> rhester | You mentioned 5000/5000 allows a 1-second spike of 10000 mbps, and 5000/2500 allows a 1 second spike of 7500. Why is that? If the second number is the buffer size and the first is measured in kbit/sec, wouldn't doubling the declared maxrate to determine max over 1 second only hold if the bufsize matches the maxrate?
<06/06/07 12:58pm> Manao | OK, first, a vbv can be define with a bitrate/size or with a bitrate/duration
<06/06/07 12:58pm> Manao | we have duration = size/bitrate, or size = duration*bitrate
<06/06/07 12:59pm> rhester | OK, follow so far
<06/06/07 12:59pm> Manao | so 5000/5000 is a 1 second vbv buffer with a bitrate of 5000 mbps
<06/06/07 12:59pm> rhester | OK, one sec
<06/06/07 12:59pm> rhester | So 5000/5000 can spike to 10000 if you assume the vbv buffer is full at start and empties and refills in that one second, correct?
<06/06/07 12:59pm> Manao | now the maximum bitrate over a period T is when you start the period with an empty buffer, and end the period with a full period
<06/06/07 12:59pm> rhester | (well, technically it would empty twice)
<06/06/07 01:00pm> Manao | in such a case, the amount of data that pass through the buffer in that period is : buffer size + T * buffer bitrate
<06/06/07 01:00pm> Manao | or, said otherwise, (T + buffer duration) * buffer bitrate
<06/06/07 01:00pm> Manao | and, over that period of time T, the bitrate will be :
<06/06/07 01:00pm> Manao | (T + buffer duration) * buffer bitrate / T
<06/06/07 01:00pm> Manao | so, 5000/2500 <=> 5000/0.5 sec,
<06/06/07 01:02pm> Manao | mmmm
<06/06/07 01:03pm> rhester | But that means that absolute max for 5000/2500 would be 10000 instead of 7500, right? 5000/0.5 secs for 1 second = 10000
<06/06/07 01:03pm> rhester | (BTW, you're educating a lot of us...most are remaining respectfully silent, I don't mind looking stupid
<06/06/07 01:03pm> dynaflash | obviously neither did I
<06/06/07 01:03pm> Manao | yesterday, i must have made some miscalculations
<06/06/07 01:03pm> Manao | anyway, with 5000/2500, you get 1.5 * 5000 / 1 = 7500 kbps over 1 seconds
<06/06/07 01:05pm> rhester | OK, here's where my ignorance comes in...where did the 1.5 come from?
<06/06/07 01:05pm> Manao | T + buffer duration
<06/06/07 01:05pm> Manao | T = 1 second
<06/06/07 01:05pm> Manao | buffer duration = 0.5 second
<06/06/07 01:05pm> rhester | Right
<06/06/07 01:05pm> rhester | got it
<06/06/07 01:05pm> rhester | So going back to the damned-HBO-logo-on-iPod problem
<06/06/07 01:05pm> dynaflash | cause 2500 is half of 5000 ?
<06/06/07 01:06pm> rhester | dyna: Yes, that's the equation that shows the relationship of rate to bufsize that we were discussing on
<06/06/07 01:06pm> Manao | 2500 with a bitrate of 5000 means the vbv has a duration of half a second
<06/06/07 01:06pm> dynaflash | oh, that fills in a gap for me, thanks.

Explanation for anyone interested :

To set the max spike:

1: Select the max bitrate as the target average bitrate you want to stream at. Example: Set Max Bitrate to 3000.
2: Determine the biggest spike you want to allow. Say you want a max spike of 1000 (so you can spike up to 4000)
3: Set your Buffer Size to the number in 2.

Forumla : (1 sec + (bufsize/maxrate)) * maxrate/1 = max spike over 1 second.
 

Muf

Forum Moderator
:o say hi to Manao for me :D
What IRC channel is that? It's not #264, that place is more deserted than death valley.
 

tiba

Member
I had the same prob here.

I put in my OBS maxbitrate 2400 and buffer 2400 and always spliting to 3000 or 3200 ( i had 3mb upload )

Now i put 2400 bitrate and 500 buffer and works fine... i really dont know why.
 
Top