YUYV format sensor cannot use gst-launch-1.0,

orin, r35.1, gst-launch-1.0 v4l2src device=“/dev/video2” ! “video/x-raw, width=1920, height=1080, format=(string)UYVY” ! xvimagesink -e,it can show a widow, but the format is wrong.
gst-launch-1.0 v4l2src device=“/dev/video2” ! “video/x-raw, width=1920, height=1080, format=(string)YUYV” ! xvimagesink -e
it shows the error:[图片]

Hi,
We suggest upgrade to latest Jetpack 5.1.2.

And you can try the command to make sure the source is working:

$ gst-launch-1.0 v4l2src device="/dev/video2" ! "video/x-raw,width=1920,height=1080,format=UYVY" ! fakesink

format=UYVY is ok, but the format is YUYV in fact ,so the image is not correct, when I change format=YUYV, gst-launch-1.0 can not execute.

Hi,
This looks to be a bug in the device tree or sensor driver. Please correct the format in device tree and make sure correct format is set to sensor.

i have set devicetree pixel_phase =“yuyv”

		mode0 {/*mode OV2775_MODE_1920X1080_CROP_30FPS*/
			mclk_khz = "24000";
			num_lanes = "4";
			tegra_sinterface = "serial_a";
			vc_id = "2";
			discontinuous_clk = "no";
			dpcm_enable = "false";
			cil_settletime = "0";
			dynamic_pixel_bit_depth = "16";
			csi_pixel_bit_depth = "16";
			mode_type = "yuv";
			pixel_phase = "yuyv";

			active_w = "1920";
			active_h = "1080";
			readout_orientation = "0";
			line_length = "2200";
			inherent_gain = "1";
			pix_clk_hz = "375000000";
			serdes_pix_clk_hz = "1500000000";

			gain_factor = "10";
			min_gain_val = "0"; /* dB */
			max_gain_val = "300"; /* dB */
			step_gain_val = "3"; /* 0.3 */
			default_gain = "0";
			min_hdr_ratio = "1";
			max_hdr_ratio = "1";
			framerate_factor = "1000000";
			min_framerate = "1500000";
			max_framerate = "30000000";
			step_framerate = "1";
			default_framerate = "30000000";
			exposure_factor = "1000000";
			min_exp_time = "59"; /*us, 2 lines*/
			max_exp_time = "33333";
			step_exp_time = "1";
			default_exp_time = "33333";/* us */
			embedded_metadata_height = "0";
		};

Hi,
Please run the command and check the prints fit your device tree:

$ sudo apt install v4l-utils
$ v4l2-ctl -d /dev/video2 --list-formats-ext

If device tree is correct, you should not see error in running gstreamer commands.

Hi,
The print does not fit the device tree. Suggest you check this and make correction. We would expect the option –list-formats-ext shows information identical to device tree.

this only depend on device tree?I don’t think so

tegra234-p3701-0004-p3737-0000.dtb.gz (275.1 KB)
my dtb file, change the name to tegra234-p3701-0004-p3737-0000.dtb because the upload rules

Theses formats maybe depend on codes? not dependon device tree?

hello jasonGrave,

v4l2 standard control to --list-formats-ext is actually check the sensor driver side to dump the support format types.
device tree settings is passive, you should revise the settings to match your sensor output format types.

please see-also VI driver,
i.e. $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
here’s conversion from device tree properties as v4l formats,
for instance, mode_type + pixel_phase + csi_pixel_bit_depth .

static int extract_pixel_format(
        const char *pixel_t, u32 *format)
{
...
        else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
                *format = V4L2_PIX_FMT_YUYV;
        else if (strncmp(pixel_t, "yuv_yvyu16", size) == 0)
                *format = V4L2_PIX_FMT_YVYU;
        else if (strncmp(pixel_t, "yuv_uyvy16", size) == 0)
                *format = V4L2_PIX_FMT_UYVY;
        else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
                *format = V4L2_PIX_FMT_VYUY;

please follow below for the steps to enable VI tracing logs.
let’s dig into the debug messages for more details.
for example,

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace


I dont think this log do any help, the gstlaunch can not execute. It does not call link vi, rtcpu and so on. if I use “gst-launch-1.0 v4l2src device=”/dev/video2" ! “video/x-raw,width=1920,height=1080,format=UYVY” ! fakesink", it will execute, no matter the image is right or wrong , but use YUYV, it happend nothing.

hello jasonGrave,

there shows an error… Could not link v4l2src0 to xvimagesink0, it may due to xvimagesink doesn’t support such sources formats.
please try other elements, or, you may adding videoconvert to the pipeline for conversion.
for example,
$ gst-launch-1.0 v4l2src device=/dev/video2 ! 'video/x-raw,width=1920,height=1080,format=YUY2' ! videoconvert ! 'video/x-raw,format=I420' ! xvimagesink -e

or…
you may disable preview and shows frame-rate only by fpsdisplaysink.
for example,
$ gst-launch-1.0 v4l2src device=/dev/video2 ! 'video/x-raw,width=1920,height=1080,format=YUY2' ! videoconvert ! 'video/x-raw,format=I420' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v

hi,JerryChang
these cannot execute too.

Hi,
YUYV is defined as YUY2 in gstreamer. Please try

'video/x-raw,width=1920,height=1080,format=YUY2'

And see if the pipeline can be successfully launched.

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