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 decrease the latency of decoding H.264 live video on davinci(using DMAI)?

When decoding H.264 live video using DMAI, there is a function " Vdec2_process(hDecoder, hInBuf, hDstBuf) " , where hInBuf is a buffer built for live video data, and decoded data is put into hDstBuf.

The size of hInBuf should be Vdec2_getInBufSize(hDecoder) or more, so we have to fill enough live video data with hInBuf , which means waiting a enough time dalta to get the enough data.   This result in a notable datency.

How to decrease the latency as less as possible ?

 

Thanks.

  • Hello,

    The decoder is frame based, so you have to pass a full frame of encoded video data in hInBuf.

    What Vdec2_getInBufSize() returns is the amount of data required by a specific codec to guarantee that a full encoded frame is passed.

    If you already know that you are passing a full frame of data, you don't have to pass Vdec2_getInBufSize() number of bytes. The DVSDK demos do not have this information, which is why they pass in the full buffer size, and since the filling of this buffer is in a separate thread (running while the H/W accelerator is decoding), there is really no additional latency.

    If you are working with a container of some sort (.mp4 etc.) then the demuxer may give you full frames. Another way to pass in minimal amount of data is to "chunk" the h.264 elementary stream before passing it to the decoder in to full frames.

    Regards, Niclas

  • Niclas.

    Before your reply , I do not know these information behind the dvsdk demo.At that time if filled hInBuf with size of "Vdec2_getInBufSize" (720P Yuv420semi is about 1M), the latency was about 3~4 seconds , which was not acceptable . After that  I decreased hInBuf to 200k bytes , which was big enough for one decoding process.Maybe 200k constant size is too big for some type of frame, the latency was 200~300ms around .

    Some time later I will try it according to your answer.

    Thank you