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.

C6a816x H.264 Encode Demo CBR mode

 

I noticed that when I run the C6a816x H.264 Encode Demo on the EVM that the resulting encoded output is VBR. 

Is there anyway to change the the encoding to CBR?

Thanks,

-Greg

  • Greg,

    The following should help you to change to CBR -

        OMX_VIDEO_PARAM_ENCODER_PRESETTYPE tEncoderPreset;
        OMX_TEST_INIT_STRUCT_PTR(&tEncoderPreset,
                                 OMX_VIDEO_PARAM_ENCODER_PRESETTYPE);
        tEncoderPreset.nPortIndex = OMX_VIDENC_OUTPUT_PORT;
        eError =
            OMX_GetParameter(pHandle, OMX_TI_IndexParamVideoEncoderPreset,
                             &tEncoderPreset);
        tEncoderPreset.eRateControlPreset  = OMX_Video_RC_Low_Delay; /* CBR */
       // tEncoderPreset.eRateControlPreset  = OMX_Video_RC_Storage; /* VBR */
        eError =
            OMX_SetParameter(pHandle, OMX_TI_IndexParamVideoEncoderPreset,
                             &tEncoderPreset);

    Regards,

    Anirban

  • Hi Anirban,

    Thanks for the reply.  I will try this.  This, I assume, involves recompiling the source?  Is there anyway to change this preset value by using the OMS scripts?

    Thanks,

    -Greg

  • Anirban,

    Can you point to a specific file that contains that data? I did a quick search and the only one i could find that is close to what you listed there is for the omap4430.

    I am using the following ezdsk and am looking in the OMTB demo folder:

    ti-ezdsk_dm816x-evm_5_01_01_80

    Thanks for your help,

    Mark

  • Anirban,

    I've made some headway but I'm hoping for some clarification. I found in the OMTBH264Venc.c file where the tEncoderPreset.eRateControlPreset is set to "OMX_Video_RC_User_Defined" for the DM8168 OTMB demo. I then went in tried changing it to both OMX_Video_RC_Storage and OMX_Video_RC_Low_Delay then created videos.

    However, both videos appear to be about the same. And when using streamEye software from elecard. It says for both videos that they are using VBR.

    Any ideas or insight? I'd really like to confirm that I am switching to CBR.

    Thanks for your help!

    ~Mark

  • Anirban,

     

    Any further thoughts on this? Both myself and my customer have confirmed that the change I made does not produce CBR video encoding. We are eager to evaluate the system and its capabilities but this is currently a stopgap.

     

    Thanks,

     

    Mark

  • Mark,

    Please use the following commands for configuration of CBR/VBR in  OMTB script file.

    omx api getparam  h264venc 0 0 1 OMX_TI_IndexParamVideoEncoderPreset

    #eRateControlPreset is set to "disable => CBR" or  "hq(high quality) => VBR"

    #omx setp 0 h264venc OMX_TI_IndexParamVideoEncoderPreset eRateControlPreset hq

    omx setp 0 h264venc OMX_TI_IndexParamVideoEncoderPreset eRateControlPreset disable

    omx api setparam  h264venc 0 0 1 OMX_TI_IndexParamVideoEncoderPreset

     

    Attached oms script, contains the configurations mentioned above.

     

    #omx omtb_dbg_lvl 0x10
    #omx omtb_dbg_lvl 0x08
    omx api init
    omx setp 0 h264venc numinbuf 6
    omx setp 0 h264venc inbufsize 3110400
    omx setp 0 h264venc frame_width 1920
    omx setp 0 h264venc frame_height 1080
    omx setp 0 h264venc numoutbuf 6
    omx setp 0 h264venc inbufsize_flag enable
    omx setp 0 h264venc outbufsize_flag enable
    omx setp 0 h264venc outbufsize 3110400 
    omx setp 0 h264venc inbuf allocate
    omx setp 0 h264venc outbuf allocate
    omx setp 0 h264venc data_opmode file
    omx setp 0 h264venc data_ipmode file
    omx setp 0 h264venc filereset_flag enable
    omx setp 0 h264venc infile  station2_1920x1080_420sp.yuv
    omx setp 0 h264venc outfile dm816x_test_encode.264
    #Q-16 format 2^16 * framerate
    omx setp 0 h264venc framerate 3932160
    omx api gethandle h264venc 0 0
    omx api getparam  h264venc 0 0 0 OMX_IndexParamPortDefinition
    omx setp 0 h264venc OMX_IndexParamPortDefinition video.nStride 1920
    omx api setparam  h264venc 0 0 0 OMX_IndexParamPortDefinition
    omx api getparam  h264venc 0 0 1 OMX_IndexParamVideoBitrate
    omx setp 0 h264venc OMX_IndexParamVideoBitrate nTargetBitrate 2048000
    omx setp 0 h264venc OMX_IndexParamVideoBitrate eControlRate variable
    omx api setparam  h264venc 0 0 1 OMX_IndexParamVideoBitrate
    omx api getparam  h264venc 0 0 1 OMX_TI_IndexParamVideoEncoderPreset
    #eRateControlPreset is set to "disable => CBR" or  "hq(high quality) => VBR"
    #omx setp 0 h264venc OMX_TI_IndexParamVideoEncoderPreset eRateControlPreset hq
    omx setp 0 h264venc OMX_TI_IndexParamVideoEncoderPreset eRateControlPreset disable
    omx api setparam  h264venc 0 0 1 OMX_TI_IndexParamVideoEncoderPreset
    omx api sendcommand port h264venc 0 enable 0
    omx api sendcommand port h264venc 0 waitforsem 0
    omx api sendcommand port h264venc 0 enable 1
    omx api sendcommand port h264venc 0 waitforsem 1
    omx api sendcommand state h264venc 0 idle
    omx api sendcommand state h264venc 0 waitforsem
    sleep 500
    omx api sendcommand state h264venc 0 exec
    omx api sendcommand state h264venc 0 waitforsem
    sleep 120000
    omx api sendcommand state h264venc 0 idle
    omx api sendcommand state h264venc 0 waitforsem
    omx api sendcommand state h264venc 0 loaded
    omx api sendcommand state h264venc 0 waitforsem
    omx api freehandle h264venc 0
    omx api uninit