The Video

The Vantage PointFor our first hack night we set up a stop motion camera to record the whole event. If you have read the other posts in this blog you may have already seen the video. This is how we did it!

Install Motion.

Motion is a webcam motion capture software. It takes pictures when ever it detects motion on the camera.

 sudo apt-get install motion 

Configuring and starting motion

vim /etc/motion/motion.conf.

If you have more than one webcam (like in the case of a laptop with a built in webcam and an external cam you want to use) you need to change the following line to match the device you want to use. You can use cheese or something equivalent at this point to work out which cam is which.

videodevice /dev/vedeo0

There are lots of other options in this file, but the default worked for us.

edit /etc/default/motion if you want to run motion as a deamon.

# set to 'yes' to enable the motion deamon
start_motion_deamon='yes'

And start the motion deamon

service motion start

Compiling the video

Motion can output video but its default settings are not very hi quality. So I composed the images into a swf using ffmpeg.

First you need to rename the files from motion into a sequence that ffmpeg can use. Run this script in /tmp/motion, or where ever you set the output folder for motion.

x=1;
for i in *jpg;
do
  counter=$(printf %03d $x);
  ln "$1" /tmp/movie/img"$counter".jpg;
  x=$(($x+1));
done

Then do the conversion propper.

ffmpeg -b 400k -f image2 -i /tmp/movie/img%03d.jpg out.swf

The output

About Mex

Computer science PHD student from Canterbury. Interested in concurrency, mostly CSP and Occam-pi.
This entry was posted in Unix. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>