Linux Quickcam Page

This image is current to within fifteen minutes
You will manually need to reload this page for new pictures!


This page originally started back in November'ish 1994. It was shortly after the QuickCam, from Connectix first came out, and was only $99. CU-SeeMe was just in beta forms, and between the camera and Linux being cheap and powerful, and videoconferencing a reality (not to mention the existence of the "Trojan Room Coffee Cam"), it was only a matter of time.

What made my page unique, was that I was truly one of the first few individuals to have a Linux QuickCam page. I don't know exactly where I would "place" in this list, but the driver had just come out for Linux, and I already had the camera and CU-SeeMe for Windoze. I figured that since the web site and everything else was running under Linux, that yes, a QuickCam application would be really cool...

So, I made a quick page to hold a picture. Then, it became my Linux QuickCam Page. Since then, I've enhanced it with new drivers as they came out, and lastly, a custom shell script called "snap" that would snap a picture every ten minutes, convert the image from .ppm to .jpg format, and compose a web page from three distinct operations. This is what also made my page truly unique.

It was setup so that the canned header was in one file. The picture was snapped every ten minutes, updating the main picture file. The picture was "archived" three times; one ten minutes ago, 20 minutes ago and lastly, 30 minutes ago, by rotating and swapping files. This made up the "middle" of the page. The last, and bottom part was a little script that polled the httpd (web server) daemon's logs to grab the last ten people to access (specifically) the "quickcam.html" page. It was entitled "Last Ten Spies!"

Needless to say, it grew quite popular as the QuickCam, and Linux as well, became increasingly popular. Within the first few weeks, I noticed that I had visitors from literally all over the world (yeah, I know, it's the Internet...) It has maintained a steady visitation from folks everywhere since.

One Day the Machine Crashed (ODtMC). Starting literally from scratch (virtues of backing up are simply not to be taken lightly!) I figure, it's time for some new and cool stuff. I'm still working on ideas, so please do come back often, as I piece this monstrosity back together. Yeah, okay, it's a played and cliched thing these days, but it's a cool demonstration of web technology, Linux and the QuickCam's ingenuity, affordability and usefulness.

So How Do I Do It?


This one is pretty easy. You need a Connectix (now Logitech) Quickcam, and it doesn't matter whether it's black and white or color. It attaches to your PC through the parallel port and draws it's power from a keyboard cable tee. Thankfully, they include an adapter so you can hook up either types of keyboards; those with the small or large DIN plug.

My gripes are that you can't draw power from elsewhere, as I have a laptop with no keyboard port. Also, the cables only reach about five or six feet. Not nearly enough to get creative with. You'll need a keyboard and parallel port extender (25-pin straight-through, male to female cable) which gives you another six feet. You could extend these even more, but beware, there's a limitation on the length - the Centronics parallel port specs limit you to 50 feet, if memory serves. (I'll double check this). Another oddity is that the PC version doesn't include a microphone in the ball, like it's Macintosh counterpart.

I have to say though, for a black and white Quickcam at $89 US or less - it's quite a cool gadget. If you happen to have a nice connection to the Internet to hang this beauty off of, you're very close to being online with your cam!


Here's where it gets interesting, and fun.

Customizing your setup is where this gets interesting. Take the image above, for example. I have the picture snapped through a cron job every ten minutes, between the hours of nine to five and only during weekdays. The entry to do that looks like this:

0,10,20,30,40,50 9,10,11,12,13,14,15,16,17 * * 1,2,3,4,5 root /root/

The script that is run, is a short, four line bash script. It has the command to grab the picture from the Quickcam itself, and output the image in JPEG format (which is a nice time-saver). Here's my current script:

/usr/local/bin/qcam -q 75 -J /tmp/office.jpg
/usr/local/bin/stamp -s /tmp/office.jpg
/usr/local/bin/ncftpput -u mike -p password docs/quickcam /tmp/office.jpg 1&>/dev/null

Some programs don't do this, and save the image in a PPM format instead. To get around this, you need one additional step using the JPEG tools from the Independent JPEG Group. One of the programs is called cjpeg which will take an image and compress it into a JPEG file. It just so happens that a PPM file is one of the formats supported for importing. Here's the line needed in such a case, as an example:

qcam | cjpeg -quality 85 -grayscale > /tmp/office.jpg

The picture is then stamped with the date and time through the use of the stamp program as seen in the above script above or:

/usr/local/bin/stamp -s /tmp/office.jpg

Lastly, in order to get the picture to this Website, I use a command-line (CLI) driven ftp program. With one line, I can tell it what file to send to whatever server and/or directory I choose. This can be seen on the last line of the script above or:

/usr/local/bin/ncftpput -u user -p password host docs/quickcam /tmp/office.jpg 1&>/dev/null

Note that it's very important to include full paths in your scripts and in the crontab file. Otherwise, you'll get into problems (file not founds). Also, make sure that permissions are correct (scripts should be chmod'ed to 755). You will also note that several lines in the script end with 1&>/dev/null which keeps any output from that step from being sent to the user running the script (usually root) by redirecting stdout to /dev/null (a.k.a. the bit-bucket). The exception is the stamp program - which is what the "-s" flag is for - it does the same thing essentially (supress output).

That's about it, folks. Enjoy your new online camera!

Some Ideas

I'm thinking of writing up some C code to allow the QuickCam to snap pictures every five minutes or so, and store each with a unique name. Then, every 24 hours, it would compress the images into a MPG or FLI movie. During this process, it will stamp each image with the time and date. If this works, it will be a sort of security/surveillance application. Of course, the numbers above are just ideas, and probably will be definable through a menu or setup file.

QuickCam Related Links

Third-party Quickcam mailing list and other useful information

Color Quickcam mini-HOWTO (non-technical)

An excellent starting point for QuickCam Software

Connectix' official developers page

All images are (C) 1994-2005 by Michael Holve