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.

  • Resolved

How two change encode framerate?

Hi,I use DVRRDK for development. Hardware platform is EVM8168.

My code is used for test encode performance.

read raw data from files(interlace data) --> IpcFramesOutHLOS --> IpcFramesInVideoM3 -->Enc -->IpcBitsOutVideoM3 --> IpcBitsInHLOS --->save bits to files.

however, no matter which data i set for inputframerate, the encoded data always 30fps.

I also change the frames rate send to Encode(very slow), the encoded data always 30fps.

I read encode link codec, can't find which place set the 30fps encode, all place i printf showes that the framerate is 25fps, which is equal to what i set.

Can somebody help me?

  • Which API are you using to set encoder frame rate.Also pls share all the params to the API you are using.When you say fps is 30 do you mean when you play the stream in a PC player like VLC ?

  • In reply to Badri Narayanan:

    I set encoder frame rate use "encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate".

    All params I set is like this.

    for (i=0; i<SRC_NUM_CH; i++) {
    encPrm.chCreateParams[i].format = IVIDEO_H264HP;
    encPrm.chCreateParams[i].profile = IH264_HIGH_PROFILE;
    encPrm.chCreateParams[i].dataLayout = IVIDEO_FIELD_SEPARATED;//IVIDEO_FIELD_INTERLEAVED;//progressive ignore the param
    encPrm.chCreateParams[i].fieldMergeEncodeEnable = FALSE;
    encPrm.chCreateParams[i].maxBitRate = (6 * 1000 * 1000);//-1;
    encPrm.chCreateParams[i].encodingPreset = 1; // 3; 1: high quality
    encPrm.chCreateParams[i].enableHighSpeed = 0;
    encPrm.chCreateParams[i].encodingPreset = XDM_DEFAULT;
    encPrm.chCreateParams[i].enableAnalyticinfo = 0;
    encPrm.chCreateParams[i].enableWaterMarking = 0;
    encPrm.chCreateParams[i].rateControlPreset = IVIDEO_STORAGE;
    encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate = gDemo_info.frameRate;
    encPrm.chCreateParams[i].defaultDynamicParams.targetBitRate = (4 * 1000 * 1000);
    encPrm.chCreateParams[i].defaultDynamicParams.intraFrameInterval = 20;
    encPrm.chCreateParams[i].defaultDynamicParams.interFrameInterval = 1;// 1: no B frame.
    encPrm.chCreateParams[i].defaultDynamicParams.mvAccuracy = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    encPrm.chCreateParams[i].defaultDynamicParams.rcAlg = 0 ;
    encPrm.chCreateParams[i].defaultDynamicParams.qpMin = 10;
    encPrm.chCreateParams[i].defaultDynamicParams.qpMax = 40;
    encPrm.chCreateParams[i].defaultDynamicParams.qpInit = -1;
    encPrm.chCreateParams[i].defaultDynamicParams.vbrDuration = 8;
    encPrm.chCreateParams[i].defaultDynamicParams.vbrSensitivity = 0;

    I use Elecard StreamEye Tools to see how many fps the encoded data is. I also use another tools to get fps,
    30fps shows too.

  • In reply to Mary long:

    Instead of setting as create param can you use the following APIs after Venc_start to set the encoder fps

                    Venc_setInputFrameRate(chId, xxx); --> Set the input FPS rate here (The rate at which you are feeding frames to encLink)

                    params.frameRate = xxx;--> Set the output fps you want the encoder to produce here

                    params.targetBitRate = xxx -> Set corresponding bitrate for the specified frame rate

                    Venc_setDynamicParam(chId, 0, &params, VENC_FRAMERATE);

  • In reply to Badri Narayanan:

    Hi, Narayanan

    I add these in my codec, place then after enclink start.


    memset(&params, 0, sizeof(params));
    params.frameRate = 25;
    params.targetBitRate = 5000000;

    Venc_setInputFrameRate(0, 25);
    Venc_setDynamicParam(0, 0, &params, ENC_FRAMERATE);

    however, it seems not work, the out fps still 30.

    Is DVRRDK 3.0 support change fps when encode interlace data?

  • In reply to Mary long:

    Hi, Narayanan

    I use API Venc_getDynamicParam to get encode dynamic param, the frame rate equal to the value i set. 

    however, when i use tools to get fps, it is still 30 fps.

    Can you provide some suggesions for me? Ths~

  • In reply to Mary long:

    Can you analyze the stream to check if timingInfo VUI parameters are present in the stream . If they are not present player may be assuming 30 fps by default.

  • In reply to Badri Narayanan:

    Hi, Narayanan

     the vui_parameters_present_flag equal 0. 

  • In reply to Mary long:

    Pls check if the following changes are present in your codebase:


    1.#define ENCLINK_H264_SETNALU_MASK_SPS(naluMask) ((naluMask) |= (1 << IH264_NALU_TYPE_SPS_WITH_VUI))


        staticParams->vuiCodingParams.timingInfoPresentFlag = 1;

    The SPS should have VUI.

  • In reply to Badri Narayanan:

    Hi ,Narayanan

    I can find both of them in encLink_h264.c.

  • In reply to Mary long:

    Are you checking the SPS for VUI info ? Pls check the IDR frame after you set the frame rate. Can you try setting

        staticParams->vuiCodingParams.vuiCodingPreset = IH264_VUICODING_DEFAULT;

    and see if it makes any difference

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.