Stream a web cam from the Pi


1. Raspberry Pi with network / internet connection.

2. Web Cam newer the better


Pre Heat ( software you need to download)

Log into the pi via SSH and run the command sudo apt-get install motion 

This is the only bit of extra software you need.

You do need to make some changes to the config files.

sudo nano /etc/motion/motion.conf
**change deamon off to deamon on
**change webcam_localhost on to off
**change control_localhost on to off

save the changes.

sudo nano /etc/default/motion
**change start_motion_daemon=no to yes

Cooking ( adding it all together )

Start the service by running  sudo service motion start

Find the IP address of your Pi.

On another machine or phone browse to the address of your PI and add :8081 to the end example .

This should show the live feed from your webcam.

Making it look good

On another machine open notepad and copy the text below in to it :-

<!DOCTYPE html>
<meta content=”text/html; charset=iso-8859-1″ http-equiv=”Content-Type”>
<title>WebCam Stream from Pi</title>
<style type=”text/css”>
#apDiv1 {
position: absolute;
width: 423px;
height: 278px;
z-index: 1;
left: 6px;
top: 33px;
body,td,th {
color: #000;
body {
background-color: #0CF;
</style> </head>
<div id=”apDiv1″> <img style=”-webkit-user-select: none” src=””>
Live Stream from my Pi


Save it as webcam.html , then open it in a browser and again you should see the feed . The important bit is in apDiv1 this is the code that displays the stream . Make sure to change the IP address to your PI.

I found you can not have to streams open on the same machine so if the webpage does not load make sure you do not have any other streams open.

<?php echo “Hello World”; ?>

Tagged , . Bookmark the permalink.

Comments are closed.