AVI Movie Players and Capture
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).
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.
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.
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.
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.
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.
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Nice article, thanks for the
2 hours 51 min ago
- I once had a better way I
8 hours 37 min ago
- Not only you I too assumed
8 hours 55 min ago
- another very interesting
10 hours 48 min ago
- Reply to comment | Linux Journal
12 hours 41 min ago
- Reply to comment | Linux Journal
19 hours 35 min ago
- Reply to comment | Linux Journal
19 hours 51 min ago
- Favorite (and easily brute-forced) pw's
21 hours 43 min ago
- Have you tried Boxen? It's a
1 day 3 hours ago
- seo services in india
1 day 8 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?