Webcam timelapse with Ubuntu Cheese
I found a simple way to take time lapse photos with Ubuntu’s webcam utility Cheese.
I created a macro using Xmacro. Very helpful info I found on A Search For Truth. The key bits I learned was a trick for installing. Instead of the add/remove utility for Ubuntu, the Synaptic Package utility will install xmacro for you. (click on Systems > Administration > Synaptic).
Once installed, I created a text file called timelapse.macro that contained:
ButtonPress 1
ButtonRelease 1
Repeated as many times as I wanted to take photos. At 30 frames per second, 1800 photos will take one minute. The file will be 3600 lines long.
I put the text file in my desktop directory. Opened a terminal, went to that directory, then entered:
cat timelapse.macro | xmacroplay -d 5000 :0
This clicked on the mouse in workspace 0 every 5 seconds (5000 milliseconds) and released every 5 seconds. Thus, a picture was taken every 10 seconds once I placed the mouse pointer on the take a photo button (Cheese was already up and running) on workspace 0. I think the workspace setting might only be set once, as I manually switched workspaces and the mouse clicks then were still automated wherever I worked.
One downside, I haven’t yet figured out how to stop the macro early. cntl-alt-backspace did it the hard way, but I’m sure there is an easier way I haven’t found yet. Still, with Linux, this warm reset gets you back to your desktop in less than 10 seconds, so it is far less cumbersome than rebooting Windows.
- the MuseTags: Linux
October 5th, 2009 at 5:13 am
Hello!
I was looking for something like this as well and found your solution.
However i did a small change that IMHO works a little better:
I did the same timelapse.macro as you.
Then i made a script called tl:
cat timelapse.macro | xmacroplay :0
I run the script with watch:
watch -n [how often in seconds you want a picure] ./tl
now im no guru but its easier to vary the time and you dont need to zap to get out of the script, just select the terminal and press ctrl+c.
Thanks for helping me come up with this
October 5th, 2009 at 5:15 am
yeah, and just one:
ButtonPress 1
ButtonRelease 1
as the script restarts the macro, no worries that the macrofile will run out before you want to stop recording
October 5th, 2009 at 12:26 pm
Thanks for the improvements. I need to learn more about the power of scripts.
October 7th, 2009 at 2:40 pm
Doesn’t Cheese’s burst mode do the same thing?
October 7th, 2009 at 6:44 pm
Great update. As far as I can tell, burst mode was added after I created the macro. Seems like a useful addition to Cheese though.