Skip to content

Camera

Testing Variscite MIPI Cameras

Camera Probe

Make sure the camera is connected, then boot the board and verify the camera was detected:

v4l2-ctl --list-devices

Example output:

i.MX6S_CSI (platform:30710000.csi):
        /dev/video1

pxp (pxp_v4l2_out):
        /dev/video0

In this output, i.MX6S_CSI is the camera interface, and pxp is the i.MX Pixel Processing Pipeline.

i.MX Platform-Specific GStreamer Plugins

Verify that the i.MX7 platform-specific GStreamer plugins are installed:

gst-inspect-1.0 | grep "imx"

Expected output includes:

imxpxp:  imxpxpvideotransform: Freescale PxP video transform
imxpxp:  imxpxpvideosink: Freescale PxP video sink
imxv4l2videosrc:  imxv4l2videosrc: V4L2 CSI Video Source
imxaudio:  imxmp3audioenc: Freescale i.MX MP3 encoder
imxaudio:  imxuniaudiodec: Freescale i.MX uniaudio decoder

GStreamer Example 1: Camera Preview on the Display

The pipelines below are suitable for the Debian Bookworm release for VAR-SOM-MX7.

For 640x480 at 30 fps:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=0 ! imxpxpvideosink

For 720x480 at 30 fps:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=1 ! imxpxpvideosink

For 1280x720 at 30 fps:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=2 ! imxpxpvideosink

For 1920x1080 at 30 fps:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=3 ! imxpxpvideosink

For 2592x1944 at 15 fps:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=4 ! imxpxpvideosink

GStreamer Example 2: JPEG Snapshot

Capture and encode a JPEG snapshot from the camera with the pipeline matching the required resolution.

For 640x480:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 num-buffers=1 imx-capture-mode=0 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

For 720x480:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 num-buffers=1 imx-capture-mode=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

For 1280x720:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 num-buffers=1 imx-capture-mode=2 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

For 1920x1080:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 num-buffers=1 imx-capture-mode=3 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

For 2592x1944:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 num-buffers=1 imx-capture-mode=4 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

References