From Variscite Wiki

1 Testing MIPI-CSI2 and parallel CSI cameras

Make sure you have the camera(s) connected to the board before booting it and running any of the pipelines below .
The i.MX family of SOCs uses gstreamer as a multimedia framework. Please refer to

1.1 Camera Probe

Run the following command to list the detected camera devices:

# v4l2-ctl --list-devices

This should produce the following output:

# v4l2-ctl --list-devices
vpu B0 (platform:):

mxc-isi (platform:58100000.isi.0):

mxc-isi (platform:58140000.isi.4):

mxc-jpeg decoder (platform:58400000.jpegdec):

mxc-jpeg decoder (platform:58450000.jpegenc):

There are two cameras accessible as /dev/video0 and /dev/video1.
The first one is a MIPI-CSI2 camera attached to the VAR-EXT-CB8 expansion board, and the second one is a parallel CSI camera attached to the VCAM-5640P expansion board.

1.2 Testing Camera Preview on Display

In the examples below /dev/video1 can be used instead of /dev/video0 on boards with 2 cameras.

  • 480p (640x480):
# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480 ! autovideosink sync=false
  • NTSC (720x480):
# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=720,height=480 ! autovideosink sync=false
  • 720p (1280x720):
# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720 ! autovideosink sync=false
  • 1080p (1920x1080):
# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080 ! autovideosink sync=false
  • QSXGA (2592x1944):
# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=2592,height=1944 ! autovideosink sync=false
Note: The parallel camera maximal frame rate at the 1920x1080 and 2592x1944 resolutions is 7.5fps

1.3 Testing Camera JPEG Snapshot

To capture a JPEG snapshot run one of the pipelines below, depending upon the required picture resolution.
In the examples below /dev/video1 can be used instead of /dev/video0 on boards with 2 cameras.

  • 480p (640x480):
# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=640,height=480   ! jpegenc ! filesink location=/tmp/test.jpg
  • NTSC (720x480):
# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=720,height=480   ! jpegenc ! filesink location=/tmp/test.jpg
  • 720p (1280x720):
# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1280,height=720  ! jpegenc ! filesink location=/tmp/test.jpg
  • 1080p (1920x1080):
# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1920,height=1080 ! jpegenc ! filesink location=/tmp/test.jpg
  • QSXGA (2592x1944):
# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=2592,height=1944 ! jpegenc ! filesink location=/tmp/test.jpg

1.4 Using 2 cameras simultaneously

The following pipeline is an example of using 2 cameras simultaneously.
In this example a short video stream from each camera is saved as an MJPEG-encoded AVI file.

# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=100 ! video/x-raw,width=1920,height=1080 ! jpegenc ! avimux ! filesink location=./test0.avi \
                 v4l2src device=/dev/video1 num-buffers=100 ! video/x-raw,width=1920,height=1080 ! jpegenc ! avimux ! filesink location=./test1.avi