Set up a Security Webcam with “motion detect” using linux, in contrast to other solutions, is a procedure quite simple, despite the lack of a GUI for the configurations (often it is good not to have a GUI). On the front “hardware” everything we need is a webcam USB, regarding the software we will need a Linux distribution and the program “motion” (in the official repositories). Below I translate and I simplify the procedure comes from the blog Chriswpage.com.
What can we do with a setup like this?
- record video and / or individual frames in case there is some movement in the area shooting,
- take pictures at regular intervals, even if there is no change in the recovery,
- execute the stream the recovery area,
- assign a specific extension the video taken,
- in case there was an area on the move is possible show a rectangle in the area of interest to emphasize the movement, to exclude false positives,
- configure in a simple way un backup filming (for example on Dropbox) to access wherever we are in the recovery area.
Ubuntu is the most widely used Linux distribution in the world, I do not have to hurt the users of other distros, but all the examples of this tutorial refer to Ubuntu. Nothing remains that everyone can install it on their own (Fedora, BSD, Slackware, etc.). First link our webcams the pc. My webcam is a very economical, bought some time ago at a department store in unless 10 Euro.
Now install and start the software “motion“, a script on the command line that will allow the recording of moving parts.
sudo apt-get install motion sudo motion
It should all work the first time and without the need for configuration, but for those who want to change the basic settings… The configuration file is dedicated “
/etc/motion.conf” (will note that there are no more files “
threadN.conf” in this directory, each corresponds to a webcam which can be configured individually (if there were more than one). The images are saved in “
/tmp/motion” and every time you restart your PC are automatically deleted.
Note: make sure to restart the server “motion” every time you change a setting.
south / etc / init.d / motion restart
To change the settings, just take a look at the configuration file. They are well commented (in inglese). Here are some useful configuration for organize data quickly:
#/etc / motion / motion.conf # Locate and draw a box around the moving object. locate on # Draws the timestamp using same options as C function strftime(3) text_right %Y-%m-%dn%T-%q # Text is placed in lower left corner text_left SECURITY CAMERA %t - Office
If we want to imprint date and time on the photos:
# File path for snapshots (jpeg or ppm) relative to target_dir snapshot_filename %Y%m%d/camera-%t/snapshots/hour-%H/camera-%t-%v-%Y%m%d%H%M%S-snapshot # File path for motion triggered images (jpeg or ppm) relative to target_dir jpeg_filename %Y%m%d/camera-%t/motions/hour-%H/camera-%t-%v-%Y%m%d%H%M%S-%q-motion # File path for motion triggered ffmpeg films (mpeg) relative to target_dir movie_filename %Y%m%d/camera-%t/movies/hour-%H/camera-%t-%v-%Y%m%d%H%M%S-movie # File path for timelapse mpegs relative to target_dir timelapse_filename %Y%m%d/camera-%t/timelapses/hour-%H/camera-%t-%Y%m%d-timelapse
Finally we can optionally organize a backup. I will not elaborate explanations of the various steps to set, there are various ways all equally useful: from their own solutions of Ubuntu (Ubuntu One, dejadup), a Dropbox, Automatic upload of server FTP, to transfer tunnelling SSH. It depends, as always, from what we seek and what tools we have available (and the speed of configuration in my case). Among other things we've talked about similar topics in the past, The following is a small list:
- tunnelling SSH,
- upload automatico su server FTP remoto,
- Dropbox (official website),
- Ubuntu One (official website).
And finally here is the video time lapse that is automatically encoded by motion with two exceptional guest star: Romeo e Tara. Forgive the shape a little’ Spartan.