Tuesday 12 November 2013

Video4Linux2 (V4L2) driver for the Raspberry Pi CSI Camera Board



I will describe the steps necessary to install the  Video4Linux2 (V4L2) driver for the Raspberry Pi CSI Camera Board. 


<elaborate on issues with MOtion>












This driver is necessary to run  a Pi Camera to the CSI port  (see picture, right arrow, next to the ethernet port):





Anyway, you probably by now already know how to hook it up, but just to be sure. 


xxxxxxx

Step 1



pi@raspberrypi ~ $  wget http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc && sudo apt-key add ./lrkey.asc
--2013-11-12 10:09:28--  http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc
Resolving www.linux-projects.org (www.linux-projects.org)... 62.149.140.25
Connecting to www.linux-projects.org (www.linux-projects.org)|62.149.140.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1337 (1.3K) [application/pgp-signature]
Saving to: `lrkey.asc'

100%[==============================================================================================================================>] 1,337       --.-K/s   in 0s

2013-11-12 10:09:29 (11.2 MB/s) - `lrkey.asc' saved [1337/1337]

OK
pi@raspberrypi ~ $

<what does this do?>

Step 2

Add the following line to the file /etc/apt/sources.list :
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/ wheezy main

You can use the nano text editor to do this. What does this do? Well, as part of its operation, Apt uses a file that lists the 'sources' from which packages can be obtained. Apt will be used in the next step. It is beyond the scope of this post to go into APT in any further detail.

Step 3 

Run the following commands


$ sudo apt-get update
$ sudo apt-get install uv4l uv4l-raspicam
The last two commands will upgrade UV4L to the most recent version, if it's already installed.

Now the UV4L core component and the Video4Linux2 driver for the CSI Camera Board are installed. If you occasionally get unexpected errors from the driver, consider updating the firmware with the following command:

$ sudo rpi-update
For detailed information, options, etc... about the modules installed type accordingly:
$ man uv4l
$ man uv4l-raspicam (the manpage is work in progress)
To get a list of available options:
$ uv4l --help --driver raspicam --driver-help
To quicly test uv4l, simply run:
$ uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding jpeg
To take a JPEG snapshot from the Camera:
$ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1

pi@raspberrypi /etc/init.d $ uv4l --driver raspicam --auto-video_nr --width 320 --height 240 --framerate 2
<notice> [core] Trying driver 'raspicam'
<warning> [core] Driver not found
<notice> [core] Loading external library libraspicam.so
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.9 built Nov  9 2013
<notice> [driver] Selected format: 320x240, encoding: mjpeg, JPEG Video Capture, max. 2 fps
<notice> [driver] ROI: 0, 0, 1, 1
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0




For a list of other use cases click here.

To terminate a running driver, close the applications and kill the corresponding uv4l process:
$ pkill uv4l
Apart from the driver for the Raspberry Pi Camera Board, the following drivers can be installed:
$ sudo apt-get install uv4l-uvc
$ sudo apt-get install uv4l-xscreen
$ sudo apt-get install uv4l-mjpegstream
To get help:
$ man uv4l-uvc
$ man uv4l-xscreen
$ man uv4l-mjpegstream
---
Useful links:

http://sourceforge.net/projects/mjpg-streamer/
http://www.videolan.org/

No comments:

Post a Comment