Usb camera not working on jetson nano

hello, i am doing object detection on jetson nano. I am using a camera with a usb port. When I look at it with the lsusb command, the camera appears. But I am getting this error. What do I need to do to run?

Hi,
Pease follow the steps in Jetson Nano FAQ and check if you are able to launch the camera:
Q: I have a USB camera. How can I launch it on Jetson Nano?

v4l2-ctl -d /dev/video0 --list-formats-ext when I execute this command only dev/video0 is listed. When I start a mod in the gstreamer command, I get the following output.

Hi,
Please set the exact format,width,height,framerate to the command. You can see the information in v4l2-ctl --list-formats-ext

Index : 0
Type : Video Capture
Pixel Format: ‘MJPG’ (compressed)
Name : Motion-JPEG
Size: Discrete 1920x1080
Interval: Discrete 0.017s (60.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.017s (60.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.017s (60.000 fps)

Index       : 1
Type        : Video Capture
Pixel Format: 'YUYV'
Name        : YUYV 4:2:2
	Size: Discrete 1920x1080
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 1280x720
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 640x480
		Interval: Discrete 0.017s (60.000 fps)

this is the output of the command and i edited it like this → gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUYV,width=640,height=480,framerate=60/1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvoverlaysink

output: WARNING: erroneous pipeline: could not link v4l2src0 to nvvconv0, neither element can handle caps video/x-raw, format=(string)YUYV, width=(int)640, height=(int)480, framerate=(fraction)60/1

Hi,
Please replace YUYV with YUY2. The format has a different naming in gstreamer.

the camera was turned on first.but later ı taked this output:
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.045830228
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

Hi,
It looks like the camera is not stable, please try this and check if it can run continually without the error:

$ export DISPLAY=:0(or 1)
$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=60/1 ! videoconvert ! xvimagesink

hi,It worked for 5 seconds, then stopped. now it turns on and off immediately.
*output:*Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.048886246
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

Hi,
The camera is not stable. Would suggest try other USB cameras.

As you mentioned above, when I ran the command, the camera worked. How can I work with gst-launch in my python file.

Hi,
We suggest use DeepStream SDK in the topic so please give it a try. Please try this config file which is for USB camera:

/opt/nvidia/deepstream/deepstream-6.0/samples/configs/deepstream-app/source1_usb_dec_infer_resnet_int8.txt

thank you.This is worked for me.

1 Like

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