This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: Monochrome data getting failed with GRAY16_LE format

Part Number: SK-AM62A-LP

Tool/software:

Hello Team,

We are using monochrome sensor which is giving Y10 data. We have successfully set media-ctl command to set pipeline topology for Y10 data.
Using below gst-pipeline we are trying to capture video data using format= GRAY16_LE but, we are getting failed.

Pipeline log:

gst-Pipeline:
=============

root@am62axx-evm:/data#
root@am62axx-evm:/data# gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-raw, width=1920, height=1200, framerate=120/1, format=GRAY16_LE ! fakesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../gstreamer-1.20.7/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000785529
Setting pipeline to NULL ...
Freeing pipeline ...
root@am62axx-evm:/data#
root@am62axx-evm:/data#
root@am62axx-evm:/data#



- Here, we want to convert monochrome data in to JPEG using JPEG hardware encoder which is not possible directly as jpeg encoder is only supporting NV12 format as input. So we need to convert this Y10 data to NV12 using "videoconvert" plugin which accept the data in "GRAY16_LE" format and provide NV12 output.

But as per above output we are not able to get data when use format as GRAY16_LE. If we use RGGB10 format as below command then we are able to get 10 bit image data but here "videoconvert" plugin will not accept the bayer data.

Working pipeline:

gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-bayer, width=1920, height=1200, framerate=120/1, format=rggb10 ! fakesink


Please let us know why above pipeline is not working.

Note: We don't want to process data from the ISP to reduce image output latency.

Media-ctl log:



Media-ctl log:

===============

root@am62axx-evm:/data# media-ctl -p
Media controller API version 6.1.46

Media device information
------------------------
driver          j721e-csi2rx
model           TI-CSI2RX
serial
bus info        platform:30102000.ticsi2rx
hw revision     0x1
driver version  6.1.46

Device topology
- entity 1: 30102000.ticsi2rx (7 pads, 7 links, 1 route)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        routes:
                0/0 -> 1/0 [ACTIVE]
        pad0: Sink
                [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
        pad2: Source
                -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
        pad3: Source
                -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
        pad4: Source
                -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
        pad5: Source
                -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
        pad6: Source
                -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]

- entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 1 route)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        routes:
                0/0 -> 1/0 [ACTIVE]
        pad0: Sink
                [stream:0 fmt:Y10_1X10/1920x1200 field:none]
                <- "ar0235 4-0036":0 [ENABLED,IMMUTABLE]
        pad1: Source
                [stream:0 fmt:Y10_1X10/1920x1200 field:none]
                -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
        pad2: Source
        pad3: Source
        pad4: Source

- entity 15: ar0235 4-0036 (1 pad, 1 link, 0 route)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev2
        pad0: Source
                [stream:0 fmt:Y10_1X10/1920x1200 field:none]
                -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]

- entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video3
        pad0: Sink
                <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]

- entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video4
        pad0: Sink
                <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]

- entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video5
        pad0: Sink
                <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]

- entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video6
        pad0: Sink
                <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]

- entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video7
        pad0: Sink
                <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]

- entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
             type Node subtype V4L flags 0
             device node name /dev/video8
        pad0: Sink
                <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]

root@am62axx-evm:/data#
root@am62axx-evm:/data#




