Productivity and technology tips to get you jacked!

Turn your webcam into a security camera in Linux

January 4th, 2007 — Kyle

If you have a webcam sitting around, a great alternative use for it is to turn it into a security camera. Having a security camera in your house, office, or apartment can provide numerous benefits. This guide is for beginners who have no experience in setting up webcam security cameras. I will show you how to turn your webcam into a security camera using GNOME.
The first step is to make sure you camera is detected. Go to System >> Administration >> System Log. In System Log go to Open and choose “messages.” At the bottom of the log make sure you see an entry related to your webcam. My log is shown below:

The third step is to actually fire up Motion. Motion runs from the terminal. Open a terminal and type motion to get started. What’s nice about Motion is that it only records movement. Run your hand in front of your webcam so that motion will record some images. Press CTRL+C in the terminal to stop motion.

Now, navigate to /tmp directory and you will see the timestamped images captured by Motion. See below:

However, saving files to the /tmp directory is not very helpful. You can change this directory by going into the /etc/motion/motion.conf and changing the line that says target_dir /tmp to a directory of your choice.

Also, it is not very helpful to have these images saved to your local hard drive because if someone broke into your home they would probably steal the computer that has the images on it. Therefore, we will set Motion to save the images to an external server via FTP.

In order to do this you need to install wput. Wput is widely available in the repositories and can be installed using apt-get install wput. After you install wput, add the following line at the end of the /etc/motion/motion.conf file:on_picture_save wput ftp://username:password@yourserver %f

The %f is added at the end of the file to upload each picture as it is taken. Motion is a very handy tool and can also record full movies instead of pictures (which I demonstrated). Please see the configuration options at the Motion homepage to learn about the many other things you can do with Motion.

Does anyone know a better way to do this in Linux? Please tell us your way in the comments. Check back tomorrow and I will write a similar post for Windows XP users.

Trackbacks & Pings

[…] Previously I posted about how to turn a webcam into a security camera using Linux. This is the counterpart tutorial and I will show you how to turn a webcam into a security camera in Windows XP using free software. Having a webcam in your home, office, or apartment can provide numerous benefits. If you own a webcam, a great alternative use is to turn it into a security camera so you can keep an eye on your stuff while your gone. […]

Comments

I found this article (making a webcam into a sercurity camera) very interesting. Could you tell me how to do this using Windows Vista? I want to set the camera up about 100ft away from my computer (to pick up images from outside). Thanks very much!!
Susan

My computer wont let me open up the motion.conf file in Notepad or Libre office, it says access denied in Libre and a similar message in notepad. In addition, I cannot delete the photos that have already been taken and now sit in my tmp/motion folder, because it says I’m not the owner. I am the admin on this computer so I dont know how I cant be the owner. Please Help?