12. Multimedia Part 2 - Linux and Video
12.1 Introduction
Like most other Linux programs, the video-media playing applications have matured
greatly in the last couple of years, and it's now possible to view any
reasonably common type of video file under Linux. But don't think that viewing
video clips is as simple as say, playing music files; while the vast majority
of music is in two or three common formats (mp3, vorbis, wav), video files are
commonly produced with a variety of formats and codecs (more on codecs later).
This means that those users who view lots of video from a variety of sources
may have to occasionally download and install additional software in order to
play the various formats. On the other hand, casual users will probably find
that the distro-supplied multi-purpose media apps will satisfy their
requirements.
In the paragraphs below, I'll try to explain some of the jargon
you're likely to come across when dealing with video files and media players.
Don't worry too much about this if (for example) you just want to play the
occasional mpeg, you can safely skip ahead to the Linux Media Players section.
12.2 File Formats and CODECs
12.2.1 File Formats
Anyone trying to play or download video clips from the internet will soon
discover that there is no standard (or even defacto) file format. Unlike music
files, which are dominated by mp3s, it's not unusual to find video files in
mpg, wmv, mov and rv formats, as well as several others. To complicate matters
even more, there can be a variety of file types even within a single format;
so just because you can play some .mov files (for example), doesn't
necessarily mean you can play all of them. In other words, instead of
referring to a specific filetype, filename extensions can be a wrapper for a
variety of filetypes. And this is where codecs come in...
12.2.2 Codecs
In the context of multimedia, codec is short for compressor-decompressor
(it's also used as an abbreviation for coder-decoder, but that's a different
story...). In simple terms then, we could say that the codec is the algorithm
or software routine used to compress or decompress a media file. The important
point to remember is that if a particular codec is used to create a file, that
same codec will be required by your media player to play the file. And as we
mentioned earlier, there may be several types of codec that can be used with a
particular file format, so not all files of the same format will necessarily
be playable by your media player. In practice, you could probably think of
codecs as being the library files or plug-ins that you download and install to
enable your media player to handle a particular type of file. Most players
will come with a variety of codecs included, while others are available on the
net. Some players can even make use of MS Windows DLLs.
12.3 Streaming Media
Streaming video and audio is becoming increasingly common on the web, and
streaming simply refers to the way the file content (or data stream) is fed
directly into a media player or browser plugin instead of being first
downloaded to disk. The advantage is that the contents are displayed
immediately, so that you don't have to wait for the entire file to be
downloaded before you can view it. In effect, you view the file as it is being
downloaded. There is an obvious disadvantage to this however; you need to be
able to download the file at least as quickly as your viewing program plays
it. And because of this, there are limitations to streaming media files over a
dial-up connection.
12.4 Some Common File Formats
The list below includes the most commonly encountered formats, but is by no
means exhaustive. All the formats mentioned can be played under Linux, though
some may require closed or proprietary software.
12.4.1 mpg (or mpeg)
The group of file types known as mpegs include the
type 1 and 2, which are very widely used video files that are quite compact.
Type 3 mpegs are better known as the ubiquitous mp3 sound files, while the
newer type 4 mpegs are high quality, streamable files that are closely related
to the DivX codec
.
12.4.2 AVI (Audio Video Interleaved)
The original
avi file is an older, uncompressed format not seen so often on the net now,
but still used on some CDROMs. Basically a slideshow of images, with audio
data interleaved. Not streamable. Note that some other codecs such as DivX
also now use the .avi suffix.
12.4.3 DivX (.avi)
A patented codec from DivXNetworks and based on Mpeg-4
standards. DivX files are of a high visual quality and highly compressed.
DivX codecs are available for Linux media players.
12.4.4 Mov (Quicktime)
There are several variations of Quicktime, perhaps
the most common now being the Sorenson codec. Until fairly recently, it was
difficult or impossible to play files encoded with this proprietry codec under
Linux, though now players such as mplayer are able to utilise MS Windows .dlls
to play them without problems.
12.4.5 RealMedia Video (.rm)
This streamable format from RealNetworks is
fairly popular. The Linux version of RealPlayer has all the functions of the
Windows version. RealServer is also available for Linux.
12.4.6 Windows Media Video (.wmv)
This is a Microsoft format that uses
the Windows Media Player. Files can be downloaded and played from disk or streamed.
12.4.7 ASF
Microsofts Advanced Streaming Format is similar to the wmv
above, but specially designed for streaming applications.
12.4.8 Shockwave Flash (Flash, .swf)
The Shockwave Flash format is an extremely popular way to make web animations, cartoons, games etc.
12.5 Linux Media Players
These are only some of the players you are likely to encounter - there are
many more available.
12.5.1 KDE Media Player (noatun)
A basic KDE media player that can handle
a few audio and video filetypes, including mp3, wav and mpeg-1 video. Some
other codecs can be played by installing plugins. Often installed by default,
noatun is part of the kdemultimedia package.
12.5.2 Xine
This is a very popular player that can be extended with
plugins to handle nearly any of the common filetypes. Xine is often installed
by default, or at least included on the distro CDROMs. As well as being able
to play many video formats, xine is widely used to play DVD movies, though
you'll probably have to install some additional components in order to play
encrypted DVDs. Xine comprises several separate packages; you need to install
at least two of these in order to use it, though installation should be
reasonably easy. The two main packages are xine-lib, which is the engine of
xine, and xine-ui, the user interface. There are other xine related packages
to allow the use of extra codecs and plugins, among other things. These should
be already installed on systems where xine is installed by default. In
general, xine is a very capable player, though I did find its controls a
little confusing. Some other players use the xine engine, but
with their own GUI.
12.5.3 XMovie
This is another player that's often included with current
distros, and can play most mpeg-1 and mpeg-2 video files, as well as a few
other video and audio files. Designed to be a player of high quality, high
resolution movies, it can also play VCD files and function as a rudimentary
DVD player. While it's somewhat limited when compared to xine or mplayer, it
does have a clear, easy to understand interface, and very good audio
capabilities. For many users who only need to view the occasional mpeg and so
on, xmovie will work nicely.
12.5.4 XMMS
Not just a music player, XMMS can also play some mpeg video
files when the smpeg plugin is installed, as it often is with default
installations. Click on Preferences > Audio I/O Plugins to see the list
of installed / enabled plugins. If it's not there, look for a package named
xmms-smpeg on your distros installation CDROMs. There is more information regarding
other playable/installable codecs at the XMMS homepage.
12.5.5 MPlayer
A versatile, heavy duty app, mplayer can handle nearly any
type of video. In fact it'll play anything that runs under Windows Media
Player, plus more. Mplayer is also widely used for playing DVD movies, and
while it's not usually included with distros (some include a stripped down
version), it is readily available from the web. The officially supported
version is available only as source code; though there are links to Redhat
RPMs as well at the main site. For those not comfortable with compiling from
source there are pre-compiled packages available from other sites. I found
RPMs for my Mandrake box at the PLF site; other sites such as RPMFind etc.
also have binaries. The only problem with installing mplayer from RPMs is that
you'll probably have to track down and install quite a few other packages in
order to satisfy dependencies - I actually found it much easier and quicker to
compile from source.
Compiling mplayer is easy, and only requires the three usual steps (assuming
you've already unpacked the archive into a temporary directory, and cd'd into
that directory):
./configure
make
and then, (as root):
make install
You should also install the win32-codecs package before building mplayer to
enable the use of many more codecs; the win32 RPM package is fine.
The instructions above are for the the bare-bones command-line version; if
you want or need a GUI you'll need to take a couple of extra steps, though
it's not complicated or difficult. See the excellent documentation at the
website for details. You can play a video file with the command line version with:
mplayer filename
or setup your file manager to start mplayer whenever you click on a video
file. In short, if you need to view a wide variety of video file types,
mplayer is hard to beat.
12.5.6 Mtv / mtvp
Mtv is a shareware mpeg player, and while mtv itself isn't
free, there is a free (for personal use) command line player named mtvp in the
mtv package. Mtvp is fast, light, and uncluttered, features that make it a
favourite for older or less powerful hardware.
12.5.7 RealPlayer
The Linux version of RealPlayer is fully featured, and
can play streaming video and audio as well as files from disk. In addition to
Reals' own rm and rv file formats, it can also play a few other commonly found
files such as mp3, wav, midi, some mpegs and some swf files.
12.5.8 Xanim
This one goes back quite a few years, and is not usually
supplied with current distros. It can handle some AVI and older Quicktime
codecs, plus there are other codecs packages available. Some other players are
also able to make use of the xanim codec packages. Xanim is the engine behind
Aktion, an older KDE app.
12.5.9 Macromedia Flash Player
A little different to the other players
mentioned above, this one is more likely to be used to play animations,
cartoons or even interactive games, rather than video clips. There are two
versions available; one is a web browser plugin while the other is a
stand-alone program (gflashplayer) that can play downloaded swf files.
Installation is easy, and consists of unpacking the archive and then running
the install script. Versions 6.0 and later are much improved and seem to be
much more reliably detected, so update if you have an older version.
12.6 Miscellaneous
As you can see, video playback isn't as simple or straightforward as many
other tasks, but this complexity isn't something peculiar to Linux; it could
even be argued that some of the Linux players are more capable than those for
other platforms. You'll probably also notice that some of media players that
are included with Linux distros ship with only some of their usable codecs or
features installed. This is because some of these features require closed or
proprietary components that can't be included because of licensing issues.
Other things - encrypted DVD playback being a well known example - may be
subject to legal issues when used under certain conditions. And because the
distro makers are unable to control how these tools are used, it's left up to
the end user to download these components and install them. You can often find
the relevant links at the respective media players homepage, or you can try
the links below. And don't forget Google; there's a huge amount of info out there...
12.6.1 Additional Resources
The Xine home page
MPlayer's Home page
Mtv homepage
Xmovie home
The XMMS Homepage
The RealPlayer Unix/Linux download page
Xanim Homepage
Macromedia's download page
PLF (Penguin Liberation Front) have a selection of files for various
versions of Mandrake that can't be included with the official Mandrake distro for whatever reason.
LinuxApps Multimedia listing
LinuxApps MPEG listing
This document was generated
on March, 5 2003
using texi2html