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.

Linux/TDA2PXEVM: how let 264 encoder encode baseline/ mainprofile stream ??

Part Number: TDA2PXEVM


Tool/software: Linux

i run the usecase in visionsdk to encode my video stream to 264  , it run ok , the 264 stream is ok . 

now i want change 264 highprofile to baseline / mainprofile  ,  i change the two param as follow , but  the stream of encode is not correct .  the sps& pps byte in the head is just 23 bytes . 

       pLinkChPrm->format                 = SYSTEM_IVIDEO_H264MP;
        pLinkChPrm->profile                = 77 ;

how should i do to make the codec run correctly ?  can you give some reference .

thanks

  • Hi,

    Can you share your all codec params?

    Hope you have not modified any file inside lins_fw/src/rtos/links_ipu/iva/iva_enc/

    Regards,

    Anuj

  • /**
    *******************************************************************************
    *
    * \brief Set Enc Create Parameters
    *
    * \param pPrm [IN] EncLink_CreateParams
    *
    *******************************************************************************
    */
    static Void chains_issSimisp_DmsDemo_Encode_Rtsp_SetEncPrms(
    EncLink_CreateParams *pPrm)
    {
    int i, chId;
    EncLink_ChCreateParams *pLinkChPrm;
    EncLink_ChDynamicParams *pLinkDynPrm;

    for (i = 0; i < ENC_LINK_MAX_BUF_ALLOC_POOLS; i++)
    {
    pPrm->numBufPerCh[i] = 4;
    }

    for (chId = 0; chId < 1; chId++)
    {
    pLinkChPrm = &pPrm->chCreateParams[chId];
    pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;

    UTILS_assert (chId < ENC_LINK_MAX_CH);

    pLinkChPrm->format = SYSTEM_IVIDEO_H264MP;
    pLinkChPrm->profile = 77;
    pLinkChPrm->dataLayout = VENC_FIELD_SEPARATED;
    pLinkChPrm->fieldMergeEncodeEnable = FALSE;
    pLinkChPrm->enableAnalyticinfo = 0;
    pLinkChPrm->enableWaterMarking = 0;
    pLinkChPrm->maxBitRate = -1;
    pLinkChPrm->encodingPreset = SYSTEM_XDM_MED_SPEED_HIGH_QUALITY;
    /* Set encodingPreset to SYSTEM_XDM_USER_DEFINED
    if SEI/meta data needs to be enabled */
    /* pLinkChPrm->encodingPreset = SYSTEM_XDM_USER_DEFINED; */
    pLinkChPrm->rateControlPreset = SYSTEM_IVIDEO_LOW_DELAY;
    pLinkChPrm->enableHighSpeed = FALSE;
    pLinkChPrm->enableSVCExtensionFlag = FALSE;
    pLinkChPrm->numTemporalLayer = 0;
    pLinkChPrm->overrideInputScanFormat= 0;
    pLinkChPrm->fieldPicEncode = 0;
    pLinkChPrm->IDRFrameInterval = 1;

    pLinkDynPrm->intraFrameInterval = 30;
    pLinkDynPrm->targetBitRate = 380*1000;
    pLinkDynPrm->interFrameInterval = 1;
    pLinkDynPrm->mvAccuracy = SYSTEM_IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    pLinkDynPrm->inputFrameRate = 30;
    pLinkDynPrm->rcAlg = 0;
    pLinkDynPrm->qpMin = 0;
    pLinkDynPrm->qpMax = 51;
    pLinkDynPrm->qpInit = 25;
    pLinkDynPrm->vbrDuration = 8;
    pLinkDynPrm->vbrSensitivity = 0;
    /* Set maxPicSizeRatioI to 1 for IDR or I-Frame only mode */
    pLinkDynPrm->maxPicSizeRatioI = 640;

    }
    }


    yes , i have not modified any file inside lins_fw/src/rtos/links_ipu/iva/iva_enc/ . the vision_sdk version is 0.3.04
  • Hi,

    Can you try with targetBitRate as 10*1000*1000.

    Regards,
    Anuj
  • i tried it , but it not work .
  • Hi,

    Is it working without these change

    pLinkChPrm->format = SYSTEM_IVIDEO_H264MP;
    pLinkChPrm->profile = 77 ;

    Regards,
    Anuj
  • yes , when the param as follow , it work correctly .

    pLinkChPrm->format = SYSTEM_IVIDEO_H264HP;
    pLinkChPrm->profile = 100 ;

    if be set to follow, it work not correctly 

    pLinkChPrm->format = SYSTEM_IVIDEO_H264MP;
    pLinkChPrm->profile = 77 ; 

  • Hi,

    Please modify \vision_sdk\links_fw\src\rtos\links_ipu\iva\iva_enc\encLink_h264.c

    staticParams->videnc2Params.level = IH264_LEVEL_40;
    to
    staticParams->videnc2Params.level = IH264_LEVEL_42;

    Regards,
    Anuj
  • thanks , i tried but it doesn't work. the sps& pps data size still 23 byte in the head of first frame .
  • Hi,

    What error you see when you set profile as main? can you share status->extendederror?

  • there is no error encounter, I print the some byte of first frame as follow. the sps& sps is wrong .

    [HOST] [HOST ] 119.783474 s: RtspLink_drvProcessFrames 111
    [HOST] [HOST ] 119.783474 s: RtspLink_drvProcessFrames isFirstFrameRecv
    [HOST] [HOST ] 119.783474 s: RTSP Link: can't find sps & pps !!!
    [HOST] [HOST ] 119.783474 s: RTSP Link: buffer[0] = 0
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[1] = 0
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[2] = 0
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[3] = 1
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[4] = 27
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[5] = 4d
    [HOST] [HOST ] 119.783505 s: RTSP Link: buffer[6] = 40
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[7] = 2a
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[8] = 8b
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[9] = 95
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[10] = 0
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[11] = a0
    [HOST] [HOST ] 119.783535 s: RTSP Link: buffer[12] = b
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[13] = 72
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[14] = 0
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[15] = 0
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[16] = 0
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[17] = 1
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[18] = 28
    [HOST] [HOST ] 119.783566 s: RTSP Link: buffer[19] = fe
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[20] = 1
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[21] = ae
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[22] = 20
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[23] = 0
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[24] = 0
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[25] = 0
    [HOST] [HOST ] 119.783596 s: RTSP Link: buffer[26] = 1
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[27] = 25
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[28] = 88
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[29] = 80
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[30] = 1
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[31] = 0
    [HOST] [HOST ] 119.783627 s: RTSP Link: buffer[32] = 80
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[33] = e3
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[34] = 7a
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[35] = a0
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[36] = 2f
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[37] = 3b
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[38] = ff
    [HOST] [HOST ] 119.783657 s: RTSP Link: buffer[39] = 8
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[40] = c9
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[41] = fe
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[42] = aa
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[43] = f
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[44] = 10
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[45] = 2a
    [HOST] [HOST ] 119.783688 s: RTSP Link: buffer[46] = 6d
    [HOST] [HOST ] 119.783718 s: RTSP Link: buffer[47] = 1c
    [HOST] [HOST ] 119.783718 s: RTSP Link: buffer[48] = 6a
    [HOST] [HOST ] 119.783718 s: RTSP Link: buffer[49] = 2b
    [HOST] [HOST ] 119.783718 s: RTSP Link: buffer[50] = 3f
    [HOST] [HOST ] 119.783718 s: RTSP Link: buffer[51] = da
  • Hi,
    Is it possible to dump the bitstream and share? Both High & Main Profile.
  • sorry , i check it again , & find the stream is ok ,  my rtsp can play use vlc . thank a lot . 

  • Hi,

    Glad to know it is working. Did you find the bug or was it working straight forward?