Three-camera timelapse
I cleaned up my garage this weekend.
Cameras 1 and 2 were on two laptops running cheese set to take multiple pictures with a 60 second wait. I wish the photo count field went higher than 100. What's the design reason to limit the count to something so low? Mysterious. I'd file a bug if the world used distributed bug-trackers where I could just file it on my own machine with my own UI, not make an account and learn your UI. Consider this blog post to be an approximation of the DBTS.
Camera 3 was an old NTSC camera connected to a BT848 card with my own gstreamer/web camera software. I grabbed timelapse with that one with a line of zshell:
forever { curl -o`date "+%Y-%m-%d-%H_%M_%S"`.jpg http://10.1.0.21:9020/garage; sleep 60 }
I got about 2500 pics from each camera, but because of the way I stopped and started the 3 machines, the pics were far from in sync.
This python program makes a new directory of symlinks with a link for every minute after my fixed start time. If there's no frame for that minute, I make a link back to the last existing frame.
import os from glob import glob start = 1288461813 for cam in ['bench', 'dining', 'steps']: seen = set() maxMinute = 0 for f in glob(cam+"/*.jpg"): t = os.path.getmtime(f) minutes = (t - start) // 60 seen.add(minutes) maxMinute = max(maxMinute, minutes) try: os.symlink('../'+f, cam+'.renum/min_%04d.jpg' % minutes) except OSError, e: print "f=%s minutes=%s" % (f, minutes), e if 0 not in seen: os.symlink('min_%04d.jpg' % (min(seen)), cam+'.renum/min_0000.jpg') lastFrame = 0 for minutes in range(1, maxMinute): if minutes not in seen: os.symlink('min_%04d.jpg' % (lastFrame), cam+'.renum/min_%04d.jpg' % minutes) else: lastFrame = minutes
I made mjpeg avi files out of those aligned sequences like this. This is also where I made everything 8 fps.
ffmpeg -r 8 -sameq -i dining.renum/min_%04d.jpg -vcodec mjpeg dining.avi
import Image, time, ImageFont, ImageDraw start = 1288461813 font = ImageFont.truetype("/usr/share/fonts/truetype/ttf-mgopen/MgOpenCosmeticaBold.ttf", 50) for minute in range(0, 2155): sec = start + minute * 60 pretty = time.strftime("%A %H:%M", time.localtime(sec)) print pretty img = Image.new("RGB", (400, 120)) draw = ImageDraw.Draw(img) draw.text((0,0), "Garage cleanup", font=font) draw.text((0,60), pretty, font=font) img.save("time/min_%04d.jpg" % minute)