FFmpeg h264_nvv4l2decoder delay

Hello,
I am using FFmpeg h264_nvv4l2decoder for decoding in Jetson(NVIDIA Jetson AGX Xavier, Jetpack 4.4 [L4T 32.4.3]), There is the code below:

first, find h264_nvv4l2decoder

second, send packet and receive frame

then, i found the first fifteen frames return -11 from avcodec_receive_frame even if the first frame is I frame and there is no b frame in rtsp stream, after that, avcodec_receive_frame starts produce frames from beginning, which make delay happens, I think there is a buffer in decoder, how can i remove or reduce the size to make the decoding procedure more realtime, I edit the code in nvv4l3_dec.c to set V4L2_CID_MPEG_VIDEO_DISABLE_DPB=1 or change the V4L2_CID_MIN_BUFFERS_FOR_CAPTURE which is 9 initially, but none of these working.
Seek for help~ thank you

Hi,
It seems like the h264 stream is invalid. Could you dump the stream and check if it can be decoded in running the sample:

/usr/src/jetson_multimedia_api/samples/00_video_decode/

Hi,
Thx for reply, I use the default h264 decoder in ffmpeg which use cpu decoding, the result is normal and faster than h264_nvv4l2. besides, when i use cpu decoding and the log shows that only first two or three frame receive -11 error code, but nvv4l2 has first ten+ frames error

@DaneLLL hi, I saw the source code of nvv4l2_dec.c, the variable V4L2_CID_MIN_BUFFERS_FOR_CAPTURE’s value is 10, does it mean that it buffer at lease 10 frames then ouput?

Hi,

No, it is the total buffer number. It does not need to fill in all buffer before first decoded YUV being outputted.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.