Hardware Reference
In-Depth Information
Now that you know a bit more about your webcam, if you happen to be the unlucky
owner of a camera that doesn't support the MJPEG pixel format, you can still go along,
but don't expect more than a slideshow of images at 320 x 240 from your webcam.
Video processing is one of the most CPU-intensive activities you can do with the Pi, so
you need your webcam to help with this by compressing the frames first.
Capturing your target on film
All right, let's see what your sneaky glass eye can do!
We'll be using an excellent piece of software called MJPG-streamer for all our camera
capturing needs. Unfortunately, it's not available as an easy-to-install package for
Raspbian, so we will have to download and build this software ourselves:
1.
Often, when we compile software from source code, the application we're
building will want to make use of code libraries and development headers.
Our MJPG-streamer application, for example, would like to include
functionality for dealing with JPEG images and Video4Linux devices.
Install the libraries and headers for JPEG and V4L by typing in the
following command:
pi@raspberrypi ~ $ sudo apt-get install libjpeg8-dev libv4l-dev
2.
Next, we're going to download the MJPG-streamer source code using the
following command:
pi@raspberrypi ~ $ wget http://www.intestinate.com/mjpg-streamer.
tar.gz
The wget utility is an extraordinarily handy web download tool with many
uses. Here we use it to grab a compressed TAR file or tarball .
3.
Now we need to extract our mjpg-streamer.tar.gz file, using the
following command:
pi@raspberrypi ~ $ tar -xvf mjpg-streamer.tar.gz
The tar command can both create and extract archives, so we supply three
flags here: x for extract, v for verbose (so that we can see where the files
are being extracted to), and f to tell tar to use the file we specify as input,
instead of reading from the standard input.
4.
Once you've extracted it, enter the directory containing the sources:
pi@raspberrypi ~ $ cd mjpg-streamer
 
Search WWH ::




Custom Search