V4l2-ctl stream-mmap works but gstreamer does not

We have an issue where we can stream from the camera using v4l2-ctl:

v4l2-ctl --stream-mm --stream-to=frame.raw --stream-count=1 --verbose --set-fmt-video=width=1280,height=1024,pixelformat=AB24

But we cannot use gstreamer command:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=BGRA,width=1280,height=1024,framerate=60/1 ! fakesink

It gives error:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000065089
Setting pipeline to NULL ...
Freeing pipeline ...

Here is output from list-formats:

v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'AB24' (32-bit RGBA 8-8-8-8)
		Size: Discrete 640x480
			Interval: Discrete 0.017s (60.000 fps)
		Size: Discrete 1280x1024
			Interval: Discrete 0.017s (60.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.017s (60.000 fps)
		Size: Discrete 1024x768
			Interval: Discrete 0.017s (60.000 fps)

Any ideas / tips what might be wrong?

nvidia@jetson:~$ cat /etc/nv_tegra_release
# R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug  1 19:57:35 UTC 2023
nvidia@jetson:~$

hello primoz.fiser,

this usually due to incorrect commands to gst pipeline.
since the format dump shows [0]: 'AB24' (32-bit RGBA 8-8-8-8).
please try to revise the gst pipeline and test again,
for instance,
$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=RGBA,width=1280,height=1024,framerate=60/1 ! nvvidconv ! fakesink

Well this doesn’t work either:

nvidia@jetson:~$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=RGBA,width=1280,height=1024,framerate=60/1 ! nvvidconv ! fakesink
WARNING: erroneous pipeline: could not link v4l2src0 to nvvconv0, v4l2src0 can't handle caps video/x-raw, format=(string)RGBA, width=(int)1280, height=(int)1024, framerate=(fraction)60/1
nvidia@jetson:~$

Funny thing is that original gstreamer pipeline works on Jetson Nano with JP r32 (kernel 4.9), but doesnt work on Jetson AGX Orin with JP r35 (kernel 5.10).

hello primoz.fiser,

it’s erroneous pipeline with not support formats.
as you can see by running… $ gst-inspect-1.0 v4l2src
for instance,
video/x-raw format: { (string)RGB16, (string)BGR, (string)RGB, (string)GRAY8, (string)GRAY16_LE, (string)GRAY16_BE, (string)YVU9, (string)YV12, (string)YUY2, (string)YVYU, (string)UYVY, (string)Y42B, (string)Y41B, (string)YUV9, (string)NV12_64Z32, (string)NV24, (string)NV61, (string)NV16, (string)NV21, (string)NV12, (string)I420, (string)BGRA, (string)BGRx, (string)ARGB, (string)xRGB, (string)BGR15, (string)RGB15 }

@JerryChang ah I see…

v4l2src apparently doesn’t support AB24 / RGBA 8-8-8-8.

Do you have any suggestions why camera format is now AB24 (5.10 kernel) whereas previously it was AR24 (4.9 kernel)?

it’s due to format definitions in VI-5 drivers.
for instance, $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/vi5_formats.h

static const struct tegra_video_format vi5_video_formats[] = {
...
        /* RGB888 */
        TEGRA_VIDEO_FORMAT(RGB888, 24, RGB888_1X24, 4, 1, T_A8R8G8B8,
                                RGB888, RGBA32, "RGBA-8-8-8-8"),
1 Like

@JerryChang Thank you for you support and pointing us into right direction.

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