GStreamer Warning and Black Screen with USBCamera on Jetson

Using the jetcam library on a Jetson orin nano device(headful mode) to interface with a USB camera. When capturing an image, I get the following GStreamer warning after the line of code"camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)".

WARN:0@1.072] global cap_gstreamer.cpp:1728 open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

Additionally, the image displayed is a black screen. Camera is Logitech C720.

Full code is below,
"!ls -ltrh /dev/video*
from jetcam.usb_camera import USBCamera

#TODO change capture_device if incorrect for your system
camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)
image = camera.read()

print(image.shape)

print(camera.value.shape)

import ipywidgets
from IPython.display import display
from jetcam.utils import bgr8_to_jpeg

image_widget = ipywidgets.Image(format=‘jpeg’)

image_widget.value = bgr8_to_jpeg(image)

display(image_widget)"

Please help on any suggestions to fix the GStreamer warning and black screen issue? I’ve ensured drivers are updated and camera is recognized.

Hi,
Please try the steps and see if you can run gst-launch-1.0 command to launch the USB camera:

Jetson AGX Orin FAQ
Q: I have a USB camera. How can I launch it on AGX Orin?

Hello DaneLLL, Thanks for the response. I tried “$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvoverlaysink” and it is giving a warning "WARNING: erroneous pipeline: no element “nvoverlaysink” "

Supported formats are,

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

[0]: 'YUYV' (YUYV 4:2:2)
	Size: Discrete 640x480
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.042s (24.000 fps)
		Interval: Discrete 0.050s (20.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
		Interval: Discrete 0.100s (10.000 fps)
		Interval: Discrete 0.133s (7.500 fps)
		Interval: Discrete 0.200s (5.000 fps)

Installation attempt is failing,
$ sudo apt-get install gstreamer1.0-nvvideosink
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package gstreamer1.0-nvvideosink
E: Couldn’t find any package by glob ‘gstreamer1.0-nvvideosink’
E: Couldn’t find any package by regex ‘gstreamer1.0-nvvideosink’

Hi,
Please try

$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=I420 ! xvimagesink sync=0

Hi,

Query- “$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=I420 ! xvimagesink sync=0”

is opening the camera.

Hi,
It seems like you are using this:

GitHub - NVIDIA-AI-IOT/jetcam: Easy to use Python camera interface for NVIDIA Jetson

This is for Jetson Nano/Jetpack 4. If your platform is Orin Nano, it is possible that it doesn’t work properly. Please confirm which platform you are using. The camera source is good and it seems like the platform is not compatible with the application.

Hi, I am using Jetson Orin nano/Jetpack 6.1

Hi,
The jetcam project is not for Orin Nano. Please try this instead:
Jetson Nano Orin, Issue when create the camera object - #13 by dusty_nv