AM6 CSI: Difference between revisions
Line 34: | Line 34: | ||
After configuring the pipeline, it can be confirmed by reading it back: | After configuring the pipeline, it can be confirmed by reading it back: | ||
# media-ctl --get-v4l2 '"ov5640 0-003c":0' | # media-ctl --get-v4l2 '"ov5640 0-003c":0' | ||
The following examples show how to preview the camera on the display for different resolutions: | |||
{{AM62_CAM_PREVIEW|/dev/video0|VGA|640|480|30}} | {{AM62_CAM_PREVIEW|/dev/video0|VGA|640|480|30}} |
Revision as of 19:20, 1 May 2023
This page is using the default release am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
Testing MIPI-CSI2 cameras
Before running any of the pipelines below make sure you have camera(s) connected. AM6 family of processors uses gstreamer as multimedia framework. Please refer to https://gstreamer.freedesktop.org/
Camera Probe
Run the following command to see if you have the camera(s) detected
# v4l2-ctl --list-devices
This should produce the following output
j721e-csi2rx (platform:30102000.ticsi2rx): /dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/media0
The camera interface is /dev/video0
Testing Camera Preview on Display
The driver is implemented using V4L2’s Media Controller (MC) API. In the MC API, each element in the media pipeline is configured individually by the user-space application. For more information, see: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_06_00_42/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Camera/CSI2RX.html?highlight=media%20ctl
At a minimum, the pixel format, resolution, and framerate must be configured:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:<format>/<resolution>@1/<framerate>]'
After configuring the pipeline, it can be confirmed by reading it back:
# media-ctl --get-v4l2 '"ov5640 0-003c":0'
The following examples show how to preview the camera on the display for different resolutions:
- VGA 640x480@30fps:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/640x480@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1,format=YUY2 ! waylandsink sync=false
- NTSC 480p 720x480@30fps:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/720x480@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=720,height=480,framerate=30/1,format=YUY2 ! waylandsink sync=false
- HD 720p 1280x720@30fps:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/1280x720@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=30/1,format=YUY2 ! waylandsink sync=false
- Full HD 1080p 1920x1080@15fps:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/1920x1080@1/15]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,framerate=15/1,format=YUY2 ! waylandsink sync=false
- QSXGA 1944p 2592x1944@15fps:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/2592x1944@1/15]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=2592,height=1944,framerate=15/1,format=YUY2 ! waylandsink sync=false
Testing Camera JPEG Snapshot
To capture JPEG snapshot run one of the pipelines below depending upon the required picture resolution.
- VGA 640x480:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/640x480@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=5 ! video/x-raw,width=640,height=480 ! jpegenc ! multifilesink max-files=1 location=/tmp/test_640x480.jpg
- NTSC 480p 720x480:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/720x480@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=5 ! video/x-raw,width=720,height=480 ! jpegenc ! multifilesink max-files=1 location=/tmp/test_720x480.jpg
- HD 720p 1280x720:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/1280x720@1/30]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=5 ! video/x-raw,width=1280,height=720 ! jpegenc ! multifilesink max-files=1 location=/tmp/test_1280x720.jpg
- Full HD 1080p 1920x1080:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/1920x1080@1/15]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=5 ! video/x-raw,width=1920,height=1080 ! jpegenc ! multifilesink max-files=1 location=/tmp/test_1920x1080.jpg
- QSXGA 1944p 2592x1944:
# media-ctl --set-v4l2 '"ov5640 0-003c":0 [fmt:UYVY8_1X16/2592x1944@1/15]' # XDG_RUNTIME_DIR="/run/user/0" gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=5 ! video/x-raw,width=2592,height=1944 ! jpegenc ! multifilesink max-files=1 location=/tmp/test_2592x1944.jpg