Camera¶
Testing MIPI-CSI2 cameras¶
Camera Probe¶
Run the following command to see if you have the camera(s) detected
This should produce the following output
j721e-csi2rx (platform:30102000.ticsi2rx):
/dev/video2
/dev/video3
/dev/video4
/dev/video5
/dev/video6
/dev/video7
/dev/media0
wave5-dec (platform:30210000.video-codec):
/dev/video0
/dev/video1
The camera interface is /dev/video2
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/AM62PX/10_01_10_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Camera/CSI2RX.html?highlight=media%20ctl
The pipeline is configured individually by the user-space application.
At a minimum, the pixel format, resolution, and framerate must be configured:
After configuring the pipeline, it can be confirmed by reading it back:
The following examples show how to preview the camera on the display for different resolutions:
- VGA 640x480@30fps:
cam -c1 --stream width=640,height=480,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=640, height=480, format=UYVY ! autovideosink
- NTSC 480p 720x480@30fps:
cam -c1 --stream width=720,height=480,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=720, height=480, format=UYVY ! autovideosink
- HD 720p 1280x720@30fps:
cam -c1 --stream width=1280,height=720,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=1280, height=720, format=UYVY ! autovideosink
- Full HD 1080p 1920x1080@15fps:
cam -c1 --stream width=1920,height=1080,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=1920, height=1080, format=UYVY ! autovideosink
- Full HD 1080p 1920x1080@30fps:
cam -c1 --stream width=1920,height=1080,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=1920, height=1080, format=UYVY ! autovideosink
- QSXGA 1944p 2592x1944@15fps:
cam -c1 --stream width=2592,height=1944,pixelformat=UYVY -C1
gst-launch-1.0 v4l2src device="/dev/video2" ! video/x-raw, width=2592, height=1944, format=UYVY ! autovideosink
Testing Camera Preview on Display using libcamera¶
Using libcamera the pipeline configuration is no need.
The following examples show how to preview the camera on the display for different resolutions:
- VGA 640x480@30fps:
- NTSC 480p 720x480@30fps:
- HD 720p 1280x720@30fps:
- Full HD 1080p 1920x1080@15fps:
- Full HD 1080p 1920x1080@30fps:
- QSXGA 1944p 2592x1944@15fps:
Testing Camera JPEG Snapshot¶
To capture JPEG snapshot run one of the pipelines below depending upon the required picture resolution.
- VGA 640x480:
cam -c1 --stream width=640,height=480,pixelformat=UYVY -C1
yavta -c1 -n5 -Fframe.raw -s 640x480 -f UYVY /dev/video2
ffmpeg -f rawvideo -pixel_format uyvy422 -video_size 640x480 -i frame.raw -frames:v 1 test_640x480.jpg
rm frame.raw
- NTSC 480p 720x480:
cam -c1 --stream width=720,height=480,pixelformat=UYVY -C1
yavta -c1 -n5 -Fframe.raw -s 720x480 -f UYVY /dev/video2
ffmpeg -f rawvideo -pixel_format uyvy422 -video_size 720x480 -i frame.raw -frames:v 1 test_720x480.jpg
rm frame.raw
- HD 720p 1280x720:
cam -c1 --stream width=1280,height=720,pixelformat=UYVY -C1
yavta -c1 -n5 -Fframe.raw -s 1280x720 -f UYVY /dev/video2
ffmpeg -f rawvideo -pixel_format uyvy422 -video_size 1280x720 -i frame.raw -frames:v 1 test_1280x720.jpg
rm frame.raw
- Full HD 1080p 1920x1080:
cam -c1 --stream width=1920,height=1080,pixelformat=UYVY -C1
yavta -c1 -n5 -Fframe.raw -s 1920x1080 -f UYVY /dev/video2
ffmpeg -f rawvideo -pixel_format uyvy422 -video_size 1920x1080 -i frame.raw -frames:v 1 test_1920x1080.jpg
rm frame.raw
- QSXGA 1944p 2592x1944: