Webcam Slideshow Scripts
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.
- The various cameras feed into a video
switcher. From there, a single baseband NTSC video signal
- That signal goes into the machine that will grab and encode
the images. (This machine is a fairly basic Linux server running Red
Hat: 600MHz or so, and it's also used for other tasks. Doing the
slideshow doesn't require a lot.) The video capture card in this
machine is an Osprey 100.
A script grabs a frame every few seconds, adds a timestamp caption
to it, and publishes it on the local machine's web server.
Our server machine, in our ISP's colocation facility (the same
machine that serves our
audio streams, in fact),
periodically pulls the image from the video encoder machine.
The firewall access control list only allows the server machine
to get at this file: the outside world can't connect to the internal
server (since there is limited bandwidth between the two machines.)
- The server machine is a
VA Linux FullOn 2230 700MHz PIII rackmount server, with
512M RAM, sitting in our ISP's colocation facility (so it has lots
of outgoing bandwidth.)
- The server machine then re-publishes that image on its own
web server, which is where the outside world sees it.
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...
| 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
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
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.
| These are the colorbars used by
when there is no image.
|| 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.
|| 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
|| 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.
|| This is the /etc/rc.d/init.d/ script
on the external server machine.