I've seen a few folks post some time lapse footage here, and I wanted to give it a try. It turns out that it's quite easy under Ubuntu Linux using a webcam and video4linux. Software required includes mplayer and imagemagick.
The result: a boring movie where a candle burns and a beer is drained.
Captured every 5 seconds, replayed at 15 fps (75x speed).
[YOUTUBE]sMszDFgjQ9w[/YOUTUBE]
My shell scripts could probably be a little more elegant, but they work. Here are the details:
First, a script to start mplayer and capture images to be stored as png files in the current directory. Takes a single argument specifying the capture interval. To exit, close mplayer and hit Ctrl+c.
Next, a script to convert all the png images in the current directory to jpg format and encode them into a movie. Takes a single argument specifying the framerate.
The result: a boring movie where a candle burns and a beer is drained.
Captured every 5 seconds, replayed at 15 fps (75x speed).
[YOUTUBE]sMszDFgjQ9w[/YOUTUBE]
My shell scripts could probably be a little more elegant, but they work. Here are the details:
First, a script to start mplayer and capture images to be stored as png files in the current directory. Takes a single argument specifying the capture interval. To exit, close mplayer and hit Ctrl+c.
Code:
#!/bin/bash
# Time lapse script using mplayer
# Exit gracefully if no interval is specified
if [ "$1" = "" ]; then
echo "Error: Please specify an image capture interval!"
echo "USAGE: timelapse <interval>"
echo "Where <interval> is an integer in seconds."
exit
fi
# Make a FIFO file for use later
rm /tmp/timelapse.fifo
mkfifo /tmp/timelapse.fifo
mplayer -slave -quiet -input file=/tmp/timelapse.fifo -vf screenshot -tv driver=v4l:height=240:width=320 tv:// &
while true; do
sleep "$1"
echo "screenshot 0" > /tmp/timelapse.fifo
done
Next, a script to convert all the png images in the current directory to jpg format and encode them into a movie. Takes a single argument specifying the framerate.
Code:
#!/bin/bash
# Script to convert a series of png images to a movie
# Exit gracefully if no framerate is specified
if [ "$1" = "" ]; then
echo "Error: Please specify an framerate!"
echo "USAGE: capture2movie <framerate>"
echo "Where <framerate> is an integer representing fps."
exit
fi
echo "Converting png images to jpg format."
echo "This may take some time..."
for f in *png ; do
convert -quality 100 $f `basename $f png`jpg
done
echo "Moving original captured images to folder ./backup."
mkdir backup
mv *.png backup
echo "Encoding movie..."
mencoder "mf://*.jpg" -mf fps="$1" -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800