H.264 GDR decoding with GStreamer is broken

I am trying to decode the following stream: http://arunraghavan.net/temp/main-nosei.h264

It is an H.264 GDR stream from a camera, there are no IDR frames. The board has been flashed with the latest L4T image.

I try to decode with the following pipeline:

GST_DEBUG=*v4l*:6 gst-launch-1.0 souphttpsrc location=http://arunraghavan.net/temp/main-nosei.h264 ! h264parse  ! nvv4l2decoder enable-frame-type-reporting=true  ! fakesink

and see the following logs:

0:00:01.729925352 10052 0xaaaab01e9d20 DEBUG           v4l2videodec gstv4l2videodec.c:1404:gst_v4l2_video_dec_handle_frame:<nvv4l2decoder0> Handling frame 0
0:00:01.729936328 10052 0xaaaab01e9d20 DEBUG           v4l2videodec gstv4l2videodec.c:1418:gst_v4l2_video_dec_handle_frame:<nvv4l2decoder0> Delta Unit Received, Dropping...

This is not surprising, since the gst-v4l2 code has the following, which would make this stream not work:

#ifdef USE_V4L2_TARGET_NV
  /* CUVID and TEGRA decoders return format when SPS/PPS is received along with
   * a frame. In case of RTSP inputs we drop the DELTA units which are not
   * decodable independently until we receive I / IDR frame. 
  */
  if ((GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H264) ||
          (GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H265))
  {
      if ((GST_BUFFER_FLAG_IS_SET (GST_BUFFER_CAST(frame->input_buffer),
                                  GST_BUFFER_FLAG_DELTA_UNIT)) &&
              (self->idr_received == FALSE))
      {
          GST_DEBUG_OBJECT (decoder, "Delta Unit Received, Dropping...");
          gst_video_decoder_drop_frame (decoder, frame);
          return GST_FLOW_OK;
      }
      self->idr_received = TRUE;
  }
#endif

I tried to send in a black IDR frame before sending the camera frames in, but that causes the decoder to hang after pushing 10 frames:

0:00:00.181979695 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:2077:gst_v4l2_buffer_pool_process:<video_decoder:pool:sink> process buffer 0xffff9401ba38
0:00:00.181986383 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1641:gst_v4l2_buffer_pool_acquire_buffer:<video_decoder:pool:sink> acquire
0:00:00.182016943 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1719:gst_v4l2_buffer_pool_release_buffer:<video_decoder:pool:sink> release buffer 0xffff940b97e0
0:00:00.187178549 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1719:gst_v4l2_buffer_pool_release_buffer:<video_decoder:pool:sink> release buffer 0xaaaab14bfc60
0:00:00.187266134 10144 0xaaaab1337520 DEBUG           v4l2videodec gstv4l2videodec.c:1404:gst_v4l2_video_dec_handle_frame:<video_decoder> Handling frame 10
0:00:00.187279478 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:2077:gst_v4l2_buffer_pool_process:<video_decoder:pool:sink> process buffer 0xffff9401bb48
0:00:00.187287446 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1641:gst_v4l2_buffer_pool_acquire_buffer:<video_decoder:pool:sink> acquire
0:00:00.187348695 10144 0xaaaab1337520 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1719:gst_v4l2_buffer_pool_release_buffer:<video_decoder:pool:sink> release buffer 0xffff940b9480
FrameType = I
 (IDR)
nActiveRefFrames = 0
0:00:00.188186978 10144 0xaaaab1337980 WARN          v4l2bufferpool gstv4l2bufferpool.c:1533:gst_v4l2_buffer_pool_dqbuf:<video_decoder:pool:src> Driver should never set v4l2_buffer.field to ANY
0:00:00.188197666 10144 0xaaaab1337980 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:2077:gst_v4l2_buffer_pool_process:<video_decoder:pool:src> process buffer 0xffff99a09870
0:00:00.188206819 10144 0xaaaab1337980 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:2127:gst_v4l2_buffer_pool_process:<video_decoder:pool:src> num_queued 9 copy_threshold 9 dynamic_allocation 0

Frame 0
0:00:00.188821771 10144 0xaaaab1337980 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1641:gst_v4l2_buffer_pool_acquire_buffer:<video_decoder:pool:src> acquire

Hi,
Could you try this sample and see if it works:

/usr/src/jetson_multimedia_api/samples/00_video_decode

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

Hi,
Please apply the patch and give it a try:
JetPack5.1.1 does not support H265 GDR decoding - #6 by DaneLLL