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.

AM62A7: OV5640: Streaming issue

Part Number: AM62A7


Hi,

Currently I'm working with SDK_09_01_00_07 and I'm trying to stream OV5640 camera using below command.

gst-launch-1.0 v4l2src device=/dev/video-ov5640-cam0 io-mode=5 ! video/x-raw,width=1280,height=720,format=UYVY ! kmssink driver-name=tidss sync=false

But while streaming the color format is not proper.
Is there any additional pluggins to be used in new SDK ?

Regards,
Sushmitha K

  • Hi Sushmitha,

    Can you add tiovxldc plugin before kmssink and see if it helps. Also, you can add videoconvert to see if you are able to view the captured content on display.

    Best Regards,

    Suren

  • Hi Sushmitha,

    Looks like there are some issues with running OV5640 at formats other than the default 640x480 on AM62A EVM. Can you try the following:

    1. edit script /opt/edgeai-gst-apps/scripts/setup_cameras.sh and comment out setup_ov5640 as shown below:

    setup_USB_camera
    setup_imx219
    #setup_ov5640
    setup_ov2312
    setup_imx390
    setup_routes
    

    2. reboot the EVM and run streaming with default 640x480:

    gst-launch-1.0 v4l2src device="/dev/video3" ! video/x-raw, width=640, height=480 ! kmssink driver-name=tidss

    I'll be investigating why other formats are not working.

    Regards,

    Jianzhong

  • Hi @Suren Porwar,

    Added tiovxldc pluggin before kmssink and tested. Still the color format of video stream is not proper.

    Regads,
    Sushmitha K

  • Hi @Jianzhong Xu,

    We are using the default resolution for testing

    Regards,
    Sushmitha K

  • Hi Sushmitha K,

    Is the default resolution working for you?

    Also, which camera module you're using? It seems that not every OV5640 camera module available on the market works for all the resolutions: https://lore.kernel.org/all/2wjwwyg2y42vse6vj6376vzruieb4c7e6ruw5de4ivc42bonvz@jmruiyfr4wo4/.

    I've verified that the TechNexion OV5640 camera works fine for all resolutions.

    Regards,

    Jianzhong

  • Hi @Jianzhong Xu,

    We have tested OV5640 camera streaming in SDK_09.00.01.03 and it is worked fine for us.
    But in SDK_09_01_00_07 while testing camera streaming color format is not proper

    Regards,
    Sushmitha K

  • Hello Sushmitha K,

    Would you mind sharing a picture from the camera capture? I want to make sure we're talking about the same issue.

    Is your ov5640 camera working fine with SDK 9.0 for 1920x1080 and 2592x1944?

    Regards,

    Jianzhong

  • Hi @Jianzhong Xu,

    We have tested ov5640 camera streaming using 1920x1080,640x480,720x480 these resolutions streaming and video capture worked fine. But image capture was giving the color format issue.

    In 1280x720 and 2592x1944 resolutions camera streaming itself giving the color format issue. While streaming, the video will come in green color(color format) as below.



    Regards,
    Sushmitha K

  • Hello Sushmitha K,

    This is different from what I saw with the non-working OV5640 cameras.

    Which OV5640 camera module are you using?

    Would you mind testing it on SDK 9.0 and sharing the result?

    https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-AM62X/09.00.00.03

    Regards,

    Jianzhong

  • Hi @Jianzhong Xu,

    I have tested same camera with SDK 9.0 and there it was working fine.
    Issue has been seen only in SDK_9.1

    Regards,
    Sushmitha K

  • Hi Sushmitha,

    Ok. I've seen the same issue with 9.1 on my end. Let me work with the SW team to investigate on this. I'll get back to you early next week.

    Regards,

    Jianzhong

  • Hi Sushmitha, Jianzhong,

    Can you share the exact gstreamer command you are running? Are you specifying UYVY format in the pipeline?

    On my setup, if I run the previously shared command to capture on default resolution (640x480) without any changes to media-ctl to change resolution and formats, I see the same issue:

    gst-launch-1.0 v4l2src device="/dev/video3" ! video/x-raw, width=640, height=480 ! kmssink driver-name=tidss sync=false plane-properties=s,zpos=1


    This is because gstreamer uses YUYV pixelformat by default, so here the camera sensor and CSI subdevs are configured for UYVY but video node is configured for YUYV, leading to wrong colors. (There was a bug in 9.0 which set wrong output CSI formats, that accidently made wrong pipelines work)

    If instead I specify "format=UYVY" in the gstreamer pipeline, it shows correct colors:

    gst-launch-1.0 v4l2src device="/dev/video3" ! video/x-raw, width=640, height=480, format=UYVY ! kmssink driver-name=tidss sync=false plane-properties=s,zpos=1

    Hope this helps.

    Thanks,
    Jai

  • Alternatively, you can use libcamerasrc plugin in Gstreamer to change both format/resolution correctly to whatever is specified in GST pipeline, without running any media-ctl commands. Example for 1024x768 UYVY:

    gst-launch-1.0 libcamerasrc ! video/x-raw, width=1024, height=768, format=UYVY ! kmssink driver-name=tidss sync=false plane-properties=s,zpos=1
    


    software-dl.ti.com/.../CSI2RX.html

  • Thanks Jai for the advice.

    On my setup (AM62A EVM + TEVI-OV5640) and running with SDK 9.1, the default format is YUYV8_1X16/1280x720:

    CSI Camera 0 detected
        device = /dev/video-ov5640-cam0
        name = ov5640
        format = [fmt:YUYV8_1X16/1280x720@1/30]
        subdev_id = /dev/v4l-ov5640-subdev0
        isp_required = no
    

    root@am62axx-evm:~# 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:YUYV8_1X16/1280x720 colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
    <- "ov5640 4-003c":0 [ENABLED,IMMUTABLE]
    pad1: Source
    [stream:0 fmt:YUYV8_1X16/1280x720 colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    pad2: Source
    pad3: Source
    pad4: Source
    
    - entity 15: ov5640 4-003c (1 pad, 1 link, 0 route)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev2
    pad0: Source
    [stream:0 fmt:YUYV8_1X16/1280x720@1/30 colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range
    crop.bounds:(0,0)/2624x1964
    crop:(0,250)/2624x1456]
    -> "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]

    I was able to stream using the following pipeline:

    root@am62axx-evm:~# gst-launch-1.0 v4l2src device=/dev/video-ov5640-cam0 ! video/x-raw, width=1280, height=720 ! kmssink driver-name=tidss sync=false

    Regards,

    Jianzhong