hanwb
April 22, 2019, 2:01am
1
My Camera Information
cat /dev/v4l/by-id/*
cat: /dev/v4l/by-id/usb-046d_081b_6D1FE030-video-index0: Invalid argument
//std::string resolution = “1280x720”, input = “device:///nvcamera”;
Modify the source code to
std::string resolution = “1280x720”, input = “device:///v4l2?index=0”;
error message Can’t Open Resource
What is the reason for this?
How to solve?
Hi,
Suppose you should be able to find your camera on /dev/video*.
Could you help to check it first?
Thanks.
hanwb
May 22, 2019, 7:05am
3
About whether the code of nano jetbot camera.py can modify this code to use USB camera, if you can modify it to something, I refer to this file and the modification is invalid.
https://github.com/NVIDIA-AI-IOT/jetbot/blob/master/jetbot/camera.py
def _gst_str(self):
return ‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=%d, height=%d, format=(string)NV12, framerate=(fraction)%d/1 ! nvvidconv ! video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! videoconvert ! appsink’ % (self.capture_width, self.capture_height, self.fps, self.width, self.height)
Reference has tried this kind of hard to use :
{
mSource = src; // store camera source method
#if NV_TENSORRT_MAJOR > 1 && NV_TENSORRT_MAJOR < 5 // if JetPack 3.1-3.3 (different flip-method)
const int flipMethod = 0; // Xavier (w/TRT5) camera is mounted inverted
#else
const int flipMethod = 2;
#endif
if( src == GST_SOURCE_NVCAMERA )
ss << "nvcamerasrc fpsRange=\"30.0 30.0\" ! video/x-raw(memory:NVMM), width=(int)" << mWidth << ", height=(int)" << mHeight << ", format=(string)NV12 ! nvvidconv flip-method=" << flipMethod << " ! "; //'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! ";
else if( src == GST_SOURCE_NVARGUS )
ss << "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)" << mWidth << ", height=(int)" << mHeight << ", framerate=30/1, format=(string)NV12 ! nvvidconv flip-method=" << flipMethod << " ! ";
ss << "video/x-raw ! appsink name=mysink";
}
else
{
ss << "v4l2src device=/dev/video" << mV4L2Device << " ! ";
ss << "video/x-raw, width=(int)" << mWidth << ", height=(int)" << mHeight << ", ";
nvcamerasrc fpsRange="30.0 30.0" ! video/x-raw(memory:NVMM)…
I hope to give a method to support USB camera. Thank you very much.
Hi,
For USB camera, you can get all supported formats through v4l2-ctl command:
nvidia@nvidia-desktop:~$ v4l2-ctl -d /dev/video1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : 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)
(...skip...)
Size: Discrete 800x600
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)
(...skip...)
And pick one mode(ex: 800x600p24) to run:
'v4l2src device=/dev/video1 ! video/x-raw, width=800, height=600, format=(string)YUY2, framerate=(fraction)24/1 ! videoconvert ! video/x-raw,format=BGR ! appsink'
I have the same error.
I try:
std::string resolution = "1280x720", input = "device:///v4l2?index=0";
desktop:~/Downloads$ v4l2-ctl --all | more
Driver Info (not using libv4l2):
Driver name : uvcvideo
Card type : HD Pro Webcam C920
Bus info : usb-70090000.xusb-2.4
Driver version: 4.9.140
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Hi,
For running v4l2rc,you have to modify the sample code. Please refer to
[url]visionworks-1.6-samples issue - Jetson AGX Xavier - NVIDIA Developer Forums
I did not understand.
In the source code I use:
std::string resolution = "1280x720", input = "device:///v4l2?index=0";
What I need change ? “device:///v4l2?index=0” is for usb cam right ?
Usb cam are in /dev/video0.
I run this line and receive this error:
gst-launch-1.0 v4l2src device="/dev/video0" ! \ "video/x-raw, width=640, height=480, format=(string)YUY2" ! \ xvimagesink -e
(gst-launch-1.0:29390): GStreamer-CRITICAL **: 10:27:46.987: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
WARNING: erroneous pipeline: syntax error