yeah you’re looking in the wrong places.
you can’t just “try” random backends without knowing what they are and whether they’re available on your OS and for that device. I mean, yes you can, but that was unlikely to lead far. you’ve got a regular USB UVC device there. those other backends are for niche applications, not for the majority of uses.
V4L is the only one you can use, for an USB webcam, on linux. you don’t have to specify that explicitly. just open device ID 0
and OpenCV does the rest.
you need to call .set()
using CAP_PROP_* values. you did not say that you know about that method. your entire post contains no references to cap.set()
or CAP_PROP_*
, but you reference everything else, so I’m assuming it’s not an oversight in the writing of your post.
you can’t just poke the device with v4l2-ctl and hope that OpenCV will be okay with that. OpenCV does its own initialization, to a default of 640x480, or whatever’s closest that the device will accept. OpenCV will (currently) not touch any MJPEG modes automatically. it’s always defaulting to something uncompressed, in the interest of better data.
if you want a specific width and height, you need to set the width and height properties. you use the cap.set()
method for that.
if that doesn’t happen to work on its own, you need to try first setting CAP_PROP_FOURCC
to VideoWriter_fourcc(*"MJPG")
.
that should work.