Webcam Slideshow Scripts

by Jamie Zawinski

From 2000 through 2009, we used to provide a "slideshow" version of the webcast (in addition to the RealVideo webcast) that was just a page that auto-reloaded a single JPEG image every 30 seconds. This was for people who didn't have the bandwidth to watch video. Yes, the world was like that at one time. Back when dinosaurs ruled the earth.

We switched that off in 2009, but here's how it used to work.

Here are the shell scripts and data files that make all that work. Please let me know if you find this useful, or make any improvements...

slideshow-grab-loop.sh
slideshow-grab.sh
This is the guts of the operation. This script grabs a single frame of video (using bttvgrab); then adds an antialiased timestamp caption (using my ppmcaption program); and writes it as a JPEG.

The caption part is the tricky bit, since it uses a variable width anti-aliased font, and puts an inverted halo behind the letters, so that it can be read on top of either light or dark captured images. (Originally I was using a pipeline of NetPBM filters to do it, but that was really slow.)

This script is also clever about noticing that the grabbed frame is solid black (meaning, probably, that the camera is unplugged.) In that case, it replaces the image with colorbars.

colorbars.jpg and
colorbars.gif
These are the colorbars used by slideshow-grab-loop.sh and slideshow-pull-loop.sh when there is no image.
ncenB24.bdf This is the 24 point Adobe New Century Schoolbook Bold font, in Bitmap Distribution Format. This is the font we use to generate the caption.
slideshow-pull-loop.sh This is the script that runs on the colo server machine, and copies the image from the video capture machine. It uses wget, and is careful to preserve the timestamp on the image file (so that the document's date matches the date that is in the caption text!)

If the image it pulls down hasn't changed in an hour, it uses colorbars instead.

jpgdiff.pl This is a script for comparing two or more JPEG files to see whether they differ non-trivally. This is useful for archiving webcam images, so that you don't hang on to a bunch of shots of an empty room.
slideshow-grab-initd This is the /etc/rc.d/init.d/ script that launches slideshow-grab-loop.sh on the internal video capture machine.
slideshow-pull-initd This is the /etc/rc.d/init.d/ script that launches slideshow-pull-loop.sh on the external server machine.