GStreamer caps selecting resolution, cannot change - urgent help greatly appreciated

My 5 CSI 4k m.264 cameras are set at different resolutions. None at the 3840x2160 16fps res, as seen in profile 0 below. I believe its something to do with argus.

I can go into gst-launch at the right resolution, if i set it with v4l2, they all work fine there.
But when i go into camera-capture or my python code, gstreamer always selects a different resolution from elsewhere. Even if i put a v4l2 command:

inputs = [videoSource(f'v4l2src device=/dev/video{i} ! video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw(memory:NVMM), format=(string)I420, width=(int)1920, height=(int)1080 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink', argv=['--input-codec=h264']) for i in range(5)]  
output = videoOutput("display://0")

in my code before. Gstreamer still selects another resolution.

[gstreamer] gstCamera – found v4l2 device: vi-output, ar0821 32-0044
[gstreamer] v4l2-proplist, device.path=(string)/dev/video4, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)tegra-video, v4l2.device.card=(string)“vi-output,\ ar0821\ 32-0044”, v4l2.device.bus_info=(string)platform:tegra-capture-vi:5, v4l2.device.version=(uint)330344, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017;
[gstreamer] gstCamera – found v4l2 device: vi-output, ar0821 32-0043
[gstreamer] v4l2-proplist, device.path=(string)/dev/video3, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)tegra-video, v4l2.device.card=(string)“vi-output,\ ar0821\ 32-0043”, v4l2.device.bus_info=(string)platform:tegra-capture-vi:4, v4l2.device.version=(uint)330344, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017;
[gstreamer] gstCamera – found v4l2 device: vi-output, ar0821 31-0044
[gstreamer] v4l2-proplist, device.path=(string)/dev/video2, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)tegra-video, v4l2.device.card=(string)“vi-output,\ ar0821\ 31-0044”, v4l2.device.bus_info=(string)platform:tegra-capture-vi:3, v4l2.device.version=(uint)330344, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017;
[gstreamer] gstCamera – found v4l2 device: vi-output, ar0821 31-0043
[gstreamer] v4l2-proplist, device.path=(string)/dev/video1, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)tegra-video, v4l2.device.card=(string)“vi-output,\ ar0821\ 31-0043”, v4l2.device.bus_info=(string)platform:tegra-capture-vi:2, v4l2.device.version=(uint)330344, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017;
[gstreamer] gstCamera – found v4l2 device: vi-output, ar0821 30-0043
[gstreamer] v4l2-proplist, device.path=(string)/dev/video0, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)tegra-video, v4l2.device.card=(string)“vi-output,\ ar0821\ 30-0043”, v4l2.device.bus_info=(string)platform:tegra-capture-vi:0, v4l2.device.version=(uint)330344, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017;
[gstreamer] gstCamera – found 6 caps for v4l2 device /dev/video0
[gstreamer] [0] video/x-raw, format=(string)UYVY, width=(int)3840, height=(int)2160, framerate=(fraction)16/1;
[gstreamer] [1] video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60/1;
[gstreamer] [2] video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60/1;
[gstreamer] [3] video/x-raw, format=(string)NV16, width=(int)3840, height=(int)2160, framerate=(fraction)16/1;
[gstreamer] [4] video/x-raw, format=(string)NV16, width=(int)1920, height=(int)1080, framerate=(fraction)60/1;
[gstreamer] [5] video/x-raw, format=(string)NV16, width=(int)1280, height=(int)720, framerate=(fraction)60/1;
[gstreamer] gstCamera – selected device profile: codec=raw format=uyvy width=1280 height=720
[gstreamer] gstCamera pipeline string:
[gstreamer] v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720 ! appsink name=mysink sync=false
[gstreamer] gstCamera successfully created device v4l2:///dev/video0

In my code, this also preceeds with:

(python3.8:11404): GStreamer-CRITICAL **: 18:45:01.716: gst_element_message_full_with_details: assertion 'GST_IS_ELEMENT (element)' failed

But I believe that to be another problem, as the rest of the terminal is the same as initial block in camera-capture.

I have also tried:

def set_gstcamera_profile(device, profile_number):
subprocess.run(f'v4l2-ctl -d {device} --set-selection=1 --selection-target=1 --set-profile={profile_number}', shell=True)

Nothing I try changes it.
I’ve learnt that my cameras are not 4k compatible with ARGUS API, but they are 1920x1080. Which I still cannot set.

Please Help, I have days on my project.

Jetson Orin, R35, python3.8, linux debian arm64.

Hi,
Please execute v4l2-ctl --list-formats-ext and share the prints for reference. Would like to make sure which type the camera source is.

Thanks for your reply. Requested is below, matching the gstreamer profiles.

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

[0]: 'UYVY' (UYVY 4:2:2)
	Size: Discrete 1280x720
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 1920x1080
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 3840x2160
		Interval: Discrete 0.062s (16.000 fps)
[1]: 'NV16' (Y/CbCr 4:2:2)
	Size: Discrete 1280x720
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 1920x1080
		Interval: Discrete 0.017s (60.000 fps)
	Size: Discrete 3840x2160
		Interval: Discrete 0.062s (16.000 fps)

Hi,
Please refer to Jetson AGX Orin FAQ

Q: I have a USB camera. How can I launch it on AGX Orin?

And use v4l2src. Seems like the framerate is not set correctly so it fails. The sources supports 720p60, 1080p60, 4Kp16 and it is set to 30fps in the string:

inputs = [videoSource(f'v4l2src device=/dev/video{i} ! video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw(memory:NVMM), format=(string)I420, width=(int)1920, height=(int)1080 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink', argv=['--input-codec=h264']) for i in range(5)]  

For testing, you may try this sample by setting format, width, height, framerate accordingly:
V4l2src using OpenCV Gstreamer is not working in Jetson Xavier NX - #3 by DaneLLL

The latest release is Jetpack 5.1.1 or 5.1.2. If you use previous release, may consider upgrade the version and try.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.