Rate Control None vs CBR Encoding

All,

I am seeing some weird results using omxh264enc. From a previous post i learned the following for the rate control (control-rate) options of the nvidia encoder:

Disabled: constant QP
Variable: VBR
Constant: CBR
Variable and Variable-skip-frame: actually it is same, for bSkipframe is not handled in codec driver.
Constant and constant-skip-frame: actually it is same, for bSkipframe is not handled in codec driver.

Pardon my ignorance and let me know if i am simply mistaken, but if “Disabled” is selected that basically means a constant quality based on the cooefficent defined in qp-range or enctune.conf. Hence the bitrate should vary greatly depending on the amount of motion on the screen since quality is the defining value. So in theory the “bitrate” option shouldn’t even be relevant since the output data rate is defined by quality.

Yet when I set the rate control to “Disabled” i am getting almost a perfectly restricted output data rate defined by the “bitrate” parameter.

I’ve always had issues with CBR not restricting the data to set bitrate option and it is looking like “Disabled” produces a way better restriction to bitrate.

Any ideas what is going on? Is there any better documentation on the rate control options?

Hi x1tester62,
Do you test in the following case?
https://devtalk.nvidia.com/default/topic/973295/constant-bitrate-help/

500kbps is very harsh to 1080p30. We have CBR/VBR algorithm considering both quality and bitrate and it may not run well in corner cases.

Yes DaneLLL that is the case I am still testing in.

Just confused because I assumed CBR would always enforce a bitrate no matter what. But with rate control disabled, that is actually meeting the 500kbps bitrate without any issue and is keeping it there regardless of the amount of motion on screen.

Hence why I’m curious if there is any additional documentation or information since i would assume the opposite. For example why is it when rate control is disabled, it still takes bitrate into account?

Hi x1tester62,
We tried

gst-launch-1.0 nvcamerasrc num-buffers=150 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12' ! omxh264enc control-rate=0 bitrate=500000 ! 'video/x-h264,stream-format=byte-stream' ! filesink location=a.h264

And get a steam ~23Mbps. Checking it via JM decoder and all frames are with QP=24

danel@ce-tw-daneliu:~/temp/jm19.0$ ./JM/bin/ldecod.exe -i a.h264
Setting Default Parameters...
Parsing Configfile decoder.cfg

******************************************************
*               Decoder Parameters                   *
******************************************************
Parameter InputFile = a.h264
Parameter OutputFile = test_dec.yuv
Parameter RefFile = test_rec.yuv
Parameter WriteUV = 1
Parameter FileFormat = 0
Parameter RefOffset = 0
Parameter POCScale = 2
Parameter DisplayDecParams = 1
Parameter ConcealMode = 0
Parameter RefPOCGap = 2
Parameter POCGap = 2
Parameter Silent = 0
Parameter IntraProfileDeblocking = 1
Parameter DecFrmNum = 0
Parameter DecodeAllLayers = 0
Parameter DPBPLUS0 = 1
Parameter DPBPLUS1 = 0
******************************************************
----------------------------- JM 19.0 (FRExt) -----------------------------
 Input reference file                   : test_rec.yuv does not exist
                                          SNR values are not available
POC must = frame# or field# for SNRs to be correct
--------------------------------------------------------------------------
  Frame          POC  Pic#   QP    SnrY     SnrU     SnrV   Y:U:V Time(ms)
