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.

How to configure the OMTB that support the encoder encode B frame



hello, I have a question. Can DM8168 encode B frame of H.264?the demos of OMTB in the sdk support encoding P and I frame,but has no B frame ,and I want to know how to configure the OMTB and OMX that can support B frame?
 
the script of 'omx getp 0 h264venc' get the useful data, but I don't kwon how to configure it ,could anybody help me?


OMTB> omx getp 0 h264venc
Template 0:
H264 Video Encoder Config Parameters:
   OMX Component name............................OMX.TI.DUCATI.VIDENC
   Input File name.............................../usr/share/ti/data/videos/CrowdRun_1080i25_420sp.yuv
   Output File name............................../usr/share/ti/data/videos/CrowdRun_1080i25_420sp.264
   Input Frame Width.............................1920
   Input Frame Height............................1080
   I/P Chroma Format.............................420SP
   Data O/P Mode.................................file
   Data I/P Mode.................................file
   I/P Buffer allocation Mode....................allocate
   Number of i/p buffer..........................6
   I/p buffer alignment..........................0
   Contiguous i/p buffer memory..................enable
   I/P buffer size input from user...............enable
   I/p buffer size...............................3110400
   O/P Buffer allocation Mode....................allocate
   Number of o/p buffer..........................6
   O/p buffer alignment..........................0
   Contiguous o/p buffer memory..................enable
   O/P buffer size input from user...............enable
   O/p buffer size...............................3110400
   O/P Compression Format........................avc
   I/P Stride (# of bytes per span of image).....0
   Bitrate.......................................10485760
   Frame rate....................................3932160
   Max file size for OMTB demo...................536870912
   File Reset Flag...............................enable
   OMX_IndexConfigVideoFramerate Index Parameters:
      Frame rate....................................3932160
   OMX_IndexConfigVideoBitrate Index Parameters:
      Bitrate.......................................10485760
   OMX_TI_IndexConfigVideoMESearchRange Index Parameters:
      Motion vector accuracy........................quarterpel
      ME Horizontal Search Range for P Frames.......16
      ME Vertical Search Range for P Frames.........16
      ME Horizontal Search Range for B Frames.......16
      ME Vertical Search Range for B Frames.........16
   OMX_IndexConfigVideoIntraVOPRefresh Index Parameters:
      Intra Refresh VOP.............................disable
   OMX_TI_IndexConfigVideoQPSettings Index Parameters:
      QP for I frames...............................25
      QP Max for I frames...........................51
      QP Min for I frames...........................0
      QP for P frames...............................25
      QP Max for P frames...........................51
      QP Min for P frames...........................0
      QP offset for B frames........................4
      QP Max for B frames...........................51
      QP Min for B frames...........................0
   OMX_IndexConfigVideoAVCIntraPeriod Index Parameters:
      IDR period....................................128
      P frames period...............................0
   OMX_TI_IndexConfigSliceSettings Index Parameters:
      Slice Mode Type...............................default
      Slice Size....................................0
   OMX_TI_IndexConfigVideoPixelInfo Index Parameters:
      Input Pixel Width.............................0
      Input Pixel Height............................0
   OMX_TI_IndexParamVideoNALUsettings Index Parameters:
      NALU Start of Sequence........................0
      NALU End of Sequence..........................0
      NALU IDR Frame #..............................0
      NALU Intra Picture #..........................0
      NALU Non Intra Picture #......................0
   OMX_TI_IndexParamVideoAdvancedFMO Index Parameters:
      FMO Num Slice Groups..........................0
      FMO Slice Groups Map Type.....................0
      FMO Slice Groups Change Direction.............raster
      FMO Slice Groups Change Rate..................0
      FMO Slice Groups Change Cycle.................0
      FMO Slice Groups Param 0......................0
      FMO Slice Groups Param 1......................0
   OMX_TI_IndexParamVideoMEBlockSize Index Parameters:
      ME Min Block Size - P Frame...................16x16
      ME Min Block Size - B Frame...................16x16
   OMX_IndexParamVideoIntraRefresh Index Parameters:
      Intra Refresh Mode............................cyclic
      # of Intra MBs to be Refreshed................0
      # of times Motion marked MB be Intra Coded....0
      # of Consecutive MBs to be Intra Coded........0
   OMX_TI_IndexParamVideoVUIsettings Index Parameters:
      VUI Aspect Ratio Present Flag.................disable
      VUI Pixel Aspect Ratio........................none
      VUI Pixel Value Full Range Flag...............disable
   OMX_TI_IndexParamVideoIntraPredictionSettings Index Parameters:
      Luma Intra 4x4 Pred Modes Enabled.............0
      Luma Intra 8x8 Pred Modes Enabled.............0
      Luma Intra 16x16 Pred Modes Enabled...........0
      Chroma Intra 8x8 Pred Modes Enabled...........0
      Chroma Intra Component........................cr_only
   OMX_TI_IndexParamVideoDataSyncMode Index Parameters:
      Video Data Mode...............................fixed_length
      Video Num Data Units..........................0
   OMX_IndexConfigVideoNalSize Index Parameters:
      NAL bytes .....................................0
   OMX_IndexParamVideoAvc Index Parameters:
      Num MBs Between Slice Header..................0
      Max # of P Frames between each I Frames.......1
      Max # of B Frames between each I Frames.......1
      Hadamard Transform............................disable
      # of Refrence Frames..........................0
      Refrence Index in Bwd Frames list.............0
      Refrence Index in Fwd Frames list.............0
      Unequal Error Protection......................disable
      Flexible Macroblock Ordering..................disable
      Arbitrary Slice Ordering......................disable
      Redundant Slices..............................disable
      AVC Profile...................................high
      AVC Level.....................................4.1
      Picture Types Allowed In Bitstream............0
      Frame MBs Only................................disable
      Frame Field MB Switching......................disable
      CABAC.........................................disable
      Weighted Prediction for P frames..............disable
      Weighted Biprediciton Mode....................0
      Constrained Intra Prediction..................disable
      Luma Motion Vector Method for B Frames........disable
      Spatial/Temporal mode for B Frame Coding......disable
      CABAC Context Init Index......................0
      Loop Filter Mode..............................enable
   OMX_IndexParamVideoBitrate Index Parameters:
      Param Bitrate.................................30000000
      Param Rate Control Algorithm..................variable
   OMX_IndexParamVideoProfileLevelCurrent Index Parameters:
      Profile.......................................high
      Level.........................................4.1
   OMX_TI_IndexParamVideoBitStreamFormatSelect Index Parameters:
      Bitstream Format..............................byte
   OMX_TI_IndexParamVideoEncoderPreset Index Parameters:
      Encoder Preset................................userdef
      Rate Control Preset...........................msmq
   OMX_TI_IndexParamVideoFrameDataContentSettings Index Parameters:
      Input Content Type............................progressive
      Interlace Coding Type.........................picaff
   OMX_TI_IndexParamVideoTransformBlockSize Index Parameters:
      Transform Block Size..........................8x8
   OMX_IndexParamVideoSliceFMO Index Parameters:
      Num Slice Group...............................0
      Slice Group map type..........................0
      Slice Mode Type...............................default
   OMX_IndexParamVideoMotionVector Index Parameters:
      Unrestricted Motion Vector....................disable
      Four Motion Vectors...........................disable
      Motion Vector X Search Range .................16
      Motion Vector Y Search Range .................16
   OMX_TI_IndexParamBuffMemType Index Parameters:
      Buffer Memory Type............................default
   OMX_IndexParamCompBufferSupplier Index Parameters:
      Buffer Supplier Type..........................unspecified
   OMX_IndexParamVideoInit Index Parameters:
      Number of i/p + o/p Ports ....................2
      Start Port Number ............................0
   OMX_IndexParamVideoPortFormat Index Parameters:
      Compression Format............................avc
      Color Format..................................420SP
      Frame rate....................................3932160
   OMX_IndexParamVideoQuantization Index Parameters:
      QP for I frames...............................25
      QP for P frames...............................25
      QP for B frames...............................4
   OMX_TI_IndexParamCompPortNotifyType Index Parameters:
      Comp Port Notify Type.........................always
   OMX_IndexParamPortDefinition Index Parameters:
      Port Direction................................input
      Buffer Count Actual...........................6
      Buffer Count Min..............................1
      Buffer Size...................................3110400
      Port Default Status...........................enable
      Port Populated................................disable
      Domain........................................video
      Buffers Contiguous............................disable
      Buffer Alignment..............................128
      MIME Type.....................................¤
      Native Render.................................0
      Frame Width...................................1920
      Frame Height..................................1080
      Stride........................................1920
      Slice Height..................................0
      Bit Rate......................................10000000
      Frame Rate....................................60000
      Flag Error Concealment........................disable
      Compression Format............................unused
      Color Format..................................420SP
      Native Window.................................0
   OMX_TI_IndexConfigChannelName Index Parameters:
      Frame Queue Channel name......................NULL
OK

  • I follow the step on the http://processors.wiki.ti.com/index.php/OMX_VENC ,but  I am faild :

    #######################################

    1. I do not see Encoder generating B frames, how to configure to generate B frames?

    Ans: For generating B frames following parameters should be set as per above explained indices-

    /* Set encoder preset as storage */
    tEncoderPreset.eRateControlPreset = OMX_Video_RC_Storage
    /* set profile as Main or High */
    tProfileLevel.eProfile = OMX_VIDEO_AVCProfileMain;
    
    /* Set number of B frame as non zero */
    tAVCParams.nBFrames = 1;
    ########################################
     
    I find all the datasheets ,but I didn't find the corret way,
    could anybody help me?
  • I am sorry ,I use the ezsdk_5_03_01_15 ,and the version of OMX is omx_05_02_00_30.

  • Shang,

    Can you provde us sequence of all the parameters setting for encoder compnent. Did you see profile as Main after modification?

    Regards

    Vimal

  • Vimal,

         I'am sorry,I use the example of capture_encode under the omx_05_02_00_30(component-sources/omx_05_02_00_30/examples/ti/omx/demos/capture_encode), I follow the step on the http://processors.wiki.ti.com/index.php/OMX_VENC ,and I added some data and modified the funtion of

    IL_ClientSetEncodeParams (IL_Client *pAppData) in the ilclient_utils.c like this:

    #######################################
    OMX_VIDEO_PARAM_AVCTYPE tAVCParams;

      OMX_INIT_PARAM (&tAVCParams);
     
      tAVCParams.nPortIndex = OMX_DirOutput;
    eError = OMX_GetParameter(pHandle, OMX_IndexParamVideoAvc, &tAVCParams);

    tAVCParams.eLevel = OMX_VIDEO_AVCLevel42;
    tAVCParams.eProfile = OMX_VIDEO_AVCProfileBaseline;
    tAVCParams.nPFrames = 89;
    tAVCParams.nBFrames = 1;

      eError = OMX_SetParameter(pHandle, OMX_IndexParamVideoAvc, &tAVCParams);
    1. I do not see Encoder generating B frames, how to configure to generate B frames?

    Ans: For generating B frames following parameters should be set as per above explained indices-

    /* Set encoder preset as storage */
    tEncoderPreset.eRateControlPreset = OMX_Video_RC_Storage
    /* set profile as Main or High */
    tProfileLevel.eProfile = OMX_VIDEO_AVCProfileMain;

    /* Set number of B frame as non zero */
    tAVCParams.nBFrames = 1;
    ########################################

    but I still can not get the B frame

     Regards
     shang

  • hi:
    on other way ,I use ezsdk of ti-ezsdk_dm816x-evm_5_03_01_15,and I try to encode h264 file on the dm8168 by using the command:
    ./omtb_dm81xxbm_a8host.xv5T  fread_venc_fwrite.oms
    and I still can't get the B frame

    fread_venc_fwrite.oms:
    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 infile  /usr/share/ti/data/videos/dm816x_test_1920x1080_420sp.yuv
    omx setp 0 h264venc outfile /usr/share/ti/data/videos/dm816x_test_1920x1080_420sp.264
    omx api gethandle h264venc 0 0
    omx api getcompname
    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 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 50
    omx api sendcommand state h264venc 0 exec
    omx api sendcommand state h264venc 0 waitforsem
    sleep 12000
    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


    how to configure the fread_venc_fwrite.oms file that support B frame?
    can you provide me a new OMTB script file, thanks

  • come on TI

    thanks

  • Are there any ways to solve it ,Does the dm8168 support B frame about h264 at present?

  • Hi Shang,

    I am working on OMTB script modification.I will get back to you soon.

    Regards,

    Chandru

  • ok,thank you very much.I am looking forward to your reply.

  • Mean time Chandru come back with omtb changes you can try with updated encodes il-client. For me it is working. Two changes required in demos\encode\src\ilclient_utils.c

    1) eRateControlPreset  is set to Low_Delay. This should be modified to Storage for encoding B frames.

    //  tEncoderPreset.eRateControlPreset = OMX_Video_RC_Low_Delay;

      tEncoderPreset.eRateControlPreset = OMX_Video_RC_Storage;

    2) Add at the end of IL_ClientSetEncodeParams function

    {

        OMX_VIDEO_PARAM_AVCTYPE tAVCParams;

        OMX_INIT_PARAM (&tAVCParams);

        tAVCParams.nPortIndex = 1;

        eError = OMX_GetParameter(pHandle, OMX_IndexParamVideoAvc, &tAVCParams);

        if (eError != OMX_ErrorNone)

        {

          ERROR ("failed to Encoder OMX_SetParameter OMX_IndexParamVideoAvc \n");

        }

        tAVCParams.eProfile = OMX_VIDEO_AVCProfileHigh; /* or Main */

        tAVCParams.nBFrames = 2;

        tAVCParams.eLevel = OMX_VIDEO_AVCLevel42;

        eError = OMX_SetParameter(pHandle, OMX_IndexParamVideoAvc, &tAVCParams);

        if (eError != OMX_ErrorNone)

        {

          ERROR ("failed to Encoder OMX_SetParameter OMX_IndexParamVideoAvc \n");

        }

      }

    Thanks and regards

    Sachin Kumar

  • thanks ,it works well after  updatting encodes il-client by following your advices,but the demos\capture_encode does not work in the same way,  the error information is :got event*** unrecoverable error: OMX_ErrorBadParameter (0x80001005)
    Press a key to proceed

  • Sachin,

    I have read elsewhere that B-frames are not supported on the 816x EZSDK.  Are you saying that you were able to successfully produce B-frames using the EZSDK on the 816x?  Did you verify that B-frames were being generated using a video analyzer?

    Thanks,

    John