PiEye – Raspberry Pi Streaming Webcam

||||| 0 Like |||||

With a cheap web camera that connects to USB video streaming can be done in just a few easy steps, with a Raspberry PI . The simplicity of the solution comes from the streaming technology used effectively. Everything happens over HTTP , so you can watch the Webcam on any device that surfs the web.

Basically, the Raspberry PI will be running a mini web server that serves as a video information file M-JPG ( Motion Jpeg , more info here ). In short, an M-JPG is actually a set of images and you just see one after the other, just like the frames of a movie. The advantage of M-JPG -s is that it does not require plug-ins or browser extensions for rendering. A simple element HTML type IMG , with the desired size and source attribute set to M-JPG ‘s served will allow the webcam to render in a web page.

Installing The Required Software

The entire solution is based on the server MJPG-streamer whose page can be found here . The program was written by Tom Stöveken and licensed GPLv2. Calin Crisan has compiled and prepared a version of this program for the Raspberry PI .

  1. Make sure you have an updated version of the operating system on Raspberry PI .
  2. Install the package  libv4l-0 , available in the Raspbian distribution:
  3. Connect the webcam to the USB device. We assume here that you have bought a webcam compatible with Linux , in order to confirm this,  look for  /dev/video0 .

     If you can’t see the webcam, then the webcam does not have a driver for Linux or it will require additional adjustments to work – the subject does not cover that eventuality (Sorry!).
  4. Download the script  MJPG-streamer-rpi.tar.gz directly to your Raspberry PI

    It does not really matter where you download the script, and no root permissions are required to run the script either.
  5. Rename the file you have just downloaded, and unzip it
  6. Start the server by executing ./MJPG-homestreamer.sh  current directory.
  7. If everything went well, launch your favourite browser and type http://raspberrypi:8080/?action=stream (where raspberrypi’s is your device’s address). You should see the image captured by the webcam.
    1. The current version of Chrome has a problem directly playing this sort of file, so try FireFox , if the picture is does not refresh.
  8. If the system does not work,  look at the the file MJPG-streamer.log for any errors.
N.B. – This was previously posted by Calin Crisan over on Bobtech.ro in Romanian. I have simply used Google Translate and cleaned up the translation. All Credit belongs to Calin for this work and this script – please see http://www.bobtech.ro/tutoriale/raspberry-pi/78-streaming-webcam-in-format-m-jpg-cu-raspberry-pi

Leave a Reply

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

Advertisment ad adsense adlogger