<?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>cenolan.com &#187; stop-motion</title>
	<atom:link href="http://www.cenolan.com/tag/stop-motion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cenolan.com</link>
	<description>What you looking at?</description>
	<lastBuildDate>Sun, 14 Jun 2009 20:03:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple time lapse video in Linux</title>
		<link>http://www.cenolan.com/2009/05/simple-time-lapse-video-in-linux/</link>
		<comments>http://www.cenolan.com/2009/05/simple-time-lapse-video-in-linux/#comments</comments>
		<pubDate>Sun, 10 May 2009 16:24:37 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Fedora 10]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[stop-motion]]></category>
		<category><![CDATA[timelapse]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.cenolan.com/?p=104</guid>
		<description><![CDATA[Time lapse (or stop-motion) video is really cool, and this post explains how to make a simple time lapse style video in Linux using entirely free open source software. 
There is more than one way to skin a cat and when I was searching for how to do this I came across many different methods [...]]]></description>
			<content:encoded><![CDATA[<p>Time lapse (or stop-motion) video is <a href="http://www.youtube.com/watch?v=qBjLW5_dGAM">really cool</a>, and this post explains how to make a simple time lapse style video in Linux using entirely free open source software. </p>
<p>There is more than one way to skin a cat and when I was searching for how to do this I came across many different methods and suggestions but not really anything that suited what I wanted. Andrew Wells suggests <a href="http://wp.pr0gr4mm3r.com/linux/how-to-create-a-time-lapse-video-using-ffmpeg/">making a movie and then processing it with ffmpeg</a> to only store 1 in every n frames. That seems a neat solution but I wanted to take a series of still shots and string those together into a movie. Tim Nugent published a teaser of some nice looking <a href="http://ultrawide.wordpress.com/2009/01/27/timelapse-photography-on-linux/">time lapse software</a> he wrote but as yet there is no published source or binary. There were <a href="http://www.linux.com/feature/127059">various</a> other <a href="http://www.ludumdare.com/compo/2008/08/09/no-love-linux-timelapse-howto/">suggestions</a> dotted around the web but each one I tried had <a href="http://forums.fedoraforum.org/showthread.php?p=1211408">some problem</a> or other. So here's how I did it.</p>
<p><span id="more-104"></span></p>
<p>First of all, you need a working webcam. Webcam support has really improved recently in Linux and I found the built-in iSight on my MacBook and my cheapo Logitech USB webcam work just fine without any intervention from me. </p>
<p>Next we need some way to save an image from the webcam every x seconds. I found that <a href="http://www.smcc.demon.nl/camstream/index.html">camstream</a> does the trick just fine despite it's sucky 1996-looking website and lack of a release since 2006. Under Fedora 10 to install camstream just use yum or your favourite GUI package manager:</p>
<pre><code>yum install camstream</code></pre>
<p>Camstream is pretty easy to use. Really, a child could do it. Just use the "File" menu to open up your webcam device. Then click the little configuration icon (it looks like a spanner) to adjust the file settings you'd like to use for capture. I found that JPG images work much better than PNG. </p>
<p>As the "Basename" enter the <em>full path</em> of the filename you'd like to save your images as, for example if you want to save your images as "/home/yourname/Pictures/Webcam/MyTimeLapse/image001.jpg" (and so on) then set the basename as "/home/yourname/Pictures/Webcam/MyTimeLapse/image" then choose "Number sequence" and set the maximum sequence number to something pretty big (like 100000). Close the settings. Click the icon to "show last snapshot". </p>
<p>Now click "take snapshot at regular intervals" and set your interval. I chose 3 seconds. Choose whatever you think is appropriate. Now you're all set. Camstream will take images at the interval chosen and save them into the directory you configured. Sweeeeet.</p>
<p>Ok, so now we have a directory full of images that looks something like this:</p>
<pre><code>$ ls
image000.jpg  image003.jpg  image006.jpg  image009.jpg  image012.jpg  image015.jpg  image018.jpg
image001.jpg  image004.jpg  image007.jpg  image010.jpg  image013.jpg  image016.jpg
image002.jpg  image005.jpg  image008.jpg  image011.jpg  image014.jpg  image017.jpg</code></pre>
<p>We're gonna feed these files to mencoder for it to pull together into a movie. To do this we need a text file containing a list of the files in the order that we want them. You could write this file yourself (boring) but we can create it using something like this:</p>
<p>ls -1tr > files.txt </p>
<p>This provides a listing (ls) of the current working directory outputting 1 file per line (1) sorted by modification time (t) in reverse order (r) and sends the output (>) to a file named files.txt. In the example above my files.txt looks like this:</p>
<pre><code>image000.jpg
image001.jpg
image002.jpg
image003.jpg
image004.jpg
image005.jpg
image006.jpg
image007.jpg
image008.jpg
image009.jpg
image010.jpg
image011.jpg
image012.jpg
image013.jpg
image014.jpg
image015.jpg
image016.jpg
image017.jpg
image018.jpg</code></pre>
<p>Now download and install <a href="http://www.mplayerhq.hu/">mencoder</a>. Again it's available on nearly all modern distros. For Fedora 10 just do "yum install mencoder". Now all we need do to make our move is issue a command like this:</p>
<pre><code>mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o test.avi -mf type=jpeg:fps=20 mf://@files.txt</code></pre>
<p>This will encode all the files listed in files.txt into a movie called test.avi using the mpeg4 encoder with no sound and a framerate of 20 frames per second. Messing with the fps gives very different results. See "<a href="http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html">Encoding from multiple input image files</a>" in the mencoder documentation for more info.</p>
<p>Here's an example video made using this method:</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/c6nk64D584s&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/c6nk64D584s&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cenolan.com/2009/05/simple-time-lapse-video-in-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
