by January 1, 2000 0 comments

Over the past year, I’ve watched my friends graduate from
multi-player xblast to netquake on Linux. In short, the hacker’s OS has started rocking. So you’ve racy 3D graphics, good sound, and the works. But is something missing? What about some video capturing at home? Uh oh! Does Linux do that? If you’ve a popular frame grabber card, then yes, Video4Linux is here to your rescue.

History
Although Video4Linux(v4l) is a comparatively new addition to the Linux kernel, video, TV, and video capture support has been around on Linux for a while, but mostly restricted to the geek world. The bttv project (www.thp.unioeln.de/~rjkm/linux/bttv.html) provided drivers for the popular BrookTree chipset (hence the name BrookTree TV) as early as 1997, and was available as a kernel patch for 2.0.x kernels. Alan Cox introduced the Video4Linux design to provide an API for handling video in 2.1 revision, and with the advent of kernel 2.2, v4l became the standard. Bttv and other drivers then became part of the v4l project.

Will my card work?
While configuring the kernel, go through the list of devices under Character devices>Video for Linux in the Linux kernel 2.2.x. If your frame grabber is listed, you’re in luck. Even if it’s not, all is not lost. Chances are your card is bt848 based–open up your box and see the chipset on your frame grabber. If it has BrookTree written on it, it should definitely work. Go through
/usr/src/linux/Documentation/video4linux/bttv/CARDS for a list of supported BrookTree chipsets or cards. (Don’t lose heart if your card is not there. If it has a supported chipset, at least the frame grabbing should work. I’ve got an Intel Video Recorder III, based on bt848 working perfectly, although it wasn’t listed).

How do I enable v4l?
Configure and compile your kernel with v4l support. Go to Character devices>Video for Linux section. You would want to compile it as a driver (type M) and then select the appropriate card. Save your configuration and compile the kernel. 

Check for the /dev/video* devices: You should have some /dev/video?, /dev/vbi? files. If not, run this simple shell script to make them:

#!/bin/bash
function makedev () {
for dev in 0 1 2 3; do
echo “/dev/$1$dev: char 81 $[ $2 + $dev ]”
rm -f /dev/$1$dev
mknod /dev/$1$dev c 81 $[ $2 + $dev ]
chmod 666 /dev/$1$dev
done
# symlink for default device
rm -f /dev/$1
ln -s /dev/${1}0 /dev/$1
}
echo “*** new device names ***”
makedev video 0
makedev radio 64
makedev vtx 192
makedev vbi 224

Reboot your system, and use dmesg (just type dmesg at the shell prompt immediately after
bootup) to see if your video device was detected. If it’s supported, and registered in the PCI BIOS, it should’ve been. Okay, so you’re ready to roll.

What about applications?
In true Linux style, the application scene is undergoing rapid change. When I went to look for applications for my new Intel Video Recorder four months ago, most applications out there wouldn’t compile cleanly with the (recent) v4l API–they were still bttv based. When I went fishing again last week, many were into a new release and based on the v4l API. 

Currently my favorite application, both for simplicity of use and features, is Xawtv
(www.in-berlin.de/User/kraxel/xawtv.html). It’s based on the Athena Widget set (the AW in
Xawtv) and has a neat GUI. Also, this software is pretty rookie-based—we managed to download, compile, run, and capture our first movie within five minutes. Just download the latest release’s (3.02)
tarball. And as root, untar it, make it, and install it.

tar xzvf xawtv-3.02.tar.gz 
cd xawtv-3.02
make
make install
./configure
Now to run it, (it puts the binaries under /usr/local/bin/)
usr/local/bin/xawtv &

Xawtv will give you an initial message screen and start up. Don’t get alarmed if you just see a blue screen (this is not Windows). By default, xawtv sets the source to be the television channel of your card. Find out what source your camera is attached to (peek behind the box at the card connector labels), and set the source to that type. Often Composite 1 would do the trick. Getting shaky pictures? Check the camera norm
(PAL/SECAM/NTSC) and set that. Xawtv grabs movies in AVI format, you can use any MPEG encoder (like
LSX, mpegencode, etc) to produce an MPEG clip. Xawtv also provides for command line options to grab and capture streaming video. If you’ve a TV tuner, you can also select different channels and watch MTV while touching up your photo using GIMP and debugging your latest project code. 

Linux is all about choice. For Video4Linux, Xawtv is just one of the many applications. You can find a whole range of v4l resources at www. exploits.org/v4l/, including Webcams and encoders. Some of the programs may not yet compile cleanly under v4l. There are also nifty gtk/qt-based tools (especially videocam capture) for the GNOME/KDE lovers.

The future
While the current Video4Linux design is simple and elegant enough, its too basic to support serious video capture and editing applications. So the API is undergoing an overhaul to Video4Linux II. Many people are porting their applications to this piece of beta code (Xawtv already has an experimental version based on v4l-II).

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.