Unable to Capture Frames in GREY Format with IMX219 on L4T

Jetpack: 6.2.2

L4T: 35.5

Hello,

I am trying to capture 8-bit grayscale frames from an IMX219 camera on L4T.

To add GREY format support, I modified the following files:

  • camera_common.c
  • imx219_mode_tbls.h
  • nv_imx219.c
  • sensor_common.c
  • tegra234-camera-rbpcv2-imx219.dtsi
  • vi5_formats.h

After making these changes, I rebuilt the relevant kernel modules and device tree files. I also updated extlinux.conf so that the newly generated DTB and DTBO files would be loaded during boot.

After rebooting and connecting the camera, I checked the supported formats and confirmed that the GREY format was listed and recognized by V4L2.

However, when I try to capture frames using the following command, no frames are received:

v4l2-ctl -d /dev/video0 \
  --set-fmt-video=width=1280,height=720,pixelformat=GREY \
  --set-ctrl bypass_mode=0 \
  --stream-mmap \
  --stream-count=150 \
  --stream-to=test.raw \
  --verbose

The capture process starts, but test.raw does not contain any valid frame data.

My goal is to receive 1280 × 720 8-bit grayscale frames directly from the camera.

Could you please advise which parts of the sensor driver, VI format configuration, media-bus format, or device tree configuration should be checked?

Thanks for the detailed context. The GREY format being recognized by V4L2 but failing to capture valid frame data suggests a data flow break in the camera pipeline—likely in media-bus format negotiation, VI format configuration, or device tree binding.

To diagnose this, please provide:

  1. Kernel logs (dmesg) from the time of the capture attempt, especially any VI or camera-related errors or warnings.
  2. Full verbose output from your v4l2-ctl command (add --verbose flag if not already present).
  3. Device tree validation: Confirm that the media-bus format is correctly defined in tegra234-camera-rbpcv2-imx219.dtsi and matches your VI format configuration.
  4. Format mapping confirmation: Verify that the GREY format pixel format code is correctly mapped in vi5_formats.h and your sensor driver modifications.
  5. VI debug status: Check /sys/kernel/debug/tegra_vi for any error codes or status information from the capture process.

Once you share these details, we can pinpoint which component in the pipeline is dropping the frame data.

Does IMX219 support GREY format?

Based on my test, it is possible to receive GREY-format frames when using the IMX219 on JetPack 5.1.4 and L4T 35.6.0.

I would also like to achieve the same result with the following versions:

JetPack: 6.2.2
L4T: 35.5

Below is the result when I run the following command:

v4l2-ctl -d /dev/video0 \
  --set-fmt-video=width=6144,height=193,pixelformat=GREY \
  --set-ctrl bypass_mode=0 \
  --stream-mmap \
  --stream-count=150 \
  --stream-to=test.raw \
  --verbose

In this state, no output or further progress occurs.

Format Video Capture:
Width/Height : 6144/193
Pixel Format : ‘GREY’ (8-bit Greyscale)
Field : None
Bytes per Line : 6144
Size Image : 1185792
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :

IMX219 natively outputs RAW10/RAW12 Bayer data, not true grayscale. A GREY V4L2 format requires the ISP to demosaic or at least extract one color plane, or the sensor driver to expose a monochrome interpretation. If you added GREY to the format list without an ISP pipeline, you will see the format enumerated but no valid frames.

Things to check:

1. Media-bus format. In tegra234-camera-rbpcv2-imx219.dtsi, the port bus-format must match what the VI expects. For GREY you likely need MEDIA_BUS_FMT_Y8_1X8, not the RAW10/RAW12 default.

2. VI format mapping. vi5_formats.h needs a mapping from the media-bus code to T_R8 or the appropriate VI surface format. Missing or mismatched mappings often cause silent no-frame behavior.

3. ISP involvement. On Jetson, GREY usually goes through nvargus / ISP. If you are using V4L2 directly, you may need to use the Camera Core stack or configure a custom ISP override.

4. Sensor driver. imx219_mode_tbls.h and nv_imx219.c must report a mode whose output can be interpreted as 8-bit. If the sensor is still streaming RAW10, the VI will not produce GREY.

A faster path: instead of modifying the kernel, capture RAW10 and do the grayscale conversion in userspace with nvargus or a CUDA kernel. That avoids the device-tree/sensor-driver format plumbing entirely and is usually performant enough for 8-bit output.