USB Cameras fail to open via gst: streaming stopped, reason not-negotiated (-4)

I am having a very odd problem with two USB cameras. One is an Aukey PC-W3 webcam, the other is an ELP IMX322 USB camera.
The Aukey hangs when trying to open it at a resolution of 1080p in gst. The ELP IMX322 gives an actual error when trying to open the preview resolution above 800x600:

ERROR on bus: by /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstV4l2Src:v4l2src1: Internal data stream error.
debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstV4l2Src:v4l2src1:
streaming stopped, reason not-negotiated (-4)

I figured it was an issue with the camera’s support for Linux or something, as Windows has no issues running both cameras at 1080p. I decided to debug with V4L2. Both cameras properly support 1080p.
Here’s the v4l2-ctl output of --list-formats-ext on the IMX322: (env) user@user-desktop:~/face/facial_analysis_python$ v4l2-ctl -d /dev/video0 - - Pastebin.com

Running VLC with v4l2 arguments I can open both cameras at 1080p without issue:

vlc v4l2:///dev/video0:chroma=mjpg:width=1920:height=1080

However, gstreamer errors out on the same cameras. I’ve tried a variety of arguments, encodings, etc but nothing is getting past this error. I’ve tried different encoding profiles (baseline, high), different color formats, but every time I get the same error. Only one camera is plugged in or used at once and they’re directly connected to the Jetson via USB so it shouldn’t be a USB bus or power issue.

What confuses me is gst seems to use v4l2 as a backend, so I can’t tell why VLC can open the v4l2 device but gst cannot.

This is the command I’m using

nvgstcapture-1.0 --cap-dev-node=0 --prev-res=4

Hi,
Please follow the steps in
Jetson Nano FAQ
Q: I have a USB camera. How can I launch it on Jetson Nano?

Hi DaneLLL,

I think I see the issue.
The Aukey camera still hangs while following those steps, so I imagine it’s an issue with the camera. However, the IMX322 I have doesn’t support YUY2 at 1080p.

video/x-raw,format=YUY2,width=640,height=480,framerate=30/1

What is the equivalent of that command for MJPG? I tried MJPG and got this error:

WARNING: erroneous pipeline: could not link v4l2src0 to nvvconv0, neither element can handle caps video/x-raw, format=(string)MJPG, width=(int)1280, height=(int)720, framerate=(fraction)30/1

I imagine the pipeline will be a bit different, but I can’t seem to find good result for a similar effect but with MJPEG.

I tried your solution here: USB Camera MJPEG to h265 - #2 by DaneLLL

but this gave me one static image instead of a stream of MJPEGs. I tried another solution on that thread, and I got it to work!

Solution:
gst-launch-1.0 -v v4l2src device=/dev/video0 ! ‘image/jpeg, width=640, height=480, framerate=5/1, format=MJPG’ ! jpegdec ! nvoverlaysink

(for posterity, run “v4l2-ctl -d /dev/video0 --list-formats-ext” and make sure you pick a resolution and framerate your camera has too of course!) If you using the command with opencv, add ! videoconvert after jpegdec