Choosing a video source

If you already own a video source that works under Linux, such as a USB webcam, most likely it will work with Spook. If it does not, send me an email and we can try to figure out what the problem is. Obviously, I don't own every webcam in the world to test with, but if it works under other Linux applications it can almost surely be supported with Spook.

However, if you don't yet own a video source, or if you are tired of the poor quality video streams produced by your USB webcam, here is some advice on shopping for a new camera.

There are three approaches to getting video into your Linux system: Firewire (IEEE1394) IIDC-compliant video inputs, analog video frame grabbers, and USB webcams. At the consumer price level, this is the order in which you want to evaluate products.

The short answer

For most uses, buy a Firewire camera (the Unibrain Fire-i is my favorite for under $100) and a $20 Firewire card if you don't already have Firewire ports. You get significantly better video quality than USB webcams—real 30 frame-per-second video at 320x240.

Firewire IIDC cameras

There are three types of Firewire cameras. The kind most people are familiar with are Digital Video (DV) cameras, which are camcorders that store video in a digital format and can transfer stored video over the Firewire port. These cameras fall into the "DV" category. There are also digital "still" cameras, which take digital photographs and transfer the pictures from the internal flash memory using a Firewire port. These cameras are generally accessed as generic Firewire storage devices, although some require proprietary software to access them. The type of camera we are interested in is called "IIDC" (or just "DC"). These cameras allow live video streams to be transferred from the camera to a computer (or other host device) for transmission, processing or storage.

Most Firewire webcams available are compliant with the IIDC specification. This means that no device-specific driver is necessary to interface with the camera. Any IIDC camera should be usable under Linux and may be tested with Coriander. Any device that can be used with Coriander can be used with Spook.

One of the advantages of IIDC is that it is used for many different types of cameras beyond the normal class of desktop webcams. Damien Douxchamps maintains a list of IEEE1394 cameras which includes cameras used for vision research, medical imaging, and blowing things up. Most of these are quite expensive, beyond the consumer level, but those that support IIDC are supported by Spook and other Linux applications.

At the time of this writing, Firewire webcams do not have as great a demand due to the proliferation of USB webcams, and thus the few choices of webcams available are somewhat expensive. Currently, the most popular webcams seem to be the ADS Pyro cams, the OrangeMicro iBot, and the Unibrain Fire-i, all for just under $100; and the much-hyped Apple iSight for $150. I have tested the ADS, OrangeMicro and Unibrain cams, and the Unibrain Fire-i wins by a long shot with much better image quality, lower noise, and low-light capability. However, it comes with a clip mount instead of a stand, so if you need the cam to stand up on a flat surface, you may opt for the ADS Pyro cam which mounts to a bundled four-inch tripod with a standard screw-type tripod mount.

If you are planning on using a Firewire cam with a laptop, note that most laptops do not provide power on their Firewire ports. In particular, the tiny four-pin Firewire ports do not even have the power pins, but even some six-pin ports will not have power connected. If this is the case, you will need a Firewire hub or a camera that can be powered externally. (All Apple laptops power the Firewire ports, as far as I know.)

Analog frame grabbers

Instead of buying a computer-only camera, you may want to use a video camera with a composite or S-Video output and connect it to an analog frame grabber card. If you have an old camcorder laying around, for example, you may want to go this route. Similarly, if you will be getting video from an existing source such as a surveillance camera, this is the way to go.

Traditionally, the most popular frame grabbers used under Video4Linux have been the Brooktree BT848-based TV cards. I own several cards with a BT848 which I use to test Spook. Unfortunately, these are no longer available, and I have no experience with newer cards. If you are looking for a card, I recommend checking the Video4Linux2 webpage to find out which chipsets are supported by V4L(2) drivers. If you are running kernel 2.4, make sure the driver runs on 2.4 as well as 2.6. (Some cards will produce MPEG video streams instead of raw video frames. This is not what you want, so don't buy one of these cards unless you are sure that it will support raw video as well.)

The biggest inconvenience with using analog inputs is interlacing. NTSC uses a frame rate of 29.97 fps and each frame contains 525 lines, but in an analog signal, the lines are delivered in two sets: first the odd lines, then the even lines. These sets are called fields. So, really, an NTSC video stream delivers 59.94 fields per second, and each field has 262 lines. Frame grabbers try to compensate for this by capturing two fields at a time, then interleaving them together in the frame buffer. The problem is that the even lines will be captured 1/60th of a second after the odd lines. This works fine to create a still image, but any movement in the scene will cause a "comb" effect in the interlaced image. (PAL works the same way, except with a frame rate of 25 fps of 625 lines, or 50 fields per second of 312 lines.)

The easy solution for this is to set the capture resolution low enough so that only lines from one field are needed. For the BT848 chipset, this means using a resolution with no more than 240 lines, which is plenty for most applications.

USB webcams

USB webcams are, if I may be so bold, the bane of desktop video. Many users, after buying a USB webcam, come away with the mistaken impression that PC videoconferencing and desktop video have poor image quality and only support low, inconsistent frame rates. In reality, these limitations are imposed only by the poor design and implementation of USB video hardware.

To start with, USB is entirely the wrong data interface to deliver video of any sort. A very modest video stream of 320x240 frames at 10 frames per second requires a data rate of 18 Mbps—half again more than the maximum data rate of USB 1.1. A full NTSC video stream requires several hundred Mbps. Clearly, USB was not designed for the data rates necessary for live video.

As a result, no standard protocol was specified for USB video streaming. Each vendor that ventured into USB webcam hardware was required to design their own protocol, each of them incompatible with the others. Every USB webcam chipset requires a custom driver, only a portion of which runs on Linux. Often driver implementation is complicated by use of image compression, a strategy used to work around the bandwidth limitations of USB. To make matters worse, vendors will often re-brand other manufacturers' hardware, making shopping for a Linux-compatible USB webcam a chore. Some vendors have even switched from one chipset to a different, incompatible chipset without changing the model number of the device!

At this time, the most well-supported driver for any USB webcam seems to be the PWC module, which drives the Philips chipset used by Logitech and many others. Spook contains support for some additional features in PWC. However, you may encounter problems with this driver—while most of the functionality is available in the open-source module included with the kernel, the higher frame rates require a binary-only module to enable image compression. The PWC FAQ has a table describing the compressed and uncompressed modes; use of any of the modes in red requires the binary-only module. If you intend to buy one of these webcams, I strongly recommend first downloading the module and attempting to load it into your kernel. The 2.6 kernel is very unfriendly toward binary-only modules, so there is a chance you will not be able to use the compressed video modes on your system.

Other Linux-supported cams/chipsets include the OmniVision OV51x, SE401, W99687CF, Xirlink (IBM) C-it, SPCA50x, and Quickcam Express. Be very cautious if purchasing a webcam from this list for use with Spook. Many of the devices seem to have very strange limitations, lacking certain color palette settings or even the ability to receive images at a consistent frame rate, that hinder or prevent their use with Spook or any MPEG4 encoder.

So, in summary, I strongly suggest that you avoid USB webcams. If you must buy a USB webcam (perhaps you are using a laptop with no Firewire ports) then you would probably be best off with a cam supported by the PWC driver. However, if you would really like for a certain model to be supported by Spook, and it already has Linux drivers of some sort, email me and I will see what I can do.


Last modified 2004-04-17 by lutchann.