Raspberry Pi – Webcam Streaming

Streaming an external cam

Several options exist to stream the picture of a webcam or the Raspberry Pi cam from the  Pi. The first is using a MJPEG stream. This is the most compatible as many applications and even browsers can display such a stream.

The second one is H264. Also H264 can be encoded on the Pis GPU it has a very high latency, at least five seconds from my experience.

And last but not least you can simply pipe the video stream over netcat to transmit it to another client.

1. Motion

“Motion” can serve up a MJPEG stream. Apart from that is has several other features as listed below: eg. a simple motion detection. It may run in the background as Linux daemon. Here’s a guide how to get motion going with a PS3 Eye Cam.

  • Taking snapshots of movement
  • Watch multiple video devices at the same time
  • Watch multiple inputs on one capture card at the same time
  • Live streaming webcam (using multipart/x-mixed-replace)
  • Real time creation of mpeg movies using libraries from ffmpeg
  • Take automated snapshots on regular intervals
  • Take automated snapshots at irregular intervals using cron
  • Execute external commands when detecting movement (and e.g. send SMS or email)
  • Motion tracking (camera follow motion – special hardware required)
  • Feed events to a MySQL or PostgreSQL database.
  • Feed video back to a video4linux loopback for real time viewing
  • Lots of user contributed related projects with web interfaces etc.
  • User configurable and user defined on screen display.
  • Control via browser (older versions used xml-rpc)
  • Automatic noise and threshold control
  • Motion is a daemon with low CPU consumption and small memory footprint.

2. With MJPEG streamer.

A nice guide how to build and run the open source MJPEG streamer on the pi by Miguel Grindberg.

2. As a H264 Stream with VLC

Install VLC Player on the Pi. VLC will act as the streaming server.

sudo apt-get install vlc

Run raspivid and pipe the videostream into vlc for streaming.

raspivid -o – -t 0  -w 1280 -h 720 -fps 25|cvlc -vvv stream:///dev/stdin –sout ‘#standard{access=http,mux=ts,dst=:8080}’ :demux=h264

you can now display the stream in VLC using http://[raspi IP]:8080 as your address.

Tweet about this on TwitterShare on Google+Share on FacebookPin on PinterestShare on RedditShare on LinkedInShare on StumbleUponEmail this to someone

Please Post Your Comments & Reviews

Your email address will not be published or shared.