IMX CSI

From Variscite Wiki
Revision as of 07:09, 3 March 2018 by Admin (talk | contribs) (Created page with "Before you start any of below pipeline make sure you have camera connected. IMX family of processor uses gstreamer as multimedia framework. Please refer to https://gstreamer....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Before you start any of below pipeline make sure you have camera connected. IMX family of processor uses gstreamer as multimedia framework.

Please refer to https://gstreamer.freedesktop.org/

Run below command to see if you have got the camera detected

 v4l2-ctl --list-devices 

This should output below

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

pxp (pxp_v4l2_out):
        /dev/video0


As you can see above i.MX6S_CSI (platform:30710000.csi): is camera and pxp (pxp_v4l2_out): pixel procesing engine for overlay on display

Checking whether you have got the imx platform plugins installed on your filesystem: Run below command to check whether you have the IMX platform specific gstreamer plugin installed or not.

 root@imx:~# gst-inspect-1.0  | grep "imx"
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

imxv4l2videosrc: Is CSI camera capture plugin for camera. Currently devkits OV5640 supports YUV input, where sensor process incoming light and converts it to YUV 4:2:2 format data. MIPI data is captured by the MIPI CSI input of the devkit.

Camera Preview on Display :

  • For 640x480@30fps:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 ! imxpxpvideosink
  • NTSC 720x480@30fps:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 ! imxpxpvideosink


  • 720P 1280x720@30fps :
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 ! imxpxpvideosink
  • For 1080P@30fps:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 ! imxpxpvideosink
  • For QSXGA 2592x1944:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 ! imxpxpvideosink


To Capture JPEG snapshot:

  • For 640x480:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • NTSC 720x480:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • 720P 1280x720:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1080P:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For QSXGA 2592x1944:
root@imx:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg


Please note : jpegenc is opensource software based jpeg encoder. This gets executed on CPU not using JPEG hardware acceleration. Transfer /tmp/test.jpg to your PC and see whether you got correct snapshot or not.

Some of the camera examples you may want to refer to :http://variwiki.com/index.php?title=VAR-SOM-MX6_GSTREAM, however please note, IMX7 has different multimedia capabilities.