AVI Movie Players and Capture

Robin continues to test video and audio players for Linux.
Some Video Players for Linux

XawTV is a popular application for watching video on Video4Linux devices. Video4Linux (V4L) enables many different video capture cards to be used interchangeably in applications. Hauppauge WinTV is one of the most popular inexpensive TV cards (less than $70 US). Other comparable cards are based on the same Conexant chipset (formerly Rockwell Brooktree).

The XawTV Video Player

The XawTV Config Screen

Ralph and Marcus Metzler created the first bttv Linux driver code to work with Brooktree BT848-based TV cards. Gerd Knorr eventually took over development, creating the bttv-0.7.x series drivers. He also created and continues to maintain XawTV. Alan Cox developed a generic video architecture called Video4Linux that was influenced by ideas in the OSS sound drivers. He developed V4L around the bttv driver and brought it into the Linux kernel. The original bttv driver is no longer supported and has been replaced with the V4L version maintained by Justin Schoeman.

V4L2 is a substantial rewrite of the bttv driver for Linux. According to Justin Schoeman's web page (http://sourceforge.net/projects/bttv-v4l2/), the aim of bttv-v4l2 is to support high performance video capture on Bt848/878-based video capture cards. Bill Dirks is responsible for the current development of the V4L version 2 architecture (V4L2). He developed the capture API and made architectural changes to better accommodate a variety of hardware devices. His web page, http://www.thedirks.org/v4l2/, has more information.

When building and installing the bttv driver (as we did in this column in the April 2001 issue of LJ), we encountered something called the i2c driver. This perplexed us at the time because we couldn't get it to work, and none of the V4L web pages say what it does. Looking more closely at Gerd Knorr's web site, we noticed that we needed a 2.3 or newer kernel for i2c and therefore had to do a minor patch to Debian Potato's 2.2 kernel. We had the fix but didn't understand it.

Talking with Bill Dirks finally solved the mystery for us of what the i2c driver does. TV cards have tuners, and they have their own communications bus called i2c (or iic), defined by manufacturer Phillips. It is a three-wire synchronous serial bus (clock, data, ground) that communicates between the tuner and other components on the card. It is the PCI bus that talks to the i2c. Another place an i2c bus is used is on the PC motherboard so it can talk to the temperature sensor for the CPU.

Although it is still experimental, Bill Dirks recommends using V4L2 unless doing so causes a problem. V4L is more bttv-centric, but apps may use either Video4Linux version transparently. The videodev driver loads the device specific driver in V4L. In V4L2, the driver loader may be videodev or videodevx. The V4L2 videodev package works only with 2.2.x kernels and supports only V4L2 drivers. The new V4L2 videodevx driver works with 2.2.x and 2.4.x kernels and supports both V4L2 and V4L device drivers.

V4L is included with the kernel. To get V4L2, you need to install something extra. Because the version of V4L with Potato is so old, we did that anyway. However, we finally went with V4L because we were scared off by the newness of V4L2. We haven't followed Bill's advice yet to switch to V4L2, which may have something to do with some difficulties we had testing video capture.

We built the AVI players from source, either because we wanted the latest version or because no deb package was available. The procedure is to search on freshmeat.net for the project, use tar xvfz or xvfI to unpack it (depending on whether the file is gzipped or bzipped), then build it. Building is typically done the GNU way: ./configure, then make and make install.

MPlayer was deemed the most stable MPEG player in our evaluation last month, although the 0.11 version we had wouldn't play AVI files. The new version does. It does a pretty good job, but it is obvious that AVI support isn't as mature. Some files didn't play, some had no video and one even played upside down.

In theory, MPlayer can play any video that Microsoft WMP can because it tries to use WMP codec plugins copied into the Linux /usr/lib/win32 directory. However, tricking the WMP plugins to work in Linux isn't entirely perfected yet, and MPlayer continues to suffer from a spartan command-line control interface.

You can't resize the player window, which will annoy most people accustomed to viewing small videos at double size. You also can't get a video to repeat, and quitting doesn't seem to respond very fast.

There is no version number for MPlayer anymore; you can only download a daily CVS snapshot. We had serious trouble getting that to build due to a problem with our gcc compiler. We received a somewhat cryptic message from gcc about an install problem, and it couldn't execute cc1plus, the g++ front end. However, g++ seemed to be installed correctly. The problem went away when we installed a newer version of gcc (2.95.3-5).

XAnim is popular for viewing both MPEGs and AVIs. It uses plugins but not the Win32 dll ones. It offers its own cross-platform plugins for H.261, H.263, Indeo and Cinepak. Although not many are offered, the docs say the plugins run on Intel, Alpha, PowerPC, Sun and SGI hardware. According to the XAnim web page, the plugins are proprietary, developed under NDA.

The XAnim Player

XAnim worked okay but couldn't play as many AVIs as MPlayer. However, the user interface in XAnim is better. We wanted to try the latest version of XAnim, but we had trouble building it. Building XAnim requires first installing the Imake generator xmkmf. It's supposed to be included with the X Window System development libraries, but we couldn't find that. Later we noticed that the MPlayer web page says those libraries are called lib6g-dev in Debian.

The XAnim User Interface

Two other players we didn't get built are aKtion and Kmpg. We are running an older version of aKtion, but it has some problems playing AVI files. We couldn't build Kmpg 0.5.4 because it didn't like our system's too-new version of libqt (2.2.4 instead of 1.x). Not having KDE headers was the build error reported by aKtion 0.4.1. Xtheater 0.9.1 built but wouldn't play any AVIs.

Avifile 0.53.5 is a library for playing AVI files. It comes with two sample applications, Aviplay and QtVidcap. Using Aviplay offers a somewhat different interface than XAnim but is a similar experience. XAnim doesn't seem to use Avifile. MPlayer doesn't use Avifile but they do have the Win32 DLL loader in common. Both seem a bit more reliable than Aviplay.

Aviplay

The QtVidcap capture program looks enticing, but we couldn't get it to work. When it started to capture a file it would fail. We hope it will do better after we install XFree86 4.x and V4L2.

XawTV succeeded in capturing AVI files, but its power seemed feeble compared to the same task in Windows with Windows Media Encoder. XawTV only encodes 15-bit and 24-bit RGB or MJPEG codecs. XAnim was the only player that could play all three XawTV formats. The other players tended to balk, except for MJPEG. Aviplay didn't like any of them. We had trouble playing the files in Windows and wondered if the fault was in the capture. The Linux players did better with Windows-captured video, provided that the codec wasn't too new.

The QtVidcap Program

The XawTV Options Window

Two things puzzled us when operating XawTV: adjusting picture size and sound. You must size the window to the size you want to capture videos. Anything larger than 320 x 240 pixels at 15fps gave us problems. We had no sound until it dawned on us to select “line input for record” in gmixer.

Next month we will upgrade our Debian Linux installation from Potato to Woody, giving us the more multimedia capable 2.4 kernel and XFree86 4.0 GUI. We will also upgrade our device drivers to V4L2.

Robin Rowe is a partner in MovieEditor.com, a technology company that creates Internet and broadcast video applications. He has written for Dr. Dobb's Journal, the C++ Report, the C/C++ Users Journal and Data Based Advisor. His software designs include a client/server video editing system in use at a Manhattan 24-hour broadcast television news station, Time Warner New York One and associated web site http://www.ny1.com/. You can reach him at robin.rowe@movieeditor.com.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

hi ,bla bla bla

Anonymous's picture

hi ,bla bla bla

Re: GFX: AVI Movie Players and Capture

Anonymous's picture

it's cool man. cool

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix