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 start decoder without very first frame?

Hi!

 

I have a question about the H.264 decoder on the DM365. When I decode 720p video data, the first bytes of the first encoded frame are different from the bytes of the next encoded frames, either I or P frames. If I skip the first frame and try to start decode with the second encoded frame or with the second encoded I frame, the decoder returns an error code (0x445) and does not decode the frame. How can I start to decode with any frame in the byte stream? Is it a possible workaround to start and stop the encoder every 30 frames, so that the very first frame would be created every 30 frames?

 

Regards,

 

MW

  • Hello,

     

    I searched the datasheet of the encoder and found the idrFrameInterval parameter in the IH264VENC_DynamicParams structure. Can I can use this parameter to periodically create an IDR frame instead of an I frame which should do the synchronisation with the decoder?

     

    Regards,

     

    MW

  • Hi,

    If decoder didnt get 1st frame or IDR frame it wont have much needed information like resolution, number reference buf, profileIdc and many more, so it cant decode any frame till it get next IDR frame. So don't skip IDR frame, you can skip other frames(I or P). The frame next after the skip may not have good quality because of missing or wrong reference frame.

    Yes you can use idrFrameInterval parameter to have sync with decoder. In this case even if 1st frames missed, decoder will fail till it gets next IDR frame.

  • Thank you for your answer!

     

    I used the idrFrameInterval parameter but it seems that the encoder still creates only the first frame as IDR frame. I looked at the first 10 bytes of each encoded frame and there is no difference between I frame and the frame, which supposed to be the IDR frame. And the decoder also don't start decoding with the next supposed IDR frame. Do I have to change other parameters too?Do I have to change any preset to "user defined", so that the encoder uses the extended parameters instead of the default ones?

     

    Regards,

     

    MW

  • Hi,

    idrFrameInterval param is extended param in IH264VENC_DynamicParams, I think you are using extended params. Can you please check what value you are setting for IH264VENC_DynamicParams.videncDynamicParams.size param? if it is sizeof(IVIDENC1_DynamicParams) codec will use base param mode else if sizeof(IH264VENC_DynamicParams) codec will use extended params.

    If issue still persists, please share the all encoder params and generated stream.

  • Hi,

     

    it works now! I think it was the size problem. I had changed the sizes correctly to the specified values but then elsewhere I overwrite the structure again with the default value. Additionally, I used params.encodingPreset = XDM_USER_DEFINED and params.rateControlPreset = IVIDEO_USER_DEFINED. What can be achieved with these parameters? Do the encoder use default extended values if encodingPreset and rateControlPreset are not USER_DEFINED?

     

    Thanks and regards,

     

    MW

  • Hi,

    Its nice to know your Encoder and Decoders working as u wanted.

    If you set params.encodingPreset = XDM_USER_DEFINED, codec will expect you to provide valid value for encQuality param, it decides encoder mode(valid values are 0, 1, 2, 3).

    Same thing will be for rateControlPreset param if it equal to  IVIDEO_USER_DEFINED application has to provide valid value for rcAlgo param.  For more info please have look at User's Guide there it is explained in detail.