Outils pour utilisateurs

Outils du site


issue76:labo_linux

Ceci est une ancienne révision du document !


One of the strength’s of UNIX-like operating systems has always been the fact that most tools can be used together with other tools. So when I was asked how to set up a simple security camera for Linux, I had to do a bit of thinking how someone without a lot of experience might do this. ZoneMinder is an amazing application, but it seemed like overkill for this particular situation which needed only a single camera pointed at a door.

One thing we considered was the possibility of the storing computer being taken or destroyed. We needed a solution that would take pictures only when there was movement. We also wanted to synchronize the pictures with a cloud service.

We decided on Dropbox over Ubuntu One because we needed a client that also ran on our Blackberry cellphones. After some struggling with different video capture clients, we got the closest to what we wanted to do with the command-line program ‘motion’.

When we first ran motion, we found it created hundreds of images, so we ran motion with the -s (setup) switch. Motion displayed the following: [1] Changes: 0 - noise level: 18 [1] Changes: 1 - noise level: 18 [1] Changes: 0 - noise level: 18

Use Ctrl+C to interrupt motion. Running motion with the -s switch creates a series of image changes, so motion can gauge what is scenery and what is noise.

We found that the default configuration file in /etc/motion/motion.conf still created too many images. You can override the default configuration file by creating a file called motion.conf in your home directory (note that this is not a .dotfile). If you don’t like motion.conf sitting in your home folder, you can always call it something else and use the -c (configuration file switch) to point to the configuration file.

We created a motion.conf with the following options: webcam_motion on noise_level 255 framerate 2

The webcam_motion option can be either on or off. By default, it’s off – because the default webcam_maxrate is normally set to 1 frame per second. If webcam_maxrate is set higher, webcam_motion limits any capture to 1 frame per second if no movement is detected. We found that turning it on seemed to reduce the amount of images captured. The default noise_level in /etc/motion/motion.conf is 32, we set this higher (255) so the webcam wouldn’t be triggered so much by light changes.

When I walked into the frame, walked up to the camera, and walked away, motion took 254 images. It might seem like a lot to synchronize, but at 8k-10k an image Dropbox synchronized the images quickly.

For the Dropbox setup, we first visited dropbox.com and created an account. In my case I already had an account and I needed to click on More in the bottom left of the screen to open a menu with the Install option. Clicking Install took me to a page where I could download either the 32-bit or 64-bit version of the dropbox command-line tool. I’m running Linux Mint at the moment and the Ubuntu 32-bit .deb file installed fine.

After installing the dropbox you need to install the rest of dropbox by running:

dropbox start -i

Dropbox will download a file and install nautilus support. You should notice a small dropbox icon on your panel. During the install, you’ll be asked several questions including where you want the Dropbox folder to be, we left it as the default in the root of our home folder. We also created a folder called Motion in ~/Dropbox, so we ended up with a folder called ~/Dropbox/Motion.

We then installed the Dropbox app on our Blackberries. Motion stores images wherever it’s run from, provided that its directory is writeable. We ran motion in our ~/Dropbox/Motion directory, and then walked in front as a test. Motion captured images and Dropbox started pulling down the Motion data we’d captured right away.

The Dropbox software need not be installed on a computer in order to view the dropbox data. By simply logging in to the Dropbox website, we were able to view all of the photographs caught by motion.

The flexibility of running Dropbox either on a PC or on our Blackberries covered us whether we were near a computer or elsewhere. Of course there are much more sophisticated solutions like Zoneminder, but combining motion and Dropbox gave us a quick solution where we didn’t have to do a lot of setup and could access our security camera from pretty much anywhere we went.

issue76/labo_linux.1378047164.txt.gz · Dernière modification : 2013/09/01 16:52 de andre_domenech