Skip to content

CSI camera

Frank Bauernöppel edited this page Apr 24, 2017 · 38 revisions

Tested with RasPi Cam V2 which connects to the MIPI CSI-2 interface on connector J3.

camera module v2 (Picture: adafruit.com)

Documentation: https://www.raspberrypi.org/documentation/hardware/camera/README.md

Installation and Configuration

Power off and connect camera module connect to CSI connector.

When (re-)booting, config.txt must contain a line

start_x=1

otherwise, the camera cannot be used and you get a ENOMEM error.

raspistill and raspivid

These tools are RasPi specific and closer to the hardware. See source code: https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/raspicam

record still image

pi@raspberrypi:~ $ raspistill -o raspistill.jpg
pi@raspberrypi:~ $ file raspistill.jpg

record H.264 video

pi@raspberrypi:~ $ raspivid -o raspivid.h264
pi@raspberrypi:~ $ file raspivid.h264

Many options are possible, like sending the stream to stdout and pipe it to gstreamer or nc ("netcat") for streaming. See raspivid.

video for linux (v4l2) device driver

see video for linux

gstreamer

gstreamer can use /dev/video0, the video for linux driver must be loaded.

cvlc

this is a command line version of VideoLAN vlc video player, the swiss army knive among video players. Can also be used for RTSP streaming. cvlc is a command line tool, but it comes together with vlc which requires a lot of graphics stuff. (There maybe a "no X" version vlc-nox, but no bitbake recipe.)

RTSP streaming server on the RasPi

pi@raspberrypi:~ $ raspivid -t 0 -o - | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

RTSP client (any host)

Works with VLC player and many more. Enter stream URI rtsp://192.168.2.105:8554/ where 192.168.2.105 must be replaced by the IPv4 address of your RasPi.

OpenCV

See OpenCV.

uv4l

Closed source - neither recommended, nor tested. Claims to support WebRTC https://www.linux-projects.org/uv4l/

web cam interface project

http://elinux.org/RPi-Cam-Web-Interface

gpu accelerated camera processing

http://robotblogging.blogspot.de/2013/10/gpu-accelerated-camera-processing-on.html

WebRTC webcam project using janus

https://www.rs-online.com/designspark/building-a-raspberry-pi-2-webrtc-camera

measuring delay

display a chronometer clock like http://tft.vanity.dk/inputlag.html on a screen. Start a video live capture loop and place the output window next to the chronometer clock. Take a picture showing both windows and calculate the time differences of the time stamps shown. Repeat several times to get statically relevant results. The difference is the "glass to glass" delay of your video loop.

Clone this wiki locally