Camera¶
Testing MIPI-CSI2 cameras¶
Before running any of the pipelines below, make sure you have camera(s) connected. The AM6 family of processors uses GStreamer as a multimedia framework. Please refer to https://gstreamer.freedesktop.org/
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/video0
/dev/video1
/dev/video2
/dev/video3
/dev/media0
The camera interface is /dev/video0
Testing Camera Preview on Display using libcamera framework¶
The following examples show how to preview the camera on the display for different resolutions:
- VGA 640x480@30fps:
XDG_RUNTIME_DIR=/run/user/$(id -u weston) WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 libcamerasrc camera-name=/base/bus@f0000/i2c@20000000/camera@3c ! video/x-raw,width=640,height=480, \
format=YUY2 ! waylandsink sync=false fullscreen=true &> /dev/null
- NTSC 480p 720x480@30fps:
XDG_RUNTIME_DIR=/run/user/$(id -u weston) WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 libcamerasrc camera-name=/base/bus@f0000/i2c@20000000/camera@3c ! video/x-raw,width=720,height=480, \
format=YUY2 ! waylandsink sync=false fullscreen=true &> /dev/null
- HD 720p 1280x720@30fps:
XDG_RUNTIME_DIR=/run/user/$(id -u weston) WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 libcamerasrc camera-name=/base/bus@f0000/i2c@20000000/camera@3c ! video/x-raw,width=1280,height=720, \
format=YUY2 ! waylandsink sync=false fullscreen=true &> /dev/null
- Full HD 1080p 1920x1080@30fps:
XDG_RUNTIME_DIR=/run/user/$(id -u weston) WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 libcamerasrc camera-name=/base/bus@f0000/i2c@20000000/camera@3c ! video/x-raw,width=1920,height=1080, \
format=YUY2 ! waylandsink sync=false fullscreen=true &> /dev/null
- QSXGA 1944p 2592x1944@15fps:
XDG_RUNTIME_DIR=/run/user/$(id -u weston) WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 libcamerasrc camera-name=/base/bus@f0000/i2c@20000000/camera@3c ! video/x-raw,width=2592,height=1944, \
format=YUY2 ! waylandsink sync=false fullscreen=true &> /dev/null
Testing Camera JPEG Snapshot¶
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'
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:YUYV8_1X16/640x480@1/30]'
XDG_RUNTIME_DIR=/run/user/$(id -u weston) 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:YUYV8_1X16/720x480@1/30]'
XDG_RUNTIME_DIR=/run/user/$(id -u weston) 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:YUYV8_1X16/1280x720@1/30]'
XDG_RUNTIME_DIR=/run/user/$(id -u weston) 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:YUYV8_1X16/1920x1080@1/15]'
XDG_RUNTIME_DIR=/run/user/$(id -u weston) 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: