Unable to get V4l2src working

(The pastebins include both the code and error messages.)

I’m trying to use this program (https://pastebin.com/wWG4m1Kw) for V4l2src. This is done with a Jetson Xavier NX connected to an Orbbec Astra Embedded S which will be programmed in Python 3 and Kivy.

Error code:

/home/nyp/.virtualenvs/py3cv4/bin/python /home/nyp/.virtualenvs/py3cv4/untitled/cameratest.py
4.1.2
[ WARN:0] global /home/nyp/opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: could not link v4l2src0 to nvvconv0, neither element can handle caps video/x-raw, width=(int)1280, height=(int)720, framerate=(fraction)30/1, format=(string)YUYV442
[ WARN:0] global /home/nyp/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ERROR:0] global /home/nyp/opencv/modules/videoio/src/cap.cpp (116) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.1.2) /home/nyp/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can’t find starting number (in the name of file): v4l2src device=/dev/video0 ! video/x-raw, width=1280, height=720, framerate=30/1,format=YUYV442 ! nvvidconv flip-method=2 ! video/x-raw, width=1280, height=720, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink in function ‘icvExtractPattern’

Traceback (most recent call last):
File “/home/nyp/.virtualenvs/py3cv4/untitled/cameratest.py”, line 14, in
cv2.imshow(‘myCam’,frame)
cv2.error: OpenCV(4.1.2) /home/nyp/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’

Process finished with exit code 1

hello kivyn00b,

may I know which camera sensor you’re working with.
you may also refer to Approaches for Validating and Testing the V4L2 Driver for several sample commands to access the camera stream.
thanks

hello kivyn00b,

you may also check the sensor formats with the following command,
i.e. $ v4l2-ctl -d /dev/video0 --list-formats-ext

FYI,
you may also check Camera Architecture Stack,
please note that libargus only support with bayer sensor types, you may enable v4l2src with YUV or USB camera sensors.
thanks