Camera of the Dalek

I wanted to stream video from the Dalek camera to whatever browser was looking at it.  I asked t’Internet and it provided the answer.  Mr Miguel Grinberg has provided a nice tutorial on the matter, which I’ll now rip the bits I need from.

Install what you need and link header file.

$ apt-get install libjpeg8-dev imagemagick libv4l-dev
$ ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

As an ex-Unix admin  who spent 10 years with a root prompt without anything going wrong, I fail to see the point of “sudo”. Just go to root and save the typing. You can be just as destructive either way.

Anyway, rant over.

Download, build and install  MJPG-Streamer

$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip
$ cd mjpg-streamer-code-182/mjpg-streamer
$ make mjpg_streamer input_file.so output_http.so $ sudo cp mjpg_streamer /usr/local/bin
$ sudo cp output_http.so input_file.so /usr/local/lib/
$ sudo cp -R www /usr/local/www

Thats it all done. To start it up, run the code snippet from rc.local below.

And to get the streaming running from boot time, you’ll need this is /etc/rc.local before the exit 0:

# start camera module for web server
mkdir /tmp/stream
/usr/bin/raspistill --nopreview -w 320 -h 240 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www" &

So far so good.  You can view the video streaming from your camera by pointing your browser thusly:

http://servername:8080/stream_simple.html

You will have to put the ip address of your pi in there if you haven’t fettled your DNS/hosts file to refer to it.

Next comes some hardware work on the case to get all the bits bolted/glued into place.

Leave a Reply

Your email address will not be published. Required fields are marked *