Onboard Camera ov5693 - BG10 format

I am using v4l2 to get video from the onboard camera on the TX2 programatically. It seems that the camera only supports the “10-bit Bayer BGBG/GRGR” (BG10) pixel format, but when I set v4l2_pix_format to V4L2_PIX_FMT_SBGGR10 I don’t get that expected format

You may read this topic and further check your settings with qv4l2.

I am (and need) to capture the video programmatically not on the command line. I understand how I may be able to convert the 10 bit data to 8 bit fairly easily, but the data I am receiving does not match the format described by V4L2_PIX_FMT_SBGGR10. This format says “Each sample is stored in a 16-bit word, with 6 unused high bits filled with zeros” but I don’t see these unused high bits.

hello gcamp,

FYI, please refer to Topic 1038421 to apply kernel change for format code conversions bug.
thanks

Hi, i’ve faced the same behavior of onboard camera (Jetpack 4.2), qv4l2 recognizes onboard camera and settings as expected but preview window is black screen. My implementation shows some unexpected frame data (no 6 high bits available for pixel color (16 bit data)).
Please note that gst-launch-1.0 with nvarguscamera param works just fine.
Is this some kind of v4l related issue or workaround required?

Any suggestions to check what’s wrong?

hello itaowazard,

may I know what’s your sensor formats. you should dump the format by below commands.

$ v4l2-ctl -d /dev/video0 --list-formats-ext

please also access [Tegra X2 (Parker Series SoC) Technical Reference Manual] from https://developer.nvidia.com/embedded/downloads,
you should check [27.10.6 RAW Memory Formats] for details.
thanks

As expected BG10 10bit Bayer BGBG /GRGR

tnx, i’ll check it and post my question/answer if i need to

Hi, yep, that was “about” data format, never expected bits placed that way. Now it works (image with correct colors). Howether qv4l2 still doesn’t work (should it?)
Tnx.

hello itaowazard,

since qv4l2 is Qt v4l2 test utility, there might be some additional dependency.
suggest you could confirm the sensor streaming with v4l2 standard controls,
for example,

$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100

you might also check Multimedia API Sample Applications for the samples to demonstrate.
thanks

Hello JerryChang,

tnx for advice, i’ll check it!!