One thing we have talked about at School Pi Club is how to stream the Raspberry Pi Camera via the web. Founder member JW would like to use it to check on his dog remotely.
Here are the instructions to set up streaming a Pi Cam.
1. After booting up your Raspberry Pi you need to install MJPG Streamer using LXTerminal.
# Make and change into directory. sudo mkdir /opt/mjpg-streamer cd /opt/mjpg-streamer/ # Install the following packages. sudo apt-get install libjpeg8-dev sudo apt-get install imagemagick sudo apt-get install subversion # Download MJPG Streamer into the current directory. sudo svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer/ . # Run make. sudo make
2. Now for the fun bit – streaming the video from your Raspberry Pi Camera. Please note you will need to scroll along to see some of the code below.
# Make a directory to store the temporary images. sudo mkdir /tmp/stream/ # Make the directory writable. sudo chmod a+rw /tmp/stream/ # Start capturing. # See what the raspistill options are. raspistill --help # You see the record light turn on after executing the following line. raspistill -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 -n & # See what the MJPG Streamer options are. /opt/mjpg-streamer/mjpg_streamer --help # Run the following to start up the MJPG Streamer streaming webserver. LD_LIBRARY_PATH=/opt/mjpg-streamer/ /opt/mjpg-streamer/mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -p 9000 -w /opt/mjpg-streamer/www" &
3. If everything went smoothly you can open up a web browser and go to:
There you have it. To access your streaming webserver remotely you will need to enable port forwarding on your router. Since every router is different we cannot explain how, but the PortForward site can guide you.
4. To stop streaming you need to kill the processes. First do ctrl+C to get the command prompt.
# To kill MJPG Streamer killall mjpg_streamer # to kill Raspistill killall raspistill