How to capture YVYU, YUYV and RGB888

Hi Team,

We have a carrier card with SD820 SOM, we have OV5645 camera sensor connected to the
csi-phy0 interface.

  • I am able to successfully capture UYVY format from the sensor and the media-ctl configuration is as below :

sudo media-ctl -d /dev/media0 -l ‘“msm_csiphy0”:1->“msm_csid0”:0[1],“msm_csid0”:1->“msm_ispif0”:0[1],“msm_ispif0”:1->“msm_vfe0_rdi0”:0[1]’

sudo media-ctl -d /dev/media0 ‘“ov5645 4-003c”:0[fmt:UYVY8_2X8/1920x1080 field:none],“msm_csiphy0”:0[fmt:UYVY8_2X8/1920x1080 field:none],“msm_csid0”:0[fmt:UYVY8_2X8/1920x1080 field:none],“msm_ispif0”:0[fmt:UYVY8_2X8/1920x1080 field:none],“msm_vfe0_rdi0”:0[fmt:UYVY8_2X8/1920x1080 field:none]’

gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! ‘video/x-raw,format=UYVY,width=1920,height=1080’ ! jpegenc ! filesink location=image01.jpg


  • Again, When I try to capture YUYV format image using the commands below, it is failing :

sudo media-ctl -d /dev/media0 -l ‘“msm_csiphy0”:1->“msm_csid0”:0[1],“msm_csid0”:1->“msm_ispif0”:0[1],“msm_ispif0”:1->“msm_vfe0_rdi0”:0[1]’

sudo media-ctl -d /dev/media0 ‘“ov5645 4-003c”:0[fmt:YUYV8_2X8/1920x1080 field:none],“msm_csiphy0”:0[fmt:YUYV8_2X8/1920x1080 field:none],“msm_csid0”:0[fmt:YUYV8_2X8/1920x1080 field:none],“msm_ispif0”:0[fmt:YUYV8_2X8/1920x1080 field:none],“msm_vfe0_rdi0”:0[fmt:YUYV8_2X8/1920x1080 field:none]’

gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! ‘video/x-raw,format=YUYV,width=1920,height=1080’ ! jpegenc ! filesink location=image01.jpg


  • Similarly for the YVYU format, it is failing with the below configurations and command :

sudo media-ctl -d /dev/media0 -l ‘“msm_csiphy0”:1->“msm_csid0”:0[1],“msm_csid0”:1->“msm_ispif0”:0[1],“msm_ispif0”:1->“msm_vfe0_rdi0”:0[1]’

sudo media-ctl -d /dev/media0 ‘“ov5645 4-003c”:0[fmt:YVYU8_2X8/1920x1080 field:none],“msm_csiphy0”:0[fmt:YVYU8_2X8/1920x1080 field:none],“msm_csid0”:0[fmt:YVYU8_2X8/1920x1080 field:none],“msm_ispif0”:0[fmt:YVYU8_2X8/1920x1080 field:none],“msm_vfe0_rdi0”:0[fmt:YVYU8_2X8/1920x1080 field:none]’

gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! ‘video/x-raw,format=YVYU,width=1920,height=1080’ ! jpegenc ! filesink location=image01.jpg

Kindly let me know if anything has to be changed in the commands to capture the image in
YUYV format and YVYU format. Also would be great if u tell how to capture RGB888 format too.

Regards,
Shiva Shankar K.

@Loic
@danielt

Is the ov5645 supports YVYU8_2X8? the RDI interface (raw) only forward what is output from the sensor. You should be howver able to convert UYVY8_2X8 to YVYU8_2X8 in hardware going through the ‘pix’ interface.

AFAIR, this is what I’ve used with an ov5640:

media-ctl --reset 

media-ctl -d /dev/media0 -l '"msm_csiphy0":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_pix":0[1]'

sudo media-ctl -d /dev/media0 -l '"msm_csiphy0":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_pix":0[1]'
sudo media-ctl -d /dev/media0 -V '"ov5640 4-0076":0[fmt:UYVY8_2X8/640x480 field:none]'
sudo media-ctl -d /dev/media0 -V '"msm_csiphy0":0[fmt:UYVY8_2X8/640x480 field:none]'
sudo media-ctl -d /dev/media0 -V '"msm_csid0":0[fmt:UYVY8_2X8/640x480 field:none]'
sudo media-ctl -d /dev/media0 -V '"msm_ispif0":0[fmt:UYVY8_2X8/640x480 field:none]'
sudo media-ctl -d /dev/media0 -V '"msm_vfe0_pix":0[fmt:UYVY8_2X8/640x480 field:none]'
sudo media-ctl -d /dev/media0 -V '"msm_vfe0_pix":1[fmt:YUYV8_2X8/640x480 field:none]'

