VIDEOIO ERROR:Unable to query number of channels

I am trying to run the code on a Jetson TX2 with the on-board camera as well as trying it with a USB camera.

v4l2-ctl --list-devices

gives the following output:

vi-output, ov5693 2-0036 (platform:15700000.vi:2):
	/dev/video0

EyeToy USB camera Namtai (usb-3530000.xhci-2.2):
	/dev/video1

The following works when I execute in the terminal:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e

However I am running into this error, when I tried with nvarguscamerasrc inside a docker:

(darknet:80): GStreamer-CRITICAL **: 22:29:48.583: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
VIDEOIO ERROR: V4L: device nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e: Unable to query number of channels

When I tried with v4l2src, I get the following error:

GStreamer-CRITICAL **: 16:12:31.784: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
VIDEOIO ERROR: V4L: device v4l2src device=/dev/video0 ! video/x-raw, framerate=30/1, width=640, height=360 ! videoconvert ! appsink: Unable to query number of channels```

Any help is greatly appreciated.

Hi,
Onboard camera board ov5693 is a Bayer sensor with max resolution 2592x1944. You should run

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=2592, height=1944, framerate=30/1, format=NV12' ! nvvidconv ! 'video/x-raw,width=960, height=616' ! nveglglessink

/dev/video1 looks to be a USB camera. For launching it, please refer to
https://devtalk.nvidia.com/default/topic/1057681/jetson-tx1/logitech-c930e-on-jetson-tx1-very-slow-and-choppy-video/post/5363417/#5363417

Thanks @daneLLL.

Regarding

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=2592, height=1944, framerate=30/1, format=NV12' ! nvvidconv ! 'video/x-raw,width=960, height=616' ! nveglglessink

I ran into the same error as above:

(darknet:67): GStreamer-CRITICAL **: 20:49:25.449: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
VIDEOIO ERROR: V4L: device nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=2592, height=1944, framerate=30/1, format=NV12' ! nvvidconv ! 'video/x-raw,width=960, height=616' ! nveglglessink: Unable to query number of channels

Regarding the link you provided for the USB camera(our camera is PS2 eye toy), the output for

$ v4l2-ctl -d /dev/video1 --list-formats-ext

is as follows:

ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'JPEG' (compressed)
	Name        : JFIF JPEG
		Size: Discrete 320x240
		Size: Discrete 640x480

Based on the above, which pipeline do you suggest?

I tried the following commands without any luck:

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=848,height=480,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvoverlaysink
gst-launch-1.0 -v v4l2src device=/dev/video1 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegdec ! nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! omxh265enc ! matroskamux ! filesink location=test_MJPG_H265enc.mkv
v4l2src device=/dev/video1 ! video/x-raw, framerate=30/1, width=640, height=360 ! videoconvert ! appsink

The above did not work as well.Thanks

Hi,
For more information, does it work if you have default camera board ov5693 on devkit only? This is default hardware environment and should work by simply running

$ nvarguscamerasrc ! nvoverlaysink

Thanks @DaneLLL.

The above command works on the devkit, but it throws the same error( VIDEOIO ERROR:Unable to query number of channels ) when run from within the docker container.

This message is harmless. Check this post to get rid of it.

Thanks! Bought a new camera ( Logitech C920) and that solved the issue. I appreciate your help!