7.20.2010

Vacation Dashboard Camera

While on our way to the Georgia Coast, I set up a webcam on my dash and connected it to my netbook. From Ohio to Chattanooga, the camera was set up to take an image every minute. The result was OK, but I wanted more frames per second. From Chattanooga to Georgia, I set the camera to take a shot every 5 seconds -- the result is below.



The details: I'm running Ubuntu Netbook Remix on my netbook and used "webcam", cron, and a small shell script to take an image every 5 seconds. To my knowledge, cron only has a resolution of 1 minute which is why I had to write a shell script.

     /usr/bin/webcam /home/user/.webcamrc

The .webcamrc file looks like this, yours may be a bit different:

     [grab]
     device = /dev/video1
     text = "tokala %Y-%m-%d %H:%M:%S"
     width = 640
     height = 480
     delay = 8
     wait = 0
     rotate = 0
     top = 0
     left = 0
     bottom = -1
     right = -1
     quality = 100
     trigger = 0
     once = 1
    
     [local]
     dir = /home/user/webcam
     file = currentwebcam.jpg
     local = 1


 After capturing the image, I then copy it to a folder for later processing. The `date` command appends the date to the filename (this method can be improved but I through this together in Panera the morning we left.)

     cp /home/user/webcam/currentwebcam.jpg "/home/user/webcam/`date`-webcam.jpg"

So, I ended up with just over 4000 images. To create the video, I used mencoder and set the frames per second to 5.

     /usr/bin/mencoder "mf://*.jpg" -mf fps=5 -o videos/output.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800

A better webcam would yield a better result, but overall I'm pretty happy that my hacked together project produced any result at all.

No comments:

Post a Comment