gst-launch-1.0 v4l2src device=/dev/video3 ! video/x-raw,format=NV16,width=640,height=480 ! videoconvert ! jpegenc ! filesink location=image_640x480.jpg

Yes, I have referred the same ov5640 data sheet for ov5645 sensor, I am not sure about the device ov5640 supporting the YVYU format although it is mentioned in the ov5640 datsheet page no. 86 .

Despite changing the sensor to generate YVYU by changing the 0x4300 register value to 0x31, I am still using the UYVY format in the media-ctl configuration to capture the image, still I can capture the image but with more green component. The capture fails only when I change the media-ctl configuration to the exact format YVYU.

Kindly let me know at least to capture RGB888 format.

Regards,
Shiva Shankar K.

Hi Team,

Kindly let me know how to capture the RGB888 format.

Regards,
Shiva Shankar K.

have you tried similar pipeline to me with hardware conversion using the pix interface?

Yes, I did try your suggested commands above but it failed, I will share the log tomorrow. Our requirement now is to capture RGB888 so I am focusing on RGB88 capture.

Please find the log when I tried for hardware conversion using the pix interface.
It is getting stuck after “New clock: GstSystemClock”

root@820-devkit:/home/mistral/Desktop/uyvy# media-ctl --reset
root@820-devkit:/home/mistral/Desktop/uyvy# media-ctl -d /dev/media0 -l ‘“msm_csiphy0”:1->“msm_csid0”:0[1],“msm_csid0”:1->“msm_ispif0”:0[1],“msm_ispif0”:1->“msm_vfe0_pix”:0[1]’
root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -l ‘“msm_csiphy0”:1->“msm_csid0”:0[1],“msm_csid0”:1->“msm_ispif0”:0[1],“msm_ispif0”:1->“msm_vfe0_pix”:0[1]’

root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -V ‘“ov5645 5-003c”:0[fmt:UYVY8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -V ‘“msm_csiphy0”:0[fmt:UYVY8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -V ‘“msm_csid0”:0[fmt:UYVY8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -V ‘“msm_ispif0”:0[fmt:UYVY8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# sudo media-ctl -d /dev/media0 -V ‘“msm_vfe0_pix”:0[fmt:UYVY8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# [ 1036.078829] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
sudo media-ctl -d /dev/media0 -V ‘“msm_vfe0_pix”:1[fmt:YUYV8_2X8/1920x1080 field:none]’
root@820-devkit:/home/mistral/Desktop/uyvy# gst-launch-1.0 v4l2src device=/dev/video3 ! video/x-raw,format=NV16,width=1920,height=1080 ! videoconvert ! jpegenc ! filesink location=image_640x480.jpg
[ 1044.699941] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.702471] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.708532] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.868069] qcom-camss a34000.camss: CSIPHY 3PH HW Version = 0x10000000
[ 1044.868709] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.876793] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.880418] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.886286] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1044.892253] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.216267] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.217648] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.223940] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.385340] qcom-camss a34000.camss: CSIPHY 3PH HW Version = 0x10000000
[ 1045.385845] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.393813] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.397593] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.403340] qcom-camss a34000.camss: VFE HW Version = 0x70020000
[ 1045.409496] qcom-camss a34000.camss: VFE HW Version = 0x70020000
Setting pipeline to PAUSED …
[ 1045.610154] qcom-camss a34000.camss: CSIPHY 3PH HW Version = 0x10000000
[ 1045.610616] qcom-camss a34000.camss: VFE HW Version = 0x70020000
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock

Hi Loic,

Please let me know if you need any thing further.

Regards,
Shiva Shankar K.

@Loic
@danielt

The sensor does not seem to support this format, and the driver only support UYVY8_2X8 so you’ll have to convert in software.

Hi Loic,

Thanks for your response.

I am a bit surprised to know this, anyway please tell me if we can capture images in YUYV or YVYU format from ov5645 sensor, because when I tried these two formats, I have gotten more of greenish images without any pipeline errors.

I could not attach the images here for your reference.

Regards,
Shiva Shankar K.