How to safely change stride alignment?

Hi all,

I’m working with a sensor that outputs 1296 pixels per line in Y10 format (Jetson Xavier AGX, JetPack 4.5.1), this means 2592 bytes per line but on the output frame I received 2624 bytes, this added 16 pixels as padding.

We are working with V4L2 utils.

I calculated that the padding is caused because 2592 is not a dividable by 64 but 2624 does.

I’m not sure about the origin of the 64 value, however, the stride alignment is defined here in the sources
as 1 I changed that values to 32 and the padding was removed, the output frames now have the correct size.

Why is that value defined as 1?

Is it safe to change the defined value to other values?

It solved my padding problem but I’m not sure if this will cause other problems that I have not detected. Could you provide any extra information/warning about changing that value?


Have a try preferred_stride by v4l2-ctl

v4l2-ctl -c preferred_stride=32
1 Like

Hi ShaneCCC,

Thanks, the command solved the padding.

Just an extra question, does this command also support other values like 16 and 8?

For the resolution and format we use (1296x1600 Y10) the stride value in 32 works perfectly, just wondering if this command also works for different resolutions and formats, example 1296x1600 GRAY, in that case 1296 is not dividable by 32 but it does by 16.


Looks like the min value should be 32 due to VI have 32 alignment design.

1 Like

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