Timelapse

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.

HOWTO

  1. Get webcam. apt-get webcam will work if you’re under Ubuntu.
  2. Set up a configuration file. Save it as ~/.webcamrc.
  3. mkdir -m ~/webcam/.tmp
  4. Run webcam 2> /dev/null to test (it spits out a bunch of error messages for me, but works just fine anyways). Does it work? GOTO 5
  5. cd webcam and 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?
  6. Yeah? Great. Create this script:
     #!/bin/bash
     while [ 1 ]
     do
        webcam 2> /dev/null/
        sleep 1
     done
     exit 0
    

  7. 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.
  8. cd webcam and ls -1tr > images.txt. If you don’t already have it, install mencoder and GOTO 9
  9. mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o timelapse.avi -mf type=jpeg:fps=20 mf://@images.txt
  10. mplayer timelapse.avi. Enjoy the satisfaction of a job well done. :)

Mark Grealish

Dashing brigand, handsome rapscallion, father, crazy cat lady and the world's greatest lover and liar, living in Dublin, Ireland.



Have your say on 'Timelapse'

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