--------------------------------------------------------------------------
00000(IDR)        0     0    24                             4:2:0      49
00001( P )        2     1    24                             4:2:0      34
00002( P )        4     2    24                             4:2:0      27
00003( P )        6     3    24                             4:2:0      25
00004( P )        8     4    24                             4:2:0      27
00005( P )       10     5    24                             4:2:0      54
00006( P )       12     6    24                             4:2:0      58
00007( P )       14     7    24                             4:2:0      63
00008( P )       16     8    24                             4:2:0      67
00009( P )       18     9    24                             4:2:0      68
00010( P )       20    10    24                             4:2:0      70
00011( P )       22    11    24                             4:2:0      68
00012( P )       24    12    24                             4:2:0      67
00013( P )       26    13    24                             4:2:0      65
00014( P )       28    14    24                             4:2:0      80
00015( P )       30    15    24                             4:2:0      71
00016( P )       32    16    24                             4:2:0      70
00017( P )       34    17    24                             4:2:0      70
00018( P )       36    18    24                             4:2:0      74
00019( P )       38    19    24                             4:2:0      70
00020( P )       40    20    24                             4:2:0      69
00021( P )       42    21    24                             4:2:0      69
00022( P )       44    22    24                             4:2:0      69
00023( P )       46    23    24                             4:2:0      68
00024( P )       48    24    24                             4:2:0      68
00025( P )       50    25    24                             4:2:0      68
00026( P )       52    26    24                             4:2:0      68
00027( P )       54    27    24                             4:2:0      68
00028( P )       56    28    24                             4:2:0      68
00029( P )       58    29    24                             4:2:0      74
00000(IDR)        0     0    24                             4:2:0     256
00001( P )        2     1    24                             4:2:0      57
00002( P )        4     2    24                             4:2:0      55
00003( P )        6     3    24                             4:2:0      55
00004( P )        8     4    24                             4:2:0      55
00005( P )       10     5    24                             4:2:0      54
00006( P )       12     6    24                             4:2:0      54
00007( P )       14     7    24                             4:2:0      54
00008( P )       16     8    24                             4:2:0      54
00009( P )       18     9    24                             4:2:0      54
00010( P )       20    10    24                             4:2:0      54
00011( P )       22    11    24                             4:2:0      54
00012( P )       24    12    24                             4:2:0      55
00013( P )       26    13    24                             4:2:0      54
00014( P )       28    14    24                             4:2:0      68
00015( P )       30    15    24                             4:2:0      68
00016( P )       32    16    24                             4:2:0      68
00017( P )       34    17    24                             4:2:0      68
00018( P )       36    18    24                             4:2:0      68
00019( P )       38    19    24                             4:2:0      68
00020( P )       40    20    24                             4:2:0      68
00021( P )       42    21    24                             4:2:0      68
00022( P )       44    22    24                             4:2:0      68
00023( P )       46    23    24                             4:2:0      68
00024( P )       48    24    24                             4:2:0      68
00025( P )       50    25    24                             4:2:0      68
00026( P )       52    26    24                             4:2:0      68
00027( P )       54    27    24                             4:2:0      68
00028( P )       56    28    24                             4:2:0      68
00029( P )       58    29    24                             4:2:0      70
00000(IDR)        0     0    24                             4:2:0     256
00001( P )        2     1    24                             4:2:0      57
00002( P )        4     2    24                             4:2:0      55
00003( P )        6     3    24                             4:2:0      54
00004( P )        8     4    24                             4:2:0      54
00005( P )       10     5    24                             4:2:0      54
00006( P )       12     6    24                             4:2:0      54
00007( P )       14     7    24                             4:2:0      54
00008( P )       16     8    24                             4:2:0      54
00009( P )       18     9    24                             4:2:0      54
00010( P )       20    10    24                             4:2:0      54
00011( P )       22    11    24                             4:2:0      54
00012( P )       24    12    24                             4:2:0      54
00013( P )       26    13    24                             4:2:0      54
00014( P )       28    14    24                             4:2:0      68
00015( P )       30    15    24                             4:2:0      68
00016( P )       32    16    24                             4:2:0      68
00017( P )       34    17    24                             4:2:0      68
00018( P )       36    18    24                             4:2:0      68
00019( P )       38    19    24                             4:2:0      68
00020( P )       40    20    24                             4:2:0      68
00021( P )       42    21    24                             4:2:0      68
00022( P )       44    22    24                             4:2:0      68
00023( P )       46    23    24                             4:2:0      68
00024( P )       48    24    24                             4:2:0      68
00025( P )       50    25    24                             4:2:0      68
00026( P )       52    26    24                             4:2:0      68
00027( P )       54    27    24                             4:2:0      68
00028( P )       56    28    24                             4:2:0      68
00029( P )       58    29    24                             4:2:0      70
00000(IDR)        0     0    24                             4:2:0     257
00001( P )        2     1    24                             4:2:0      57
00002( P )        4     2    24                             4:2:0      55
00003( P )        6     3    24                             4:2:0      55
00004( P )        8     4    24                             4:2:0      54
00005( P )       10     5    24                             4:2:0      54
00006( P )       12     6    24                             4:2:0      54
00007( P )       14     7    24                             4:2:0      54
00008( P )       16     8    24                             4:2:0      54
00009( P )       18     9    24                             4:2:0      54
00010( P )       20    10    24                             4:2:0      54
00011( P )       22    11    24                             4:2:0      54
00012( P )       24    12    24                             4:2:0      54
00013( P )       26    13    24                             4:2:0      54
00014( P )       28    14    24                             4:2:0      68
00015( P )       30    15    24                             4:2:0      68
00016( P )       32    16    24                             4:2:0      68
00017( P )       34    17    24                             4:2:0      68
00018( P )       36    18    24                             4:2:0      68
00019( P )       38    19    24                             4:2:0      68
00020( P )       40    20    24                             4:2:0      68
00021( P )       42    21    24                             4:2:0      68
00022( P )       44    22    24                             4:2:0      68
00023( P )       46    23    24                             4:2:0      68
00024( P )       48    24    24                             4:2:0      68
00025( P )       50    25    24                             4:2:0      68
00026( P )       52    26    24                             4:2:0      68
00027( P )       54    27    24                             4:2:0      68
00028( P )       56    28    24                             4:2:0      68
00029( P )       58    29    24                             4:2:0      70
00000(IDR)        0     0    24                             4:2:0     257
00001( P )        2     1    24                             4:2:0      57
00002( P )        4     2    24                             4:2:0      55
00003( P )        6     3    24                             4:2:0      55
00004( P )        8     4    24                             4:2:0      54
00005( P )       10     5    24                             4:2:0      54
00006( P )       12     6    24                             4:2:0      54
00007( P )       14     7    24                             4:2:0      54
00008( P )       16     8    24                             4:2:0      54
00009( P )       18     9    24                             4:2:0      54
00010( P )       20    10    24                             4:2:0      54
00011( P )       22    11    24                             4:2:0      54
00012( P )       24    12    24                             4:2:0      54
00013( P )       26    13    24                             4:2:0      54
00014( P )       28    14    24                             4:2:0      68
00015( P )       30    15    24                             4:2:0      68
00016( P )       32    16    24                             4:2:0      68
00017( P )       34    17    24                             4:2:0      68
00018( P )       36    18    24                             4:2:0      68
00019( P )       38    19    24                             4:2:0      68
00020( P )       40    20    24                             4:2:0      68
00021( P )       42    21    24                             4:2:0      68
00022( P )       44    22    24                             4:2:0      68
00023( P )       46    23    24                             4:2:0      69
00024( P )       48    24    24                             4:2:0      68
00025( P )       50    25    24                             4:2:0      68
00026( P )       52    26    24                             4:2:0      68
00027( P )       54    27    24                             4:2:0      68
00028( P )       56    28    24                             4:2:0      68
00029( P )       58    29    24                             4:2:0      68
-------------------- Average SNR all frames ------------------------------
 SNR Y(dB)           :  0.00
 SNR U(dB)           :  0.00
 SNR V(dB)           :  0.00
 Total decoding time : 10.168 sec (14.752 fps)[150 frm/10168 ms]
--------------------------------------------------------------------------
 Exit JM 19 (FRExt) decoder, ver 19.0
 Output status file                     : log.dec
150 frames are decoded.

Not sure how you get good result in control-rate disabled, but I think 500kbps to 1080p30 is not a general case that we can offer acceptable CBR/VBR algorithms to consider both quality and bitrate. Please consider/compaer with other software encoders which probably performa better in this case.