Nvjpegdec does not work for USB camera

I have a Orin Nano dev kit board. Below is its information.

Model: NVIDIA Orin Nano Developer Kit - Jetpack 5.1.1 [L4T 35.3.1]
NV Power Mode[1]: 7W
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:

  • 699-level Part Number: 699-13767-0005-300 K.2
  • P-Number: p3767-0005
  • Module: NVIDIA Jetson Orin Nano (Developer kit)
  • SoC: tegra23x
  • CUDA Arch BIN: 8.7
  • Codename: P3768
    Platform:
  • Machine: aarch64
  • System: Linux
  • Distribution: Ubuntu 20.04 focal
  • Release: 5.10.104-tegra
  • Python: 3.8.10

I use a USB camera and want to use nvjpegdec hardware decoder. Below is my gst command.
gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1920, height=1080, framerate=30/1 ! nvjpegdec ! videoconvert ! xvimagesink

But I got error with above command, the attached is error log file. I saw the main error is like below line.
ERROR jpegdec gstjpegdec.c:1147:gst_jpeg_dec_negotiate: Empty caps

If I use software decoder: jpegdec instead of nvjpegdec, I have no this issue.

Below is my camera formats.
v4l2-ctl -d /dev/video1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
            Size: Discrete 3840x2160
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 3840x3104
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 3264x2448
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 2592x1944
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 2048x1536
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1600x1200
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1024x768
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
            Size: Discrete 3840x2160
                    Interval: Discrete 1.000s (1.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 3840x3104
                    Interval: Discrete 1.000s (1.000 fps)
            Size: Discrete 3264x2448
                    Interval: Discrete 1.000s (1.000 fps)
            Size: Discrete 2592x1944
                    Interval: Discrete 1.000s (1.000 fps)
            Size: Discrete 2048x1536
                    Interval: Discrete 1.000s (1.000 fps)
            Size: Discrete 1600x1200
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 1024x768
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)

gst_nvjpegdec.log (2.0 KB)

Hi,
MJPEG decoding is also supported in nvv4l2decoder plugin. Please try

... ! nvv4l2decoder mjpeg=1 ! ...

I tried nvv4l2decoder as your suggestion. It can play the camera video, but it has much latency to play camer video. It looks just 3-5 fps.

I remember I can use nvjpegdec to play USB camera on Xavier NX. Dont know why can’t use nvjpegdec on Orin Nano.

Hi,
There is a known issue in MJPEG decoding:
Issues with nvjpegdec on live HTTP streams - #3 by DaneLLL

It shall be fixed in next Jetpack 5.1.3. On 5.1.1 or 5.1.2, please use nvv4l2decoder or software JPEG decoder.

I used nvv4l2decoder, but I saw the video is much latency. It was worse than software JPEG decoder. Is this also known issue?

Hi,
We don’t check the latency between nvv4l2decoder and software decoder. Please share the method of do comparison. We will set up and give it a try.

I used below command to play camera and saw much latency.

gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1920,height=1080 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! xvimagesink

The attached is the video I captured.
nvv4l2decoder_mjpeg_latency.zip (2.1 MB)

BTW, software decoder is also not good, I can see latency on software decoder too.

Hi,
Please try the pipeline like:
Set camera decoder in OpenCV on Jetson Nano - #8 by DaneLLL

Set io-mode=2 to v4l2src and add jpegparse. See if there is reduction in latency.

Just set io-mode=2 to v4l2src and add jpegparse, I still saw much latency.

When will Jetpack 5.1.3 be released? Do you have plan for Jetpack 5.1.3 release?

Any update for this post?

Hi,
Please try
NvJPEGDecoder generates the same output if called twice with different input buffer - #7 by DaneLLL

And please set mjpegdecode=1:

... ! nvjpegdec mjpegdecode=1 ! ...

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