<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Page - Software Engineer &#187; motion detection</title>
	<atom:link href="http://www.chriswpage.com/tag/motion-detection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chriswpage.com</link>
	<description>... and student of Life, Philosophy, and Learning</description>
	<lastBuildDate>Sat, 17 Jul 2010 02:46:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setup a webcam security system with Ubuntu Linux and Motion</title>
		<link>http://www.chriswpage.com/2009/05/setup-an-advanced-webcam-security-system-with-ubuntu-8-04-and-motion/</link>
		<comments>http://www.chriswpage.com/2009/05/setup-an-advanced-webcam-security-system-with-ubuntu-8-04-and-motion/#comments</comments>
		<pubDate>Sun, 17 May 2009 22:51:20 +0000</pubDate>
		<dc:creator>cpage</dc:creator>
				<category><![CDATA[Cool Tech]]></category>
		<category><![CDATA[Ubuntu Linux]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[motion detection]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.chriswpage.com/?p=54</guid>
		<description><![CDATA[So, now that I&#8217;m in Morgantown &#8211; my home is too small to comfortably work on side gigs and personal projects &#8211; especially now that my family is getting bigger with the baby!  I&#8217;ve been using the office space I leased out more and more.  While exploring video conferencing with Matt last week, I had [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_57" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-57" title="camera-1-03-20090510165704-02-motion" src="http://www.chriswpage.com/wp-content/uploads/2009/05/camera-1-03-20090510165704-02-motion-300x225.jpg" alt="Snap from Office Security Cam" width="300" height="225" /><p class="wp-caption-text">Snap from Office Security Cam</p></div>
<p>So, now that I&#8217;m in Morgantown &#8211; my home is too small to comfortably work on side gigs and personal projects &#8211; especially now that my family is getting bigger with the baby!  I&#8217;ve been using the office space I leased out more and more.  While exploring video conferencing with Matt last week, I had the thought &#8220;wouldn&#8217;t it be cool to have a security camera in the office?&#8221;.  So I did just that, and it&#8217;s actually quite easy for Ubuntu linux users.</p>
<h5>What you need:</h5>
<ul>
<li>Ubuntu Linux ( I was using 8.04.1 at the time of installation )</li>
<li>one or more USB web cameras</li>
</ul>
<h5>What you can do:</h5>
<ul>
<li>Motion detection &#8211; record video/and or frames if there is motion.</li>
<li>Snapshot intervals &#8211; take time interval snapshots regardless of motion detection.</li>
<li>Live video IP stream in mjpeg format.</li>
<li>Specify recorded video to be saved in your choice mpeg, avi, flv, swf format.</li>
<li>When motion exists, have frames and videos draw a box around the specific motion for more obvious recognition of subtle movements ( this actually shows the shadow of the janitor near the door around 6 a.m. every morning &#8211; I wouldn&#8217;t have noticed otherwise! )</li>
<li>Easily send all data to a backup server in a variety of ways &#8211; I keep it simple by saving data to my <a title="Dropbox" href="http://www.getdropbox.com" target="_blank">Dropbox</a> directory, a wonderful cross-platform data syncronization and sharing utility.</li>
</ul>
<h5>Steps:</h5>
<p><strong>1.  Plugin your webcam.</strong><br />
For me, the <a title="Logitech QuickCam Pro 9000" href="http://www.logitech.com/index.cfm/webcam_communications/webcams/devices/3056&amp;cl=US,EN" target="_blank">Logitech QuickCam® Pro 9000</a> worked right out of the box, and was only 105$.</p>
<p><strong>2.  Install <a title="Motion - Software Motion Detector" href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" target="_blank">Motion</a> &#8211; software motion detector, and turn it on.</strong></p>
<pre>sudo apt-get install motion
sudo motion</pre>
<p><strong>3.  Configure Motion</strong></p>
<p>Everything really works out of the box with this &#8211; but isn&#8217;t quite organized to my liking, and probably not yours either.  Global configuration is located inside /etc/motion.conf ( You&#8217;ll notice there are multiple threadN.conf files in this directory &#8211; which can be used for custom configured individual cameras if you are setting up more than one ).</p>
<p><strong>Note:</strong> Be sure to restart the Motion server everytime you make a configuration change.</p>
<pre>sudo /etc/init.d/motion restart</pre>
<p>Take a look at the files, they are well documented.  Below are a few helpful configurations to get your data organized quicker:</p>
<pre>#/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</pre>
<p>Organize the filesytem to save data by date, instead of all in one directory.</p>
<pre># 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</pre>
<p><strong>4.  (Optional)  Setup a backup solution</strong></p>
<p><strong>a.</strong> Easy solution, get and install Dropbox &#8212; instructions on the Dropbox site.  Then update your motion.conf to save to your Dropbox directory:</p>
<pre>#/etc/motion/motion.conf
...
target_dir /path/to/dropbox/security_camera
...</pre>
<p><strong>b.</strong> A more granular solution is to take advantage of hooks configurable in motion.conf.  Using these, you can create bash scripts to do anything your heart desires ( like trigger a silent alarm on motion detection outside business hours ).  Available hooks:  on_event_start, on_event_end, on_picture_save, on_motion_detected, on_movie_start, on_movie_end.</p>
<p>If you have <a title="wput" href="http://wput.sourceforge.net/wput.1.html" target="_blank">wput</a> installed, you can easily upload files to a remote backup server with these hooks:</p>
<pre>#motion.conf
...
on_picture_save wput ftp://user@pass@server %f
...</pre>
<p>However, this solution is somewhat less secure, as it uses FTP.  In a future post I will detail how to secure this up using encrypted transfer and phrase free keys.  ( Stay tuned! )</p>
<p><strong>5.  Live feed</strong></p>
<p>This comes working out of the box with Motion.  Check out your live stream in your web browser by navigating to:  http://localhost:8081</p>
<p>That&#8217;s it!  Webcam security made easy <img src='http://www.chriswpage.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="ngg-related-gallery"><a href="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/camera-1-104-20090514175446-03-motion.jpg" title="" class="thickbox" rel="Related images for Setup a webcam security system with Ubuntu Linux and Motion" ><img title="camera-1-104-20090514175446-03-motion.jpg" alt="camera-1-104-20090514175446-03-motion.jpg" src="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/thumbs/thumbs_camera-1-104-20090514175446-03-motion.jpg" /></a>
<a href="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/camera-1-104-20090514175450-01-motion.jpg" title="" class="thickbox" rel="Related images for Setup a webcam security system with Ubuntu Linux and Motion" ><img title="camera-1-104-20090514175450-01-motion.jpg" alt="camera-1-104-20090514175450-01-motion.jpg" src="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/thumbs/thumbs_camera-1-104-20090514175450-01-motion.jpg" /></a>
<a href="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/camera-1-104-20090514175544-02-motion.jpg" title="" class="thickbox" rel="Related images for Setup a webcam security system with Ubuntu Linux and Motion" ><img title="camera-1-104-20090514175544-02-motion.jpg" alt="camera-1-104-20090514175544-02-motion.jpg" src="http://www.chriswpage.com/wp-content/gallery/motion-detection-security-cam/thumbs/thumbs_camera-1-104-20090514175544-02-motion.jpg" /></a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chriswpage.com/2009/05/setup-an-advanced-webcam-security-system-with-ubuntu-8-04-and-motion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
