PhotonVision Can't find USB camera

I have PhotonVision with a SnakeEyes picam that works fine. but when I add a secondary USB camera, it does not seem to identify. The camera, an ELP, works fine attached to a PC. When connected PhotonVision registers 2 cameras, and neither appear to work.

[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Matching 3 new cameras!
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [INFO] Adding local video device - “H264 USB Camera” at “/dev/video0”
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [INFO] Adding local video device - “H264 USB Camera” at “/dev/video2”
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [INFO] Adding local video device - “mmal service 16.1” at “/dev/video4”
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Trying to match 2 unmatched configs…
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Trying to find a match for loaded camera H264 USB Camera with path /dev/video2
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Matched the config for H264 USB Camera to a physical camera!
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Trying to find a match for loaded camera H264 USB Camera with path /dev/video0
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Matched the config for H264 USB Camera to a physical camera!
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Trying to find a match for loaded camera mmal service 16.1 with path /dev/video4
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Matched the config for mmal service 16.1 to a physical camera!
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] After matching loaded configs 0 cameras were unmatched.
[2022-01-23 09:13:32] [Camera - VisionSourceManager] [DEBUG] Matched or created 3 camera configs!
[2022-01-23 09:13:32] [Camera - USBCameraSource - H264_USB_Camera (1)] [ERROR] Got a null video mode! Doing nothing…

It’s possible that CSCore has issues with this camera, and it’s also possible that there is a bug in the multicamera or camera matching code. If you could click “Export settings” in the Settings tab and send that here then we can probably get enough context to tell you more.

Attaching here.
photonvision-settings.zip (33.0 KB)

H264_USB_Camera (1)] [ERROR] Got a null video mode! Doing nothing...
Seems that either V4L or cscore do not support this camera.
We depend on cscore to give us available video modes for cameras, and on Linux, it depends on V4L.

If you can send the output of v4l2-ctl --list-formats-ext /dev/video0 that will help us figure out where the problem is.

That gives me an Unknown arguments, but if I don’t specify, I get:

pi@photonvision:~ $ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 640x360
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
        Size: Discrete 320x180
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.200s (5.000 fps)
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.100s (10.000 fps)
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 640x360
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 320x180
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.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.200s (5.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.200s (5.000 fps)
                    Interval: Discrete 0.200s (5.000 fps)

Ah my mistake. The correct command would be v4l2-ctl -d /dev/video0 --list-formats-ext.
If you can confirm that the output is the same that’d be enough. Also the output of v4l2-ctl -d /dev/video0 -D, which should tell us the driver that it’s using.

no worries. Yes, output is the same. and for the driver:

pi@photonvision:~ $ v4l2-ctl -d /dev/video0 -D
Driver Info:
Driver name : uvcvideo
Card type : H264 USB Camera: H264 USB Camer
Bus info : usb-3f980000.usb-1.1.3
Driver version : 5.4.83
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : H264 USB Camera: H264 USB Camer
Serial : 2020052801
Bus info : usb-3f980000.usb-1.1.3
Media version : 5.4.83
Hardware revision: 0x00000100 (256)
Driver version : 5.4.83
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : H264 USB Camera: H264 USB Camer
Function : V4L2 I/O
Flags : default
Pad 0x0100000d : 0: Sink
Link 0x0200001a: from remote pad 0x1000010 of entity ‘Extension 4’: Data, Enabled, Immutable

@bankst any thoughts on this?

I can’t really tell why it’s not working. My best advice is to try with WPILibPi, and if it doesn’t work there, bring it up with @Peter_Johnson to see if he can help further, as it’d be a cscore issue.

The camera comes up fine with wpilibpi. swap out for photonvision, and it does not come up.

If you want to debug, I would set a breakpoint on Line 163 of USBCameraSource and follow that stacktrace up to see why the video mode is null. You should be able to attach a remote debugger, though that setup is slightly involved.