Thanks,
Jaimin

  • Hi Jaimin,

    Could you share the output of v4l2-ctl -d /dev/video-rpi-cam0 --list-formats-ext?

    Since its Y10 format, does this below pipeline work with jpeg encoding:

    gst-launch-1.0 v4l2src device=/dev/video-rpi-cam0 num-buffers=1 ! "video/x-raw, format=(string)Y10, width=(int)1920, height=(int)1200, framerate=(fraction)30/1" ! videoconvert ! v4l2jpegenc ! filesink location=cam0.jpg

    Also I found this thread on raspberrypi forums, not sure if its still valid:

    https://forums.raspberrypi.com/viewtopic.php?t=312196

    Best Regards,

    Suren

  • Hello Suren,

    Thanks for reply.

    output of command : v4l2-ctl -d /dev/video-rpi-cam0 --list-formats-ext

    root@am62axx-evm:/data#
    root@am62axx-evm:/data# v4l2-ctl -d /dev/video-rpi-cam0 --list-formats-ext
    ioctl: VIDIOC_ENUM_FMT
            Type: Video Capture
    
            [0]: 'YUYV' (YUYV 4:2:2)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [1]: 'UYVY' (UYVY 4:2:2)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [2]: 'YVYU' (YVYU 4:2:2)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [3]: 'VYUY' (VYUY 4:2:2)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [4]: 'BA81' (8-bit Bayer BGBG/GRGR)
                    Size: Stepwise 16x1 - 16384x16384 with step 16/1
            [5]: 'GBRG' (8-bit Bayer GBGB/RGRG)
                    Size: Stepwise 16x1 - 16384x16384 with step 16/1
            [6]: 'GRBG' (8-bit Bayer GRGR/BGBG)
                    Size: Stepwise 16x1 - 16384x16384 with step 16/1
            [7]: 'RGGB' (8-bit Bayer RGRG/GBGB)
                    Size: Stepwise 16x1 - 16384x16384 with step 16/1
            [8]: 'BG10' (10-bit Bayer BGBG/GRGR)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [9]: 'GB10' (10-bit Bayer GBGB/RGRG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [10]: 'BA10' (10-bit Bayer GRGR/BGBG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [11]: 'RG10' (10-bit Bayer RGRG/GBGB)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [12]: 'BG12' (12-bit Bayer BGBG/GRGR)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [13]: 'GB12' (12-bit Bayer GBGB/RGRG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [14]: 'BA12' (12-bit Bayer GRGR/BGBG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [15]: 'RG12' (12-bit Bayer RGRG/GBGB)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [16]: 'RGI0' (10-bit Bayer RGBG/GIrGIr)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [17]: 'GRI0' (10-bit Bayer GRGB/IrGIrG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [18]: 'BGI0' (10-bit Bayer BGRG/GIrGIr)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [19]: 'GBI0' (10-bit Bayer GBGR/IrGIrG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [20]: 'GIR0' (10-bit Bayer GIrGIr/RGBG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [21]: 'IGR0' (10-bit Bayer IrGIrG/GRGB)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [22]: 'GIB0' (10-bit Bayer GIrGIr/BGRG)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [23]: 'IGB0' (10-bit Bayer IrGIrG/GBGR)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
            [24]: 'GREY' (8-bit Greyscale)
                    Size: Stepwise 16x1 - 16384x16384 with step 16/1
            [25]: 'Y10 ' (10-bit Greyscale)
                    Size: Stepwise 8x1 - 8192x16384 with step 8/1
    root@am62axx-evm:/data#
    root@am62axx-evm:/data#
    root@am62axx-evm:/data#

    Log as per your pipeline:


    root@am62axx-evm:/data#
    root@am62axx-evm:/data# gst-launch-1.0 v4l2src device=/dev/video-rpi-cam0 num-buffers=1 ! "video/x-raw, format=(string)Y10, width=(int)1920, height=(int)1200, framerate=(fraction)30/1" ! videoconvert ! v4l2jpegenc ! filesink location=cam0.jpg
    WARNING: erroneous pipeline: could not link v4l2src0 to videoconvert0, neither element can handle caps video/x-raw, format=(string)Y10, width=(int)1920, height=(int)1200, framerate=(fraction)30/1
    root@am62axx-evm:/data#
    root@am62axx-evm:/data#



    As,  v4l2src doesn't support Y10 format. which we confirmed with gst-inspect.
    It's supporting  GRAY8,GRAY16_LE and GRAY16_BE.

    Thanks,
    Jaimin

  • Hello Suren,

    Any update on it ?

    Thanks,
    Jaimin

  • Hi Jaimin,

    Did you try the setup that was mentioned in Raspberry Pi forums on making the changes for GRAY16_LE in the driver and padding 0's in the MSBs  as you 

    requesting Y10. as shown below

    Best Regards,

    Suren