IMX CSI
From Variscite Wiki
VAR-SOM-MX7 - Camera
Testing our MIPI cameras
Camera probe
Make sure the camera is connected, and boot the board.
Then, run the below command to verify the camera was detected successfully:
# v4l2-ctl --list-devices
This should output below
i.MX6S_CSI (platform:30710000.csi): /dev/video1 pxp (pxp_v4l2_out): /dev/video0
In the output seen above, "i.MX6S_CSI" is the camera, and "pxp" is the i.MX Pixel Processing Pipeline.
i.MX platform specific gstreamer plugins
Run below command to verify you have the i.MX7 platform specific gstreamer plugins installed on your system:
# gst-inspect-1.0 | grep "imx" imxcompositor: imxcompositor_pxp: IMX pxp Video Compositor imxmp3enc: imxmp3enc: imx mp3 audio encoder imxv4l2: imxv4l2sink: IMX Video (video4linux2) Sink imxv4l2: imxv4l2src: IMX Video (video4linux2) Source imxvideoconvert: imxvideoconvert_pxp: IMX pxp Video Converter
Gstreamer example 1: Testing Camera Loopback / Camera preview on the display
The below pipelines are suitable for the fslc based Yocto releases for the VAR-SOM-MX7 (Yocto Morty and newer).
- For 640x480@30fps:
# gst-launch-1.0 imxv4l2src device=/dev/video1 ! video/x-raw,width=640,height=480 ! imxv4l2sink
- For 720x480@30fps:
# gst-launch-1.0 imxv4l2src device=/dev/video1 ! video/x-raw,width=720,height=480 ! imxv4l2sink
- For 1280x720@30fps :
# gst-launch-1.0 imxv4l2src device=/dev/video1 ! video/x-raw,width=1280,height=720 ! imxv4l2sink
- For 1920x1080@30fps:
# gst-launch-1.0 imxv4l2src device=/dev/video1 ! video/x-raw,width=1920,height=1080 ! imxv4l2sink
- For 2592x1944@15fps:
# gst-launch-1.0 imxv4l2src device=/dev/video1 ! video/x-raw,width=2592,height=1944 ! imxv4l2sink
Gstreamer example 2: Taking a JPEG snapshot from the camera
To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution:
- For 640x480:
# gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=1 ! video/x-raw,width=640,height=480 ! jpegenc ! filesink location=/tmp/test.jpg
- For 720x480:
# gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=1 ! video/x-raw,width=720,height=480 ! jpegenc ! filesink location=/tmp/test.jpg
- For 1280x720:
# gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=1 ! video/x-raw,width=1280,height=720 ! jpegenc ! filesink location=/tmp/test.jpg
- For 1920x1080:
# gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=1 ! video/x-raw,width=1920,height=1080 ! jpegenc ! filesink location=/tmp/test.jpg
- For 2592x1944:
# gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=1 ! video/x-raw,width=2592,height=1944 ! jpegenc ! filesink location=/tmp/test.jpg
References
- The GStreamer website