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.

Missing I-frames on DM6467 DVEVM h.264 BP encoder

I use the encode application of the DM6467 DVEVM for encoding a 720p clip captured on the component video input and save the encoded data to a file.

The encoder is set to output an I-frame every 30 frames.

I created a file after capturing the above input for 20 seconds. I expected to see more than 1 I-frame in the created file since the capture time is more than enough.

After investigating the file, I found out that it has only 1 I-frame at the beginning of the file (marked by the hex sequence 00 00 00 01 65) and the rest of the file frames are P-frames. I made a search with hex editor to find more of the above hex sequence, but no I-frames were found.

I made the test once more and for every frame sent to the encoder I printed the returned frame type from the encoder (one of the fields of outArgs - Venc1.c file in DMAI) and when I printed it I found out that every 30 frames it reports that it encoded an I-frame which is what is expected. But again, the file contained only 1 I-frame and the rest are P-frames.

What is the reason for this? 

  • Have you tried analyzing the bitstream using a syntax analyzer such as Elecard StreamEye? The first frame encoded will be IDR frame. Depending on Intra Frame Interval, subsequent frames are coded as I. Rest of the frames are coded as P. I think the hex sequence 00 00 00 01 65 you see at the beginning of the bitstream corresponds to IDR.

  • Thank you.

    I used the Elecard StreamEye and found out that indeed there are I-frames every 30 fames as it should, so I was wrong, since I thought that IDR is the same as I-frame.

    I know that many encoders (like ffmpeg for example) use IDR and not I-frames every some frames and this is done for allowing streaming to work although packets are lost. An IDR includes all the required information for synchronizing back after packet loss when doing streaming.

    Also, the TI h.264 BP decoder requires an IDR to start decoding and if I give it I-frame at the beginning it will not decode.

    This is still a problem to me. Is there a possibility to output IDR frames every 'IntraFrameInterval' from the TI H.264 BP encoder and not I-frame?

  • I agree with you that the Streaming Media applications (and in general, applications that involve networking) would want to have an IDR frame every T seconds to recover from possible packet loss conditions. However, this is not a generic requirement across all application domains.

    The same effect of having periodic IDR frames can be achieved at application level through the following:

    1. IntraFrameInterval = 0

    This will ensure that the encoder codes the very first frame as IDR and rest of the frames as Inter.

    2. For every N frames, make a control call with "forceFrame" parameter set to IVIDEO_IDR_FRAME. This will force the immediate next frame to be coded as IDR

    #define IDR_INTERVAL  30

    IVIDENC1_DynamicParams dynParams;

    IVIDENC1_Status status;

    int nFrames=1;

    ...

    while ( !stop )

    {

       if (0 == nFrames % IDR_INTERVAL)

       {

         dynParams.forceFrame = IVIDEO_IDR_FRAME;

         VIDENC1_control(handle, XDM_SETPARAMS, &dynParams, &status);

      }

      ...

      VIDENC1_process(handle, &inBufDesc, &outBufDesc, &inArgs, &outArgs);

      nFrames++;

      ...

    }

  • I tried your suggestion for forcing IDR frames every 30 frames but I keep getting only 1 IDR at start of encoded file and no more IDRs later.

    Any other suggestion?

  • Nir,

    You called the Control function using XDM_SETPARAMS every 30 frames? In the output that you get are you getting an I frame instead of an IDR?

  • Meanwhile I got over this problem. I now get IDR frames. It seems I send a wrong struct size.