This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VBR parameter

i set the rcAlgo as VBR,then i see that if the image in the video is moving ,the video quality will not be clear.

but when the image is static ,so the video quality will be better.

i see the following parameters

vbrDuration and vbrSensitivity,so whether i can set the two parameters to control the video quality?

tks

  • Hi Billy,

    The parameters vbrDuration and vbrSensitivity are used in case of High Fidelity Variable Bitrate Rate control scheme or HF-VBR.

    HF-VBR allows the bitrate to change based on the complexity of the scene.

    The value of maxBitRate must be at least 1.5 times targetBitRate. Only then High Fidelity Variable Bitrate control is turned ON in the encoder.

    The parameters including maxBitrate, vbrDuration and vbrSensitivity and how to configure them are explained in the user guide. Kindly go through the same.

    Can you please set it accordingly and let us know if this has resolved the issue?

  • hi Mohd,thanks for your help.but i see that in the below

    http://e2e.ti.com/support/embedded/multimedia_software_codecs/f/356/p/186173/669967.aspx#669967

  • Billy,

     It is true that in VBR, bit rate can shoot up for short period but the target bit rate will be met.

     But can you please tell me how is the use case discussed in the link related to your current use case ?

  • yes,in the VBR ,bit rate can shoot up for short period ,but in the CBR,it can also shoot up ,so why?

    now my usecase is that cap->enc->               network                 ->dec->dis

  • Billy,

    In order to comment further on your issue, can you please share the encoder configuration settings, both static and dynamic parameters, you are using?

     Also share the encoded h264 bitstream showing the issue.

  • Void Venc_params_init(VENC_PARAMS_S * pContext)

    {

    pChPrm->enableAnalyticinfo = 0;
    pChPrm->enableWaterMarking = 0;
    pChPrm->enableSVCExtensionFlag = VENC_IH264_SVC_EXTENSION_FLAG_DISABLE;
    pChPrm->encodingPreset = VENC_XDM_USER_DEFINED;
    pChPrm->maxBitRate = -1;

    pChPrm->rcType = VENC_RATE_CTRL_CBR;

    pChPrm->numTemporalLayer = VENC_TEMPORAL_LAYERS_1;

    pDynPrm->frameRate = 60; // Now USED

    pDynPrm->targetBitRate = 2000 * 1000;
    pDynPrm->intraFrameInterval = 30;
    pDynPrm->inputFrameRate = pDynPrm->frameRate;
    pDynPrm->rcAlg = pChPrm->rcType; // MUST be same as pChPrm->rcType
    pDynPrm->qpMin = 10;
    pDynPrm->qpMax = 40;
    pDynPrm->qpInit = -1; // SHOULD BE SET to -1 ALWAYS
    pDynPrm->vbrDuration = 8;
    pDynPrm->vbrSensitivity = 0;

    }

    the create link parameters

    {
    pLinkChPrm = &encPrm.chCreateParams[i];
    pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;

    pChPrm = &gVencModuleContext.vencConfig.encChannelParams[i];
    pDynPrm = &pChPrm->dynamicParam;

    pLinkChPrm->format = IVIDEO_H264HP;
    pLinkChPrm->profile = VENC_CHN_HIGH_PROFILE;//gVencModuleContext.vencConfig.h264Profile[i];
    pLinkChPrm->dataLayout = IVIDEO_FIELD_SEPARATED;
    pLinkChPrm->fieldMergeEncodeEnable = FALSE;
    pLinkChPrm->enableAnalyticinfo = pChPrm->enableAnalyticinfo;
    pLinkChPrm->enableWaterMarking = pChPrm->enableWaterMarking;
    pLinkChPrm->maxBitRate = pChPrm->maxBitRate;
    pLinkChPrm->encodingPreset = pChPrm->encodingPreset;
    pLinkChPrm->rateControlPreset = IVIDEO_LOW_DELAY;//IVIDEO_STORAGE;//IVIDEO_NONE;// pChPrm->rcType;
    pLinkChPrm->enableSVCExtensionFlag = pChPrm->enableSVCExtensionFlag;
    pLinkChPrm->numTemporalLayer = pChPrm->numTemporalLayer;

    pLinkDynPrm->targetFrameRate = pDynPrm->frameRate; // added by dlj
    pLinkDynPrm->intraFrameInterval = pDynPrm->intraFrameInterval;
    pLinkDynPrm->targetBitRate = pDynPrm->targetBitRate;
    pLinkDynPrm->interFrameInterval = 1;
    /*if (vencPrm->rcAlg == 0) // VBR, modified by dlj
    {
    pLinkDynPrm->interFrameInterval = vencPrm->interFrameInterval;
    }
    //*/
    pLinkDynPrm->intraFrameInterval = 1;//pDynPrm->intraFrameInterval;
    pLinkDynPrm->mvAccuracy = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    pLinkDynPrm->inputFrameRate = pDynPrm->inputFrameRate;
    pLinkDynPrm->rcAlg = pDynPrm->rcAlg;
    pLinkDynPrm->qpMin = pDynPrm->qpMin;
    pLinkDynPrm->qpMax = pDynPrm->qpMax;
    pLinkDynPrm->qpInit = pDynPrm->qpInit;
    pLinkDynPrm->vbrDuration = pDynPrm->vbrDuration;
    pLinkDynPrm->vbrSensitivity = pDynPrm->vbrSensitivity;
    }

  • Billy, 

    Thanks for sharing the parameters.

    I'm a bit confused at this point. The query was about the VBR parameter settings. But in the configuration you have shared, the rateControlPreset has been set to IVIDEO_LOW_DELAY which will turn on the CBR rate control scheme.

    For setting VBR, rateControlPreset should have been IVIDEO_STORAGE.

  • i  init the rcAlgo is CBR and  set the rcAlgo to VBR dynamiclly.

    EncLink_ChRcAlgParams params;
    params.chId = encChnId;
    params.rcAlg = rcAlg;
    System_linkControl(gVencModuleContext.encId, ENC_LINK_CMD_SET_CODEC_RCALGO,
    &params, sizeof(params), TRUE);

    but i found that even i use the CBR,the bitrate is still sometime to up the targetbitrate,so i am sonfused

  • Billy,

    You can set the rate control to CBR/VBR using parameter rcAlgo, but the codec considers this parameter rcAlgo only when the rateControlPreset is set as  IVIDEO_USER_DEFINED.


    For any other value for rateControlPresetrcAlgo value is ignored.


    Another way to set CBR/VBR is to keep the rateControlPreset as IVIDEO_LOW_DELAY (For CBR) or IVIDEO_STORAGE (For VBR).

  • you mean that i should set the rateControlPreset  to IVIDEO_STORAGE?

  • If you intend to use VBR for your application you can set the same in either of the two ways.

    1. rateControlPreset  = IVIDEO_STORAGE

    OR

    2. rateControlPreset = IVIDEO_USER_DEFINED                                                                                                                               rcAlgo                      = IH264_RATECONTROL_PRC (= 0)

  • i want to set the rcAlgo dynamiclly to CBR or VBR,so how can i do it?

    i see in the demo rcAlgo about  VBR is  0,above you say rcAlgo =  IH264_RATECONTROL_PRC (= 0)

    so how to discriminate the IH264_RATECONTROL_PRC  and  VBR?

    or you mean that if i set rateControlPreset = IVIDEO_USER_DEFINED    ,then i set the rcAlgo = 0(VBR) dynamiclly ,that is just the rcAlgo = IH264_RATECONTROL_PRC 

  • Billy,

    In that case you can set  rateControlPreset = IVIDEO_USER_DEFINED and rcAlgo = 0, the encoder will choose VBR rate control scheme and if you set rcAlgo = 1, the encoder will choose CBR rate control scheme.

    Regarding the IH264_RATECONTROL_PRC (= 0), it is just an enumeration value that give an indication to the encoder to pick  VBR Rate Control algorithm.