Issue with nvjpegdec in GStreamer pipeline

I’m encountering an error with the nvjpegdec element in my GStreamer pipeline.
Pipeline -
`‘v4l2src’ ‘device=/dev/video0’ ‘do-timestamp=true’ ‘!’ ‘identity’ ‘drop-buffer-flags=corrupted’ ‘!’ '‘watchdog’ ‘timeout=300000’ ‘!’ ‘image/jpeg,width=1920,height=1080’ ‘!’ ‘nvjpegdec’ ‘!’ ‘fakesink’

The error messages I’m seeing in the logs are:


0:00:00.437928882  8719 0x7f9890002180 WARN                 v4l2src gstv4l2src.c:987:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
  5 0:00:00.437958529  8719 0x7f9890002180 WARN                    v4l2 gstv4l2object.c:4721:gst_v4l2_object_set_crop:<v4l2src0:src> VIDIOC_S_CROP failed
  6 0:00:00.438975962  8719 0x7f9890002180 WARN                    v4l2 gstv4l2object.c:3429:gst_v4l2_object_reset_compose_region:<v4l2src0:src> Failed to get default compose rectangle with VIDIOC_G_SELEC    TION: Invalid argument
  7 0:00:00.440001891  8719 0x7f9890002180 WARN          v4l2bufferpool gstv4l2bufferpool.c:852:gst_v4l2_buffer_pool_start:<v4l2src0:pool0:src> Uncertain or not enough buffers, enabling copy threshold
  8 0:00:00.707693238  8719 0x7f9890002180 ERROR                  nvdec gstnvdec.c:428:parser_sequence_callback:<nvjpegdec0> unhandled chroma format 2, bitdepth 8
  9 0:00:00.707741649  8719 0x7f9890002180 WARN                   nvdec gstnvdec.c:716:parser_decode_callback: CUDA call failed: CUDA_ERROR_INVALID_HANDLE, invalid resource handle
 10 0:00:00.707772529  8719 0x7f9890002180 ERROR                  nvdec gstnvdec.c:717:parser_decode_callback:<nvjpegdec0> failed to decode picture
 11 0:00:00.708033384  8719 0x7f9890002180 WARN                 basesrc gstbasesrc.c:3175:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
 12 0:00:00.708042955  8719 0x7f9890002180 WARN                 basesrc gstbasesrc.c:3175:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason error (-5)
 13 0:00:00.708159316  8719 0x7f9890002180 WARN            videodecoder gstvideodecoder.c:1416:gst_video_decoder_sink_event_default:<nvjpegdec0> error: No valid frames decoded before end of stream
 14 0:00:00.708169050  8719 0x7f9890002180 WARN            videodecoder gstvideodecoder.c:1416:gst_video_decoder_sink_event_default:<nvjpegdec0> error: no valid frames found

I’ve tried adjusting the pipeline configuration, but I’m still unable to resolve this issue. As I’m relatively new to GStreamer, I would greatly appreciate any insights or suggestions on how to address this problem.

Gstreamer Version - 1.24.0
CUDA Version: 12.2
NVIDIA-SMI 535.154.05
GPU - RTX A4000

Thank you in advance for your help!

Hi, could you try adding a jpegparse before the nvjpegdec element?
Also please share the output of v4l2-ctl -d /dev/video0 --list-formats-ext (this program comes from v4l-utils package)

After adding jpegparse output

Output of - v4l2-ctl -d /dev/video0 --list-formats-ext

v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'MJPG' (Motion-JPEG, compressed)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
	[1]: 'YUYV' (YUYV 4:2:2)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)

Thank you for the response !

It seems your camera does not support the resolution you are setting in the caps, try setting it to 640x480

We have attempted to set the resolution to 640x480 , but unfortunately, the issue of the decoder crashing still persists

Same problem here. Does somebody have a solution?