I have to apolgize for the quality. I had a problem with how the program, webcam, handled the final image; it would offset the image by 30-50%, and in the end the only real solution I could come up with was to forcibly crop the image. I can’t give you any real why for the cropping right now, beyond to say that a thorough search of Google didn’t turn up anything remotely similar happening to anybody else.
After tonight’s 091 Labs meeting, somebody (sorry I’m terrible with names) was showing off a brief timelapse video taken during the course of the meeting. Inspired by it I set out to see if I could do the same myself, entirely in Linux and using command line tools. In all? Three hours. Not too bad. I now (with some blatant theft from here) have a workable timelapse program I can pop up in a window somewhere and set loose.
- Get webcam.
apt-get webcamwill work if you’re under Ubuntu.
- Set up a configuration file. Save it as
mkdir -m ~/webcam/.tmp
webcam 2> /dev/nullto test (it spits out a bunch of error messages for me, but works just fine anyways). Does it work? GOTO 5
cd webcamand look for a JPG file. It should have a file name close to
img-2010-07-14-01-29-08.jpg. Stop. Evaluate. Does it look okay?
- Yeah? Great. Create this script:
#!/bin/bash while [ 1 ] do webcam 2> /dev/null/ sleep 1 done exit 0
chmod +x timelapse. Then run it, really, for however long you want it to run. In the video above I had it run for approximately 30 minutes at 1 frame every two seconds. Ctrl+z when you want it to finish.
ls -1tr > images.txt. If you don’t already have it, install mencoder and GOTO 9
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o timelapse.avi -mf type=jpeg:fps=20 mf://@images.txt
mplayer timelapse.avi. Enjoy the satisfaction of a job well done. :)