Webcams

I don’t suppose you need a security system? You do?! Then you’ve come to the right place!

In any of the commands that I post, always remove the ‘<‘ & ‘>’ and type anything in blue, you will need to change anything in red to your own specifications. Green is a direct quote.

1. Update your system!

sudo apt-get update

sudo apt-get upgrade

2. Install Motion.

sudo apt-get install motion

3. Edit the config files for your own use!

cd /etc/motion

sudo nano motion.conf

Change:

# Start in daemon (background) mode and release terminal (default: off)
daemon off

to:

# Start in daemon (background) mode and release terminal (default: off)
daemon on

ctrl+o

[enter]

ctrl+x

cd /dev

Look for either video0 or video1

Go back to your motion.conf file.

Look for the line videodevice /dev/video0.

Change it to:

videodevice /dev/?????

Where ????? is replaced by whatever you found in /dev (the video device).

You might want Motion to start automatically, edit /etc/default/motion and change start_motion_daemon=no.

To start_motion_daemon=yes.

Do you want to have a live camera feed on your website, that’s hosted by your Pi? See Apache Web Server Installation.

Once you’ve installed Apache you will want to have a look at your config file. Look for the line webcam_port 8080. Make sure it’s uncommented (no ‘;’) and change it to whatever port you want your feed on, I recommend 8080 or 8070.

Update the config file!

sudo service motion restart

The available options for that command are [start|stop|restart|reload], they are pretty self explanatory!

If you now to http://localost:8080 or whatever port you inputted! You should now see a feed from your camera!

No go to /var/www

cd /var/www

sudo nano webcam_feed.html

Paste this into the file:

<html>

<title>Webcam Feed</title>

<body>

<p align=center>

<image src=”http://yourpi:8080“/>

<p>

</body>

</html>

Save and close the file.

Now cross your fingers, get up a webrowser and go to http://yourpi/webcam_feed.html

You see the feed? Yay!

Motion is very customizable, you may have noticed that in /etc/motion there are another 4 thread#.conf files. These are for if you have multiple cameras, only put details that are UNIQUE for each camera in these config files.

Say, you wanted another camera, ON A DIFFERENT PORT, then you would change the port number in thread2.conf AND in thread1.conf. Uncomment those file at the bottom of motion.conf and comment the line with the http port in motion.conf. Restart Motion and go to both of the ports in a webrowser!

🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s