Painless Multimedia For Linux
But getting Linux systems to run multimedia is far from easy. For example, Fedora Core 2 (FC2) out of the box " at least, as of when I first installed it last year -- lacked workable multimedia access. Similarly, a friend of mine with a Mandrake system hasn't gotten her multimedia to work at all, even after several months of trying. She is hardly the only Linux novice in this unenviable position.
Yet it is possible for Linux to support multimedia. In simplest terms, the solution is to install the following packages, players, and add-ons using yum or another automated installer in the specific order shown below:
- MPlayer plus skins pus w32codecs. This Linux movie player handles nearly all video formats.
- RealPlayer: And audio-video player that handles both streaming and MP3.
- xine: A multimedia player for DVD movies.
- Flash Player: A viewer for Web content created with Flash.
- In this TechBuilder recipe, I'll show you how to install these programs and get multimedia working on a Linux white-box system. Although installing these programs is no more difficult than installing a Linux backup, finding all the information and then telling a user how to do this -- and in what order -- is. In fact, it took me months to get all my multimedia stuff working. But by following the steps in this Recipe, you should be able to complete the job in a couple of hours, possibly less, depending on your download times. Let's dig in.
- Installation
- To start, you need root access. Some of this may be possible from a user account. But if someone else is administering the box, then installing this stuff is the admin's responsibility.
- This Recipe should be doable with whichever automated installation tool is included with your Linux distribution, most likely apt-get/synaptic (which can be installed on FC2) or urpmi. However, while the process of modifying the distribution entries in files is similar from one Linux distribution to another, you should consult your documentation for specifics and then Google for repository locations.
- id
- unit-1659132512259
- type
- Sponsored post
- If you use apt-get/synaptic, urpmi, or another automated installer instead of yum, use your installation tool of choice to install all the packages in the order given in this article. That way, you'll make sure all dependencies get handled. By the time you finish, you should have a Linux box that can handle all of the usual multimedia types.
- How To Update yum Repository Configuration Files
- The automated installer will look for the installation and files needed for a successful multimedia installation.
- Make sure your yum repository configuration file contains enough of the right repositories. That way, the applications you want, and the dependencies you'll need to install, will be visible from the yum automated installer program. Try skipping the update to see if you can install successfully. If that's the case, then you don't need to update. Or, if you're experienced with yum.conf, simply cut-and-paste whatever individual repositories you lack.
- If you're using FC2 and have yum available as an automated installer, log in as root by opening a terminal:
su - root
pw:
- Then:
- Rename your current /etc/yum/conf file as yum-old.conf
mv /etc/yum.conf /etc/yum-old.conf
-
- On the Web, get a previous TechBuilder Recipe, Use Proxy Filters to Give Clients Online Privacy. In the article, find the yum.conf file listing, then copy everything between the two horizontal lines to clipboard.
- Paste this text into nano like so:
nano /etc/yum.conf
-
- Then right-click Paste after the last entry.
- Add the following after the end of the pasted text:
[macromedia.mplug.org]
name=macromedia.mplug.org - Flash Plugin
baseurl=http://macromedia.mplug.org/apt/fedora/$releasever
http://sluglug.ucsc.edu/macromedia/apt/fedora/$releasever
http://ruslug.rutgers.edu/macromedia/apt/fedora/$releasever
[livna-stable]
name=Livna.org Fedora Compatible Packages (stable)
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/yum/stable
#gpgcheck=1
[livna-unstable]
name=Livna.org Fedora Compatible Packages (unstable)
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/yum/unstable
#gpgcheck=1
[livna-testing]
name=Livna.org Fedora Compatible Packages (testing)
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/yum/testing
#gpgcheck=1
-
- Move the cursor to the end of the text, and hit Enter.
- Paste, save, and exit.
- Here's an example of what you'll see after a successful installation:
- By the way, if you see "invalid context" error messages in FC2 when installing, ignore them! The selinux security mods for Linux aren't supposed to be enabled on your distribution. The last lines that say Done, Updated, and Transaction(s) Complete tell you that it has installed correctly.
- Installing Multimedia Applications
- I.) Mplayer
- Note: Don't try opening mplayer until you've installed all four of the applications in this section, including w32codec. So type:
yum install mplayer
- You may see these error messages:
Package mplayer needs libaa.so.1, this is not available.
Package mplayer needs liblzo.so.1, this is not available.
Package mplayer needs libtheora.so.0, this is not available.
- Don't worry, just install the next package.
- II.) mplayer plug-in
yum install mplayerplug-in
- This will let you use mplayer with Mozilla to play embedded content. In the course of the automated installation, it'll clear the above "this is not available" problem by installing dependencies, as well.
- III.) mplayer-skins
- These are mplayer UIs. These make mplayer much easier to work with. Available skins will range from very minimalistic to an image of a physical video player with controls in the obvious places.
yum install mplayer-skins
- IV.) w32codecs
- Most multimedia content is in a proprietary format. Even MP3 is proprietary. Many distributions handle the licensing problem by simply avoiding it. But that means it's hard to see what the problem is, and how to cure it. So you may wind up with multimedia apps that, though apparently correctly installed, do not work.
- Once the codecs are installed, you'll be able to handle just about any common video (e.g. mpg, avi,.mov/qt, and wmv) and a number of audio formats.
yum install w32codec
- Open mplayer from the KDE Sound and Video menu -- or wherever your multimedia menu apps are on Gnome. It may show in a menu as either "mplayer" or "music player." If you don't like the default skin, right-click on the player display. Open Skin Browser. Then go through the choices until you find the one you like best.
- The following is the "phony" skin, simulating a physical multimedia player box:
- V.) RealPlayer (streaming)
- Like RealPlayer for Windows, this plays streaming video and MP3 files. The program is a static binary. Download it from Real.
- As root, cd to wherever you downloaded the file to.
chmod 777 Real*
- This makes sure the installer is executable.
./RealPlayer10GOLD.bin
- Follow the screen prompts. There is a first-time post-configuration setup assistant that will run. You may have to manually configure the script file realplay in /home/username/RealPlayer to provide the hxplay.bin location, as follows:
nano /home/username/RealPlayer/realplay
#!/bin/sh
# If you don't have readlink, fill in the path to hxplay.bin here.
HELIX_LIBS=/home/alizard/RealPlayer ; export HELIX_LIBS
- If you don't get a sound output, log in as root and type:
export AUDIO=/dev/dsp0
- This maps the AUDIO environment variable to /dev/dsp0, the most likely location.
- Here's how it should look when correctly installed.
- If all else fails, try the community support forums at Helix Community.
- VI.) xine
- This DVD movie player requires some mplayer modules, which is why you needed to install mplayer first. Here's what it looks like in operation:
- To install, type:
yum install xine
- After the xine install, find the decoder and other libraries, and chmod 777 them. So, as root:
locate xine
- Next, look for xine directories. These are based on the locations within my own system. Yours may vary depending on distribution or version. Here's how:
- Desktop stuff:
chmod -777 /usr/share/xine
- Includes decoders:
chmod -777 /usr/include/xine
- Includes plugins:
chmod -777 /usr/lib/xine/
- Then, run xine-check as root. The following is edited from the onscreen script output to eliminate redundancy, as most of the errors were due to a single program needing to be installed:
xine-check
xine-check Please be patient, this script may take a while to run...
[hint] DMA is disabled for your DVD interface.
This will probably result in a serious performance hit when playing DVDs. You can issue the command
hdparm -d1 /dev/hdc
as root to enable DMA. It would be wise to add this command to
some script that is executed executed at boot time.
Note that you probably have to set the DMA mode for your drive as well.
Most DVD-ROMs work fine with multiword DMA mode 2. You can use
hdparm -d1 -X34 /dev/hdc
[UDMA how-to snipped]
- If your system hangs or behaves very strangely after a few minutes, you should reboot immediately and never use this setting again on this machine. Good luck ;-) press to continue...
- On my workstation, my DVD device is /dev/hdc. xine-check should pick up any different DVD drive locations. Make sure hdparm commands as used match your DVD location.
- As root, test the hdparm DMA settings in the order above. If either works, make it permanent, because it'll speed your DVD drive access quite a bit. The result should look like this:
[root@terrarium xine]# hdparm -d1 -X34 /dev/hdc
/dev/hdc:
setting using_dma to 1 (on)
setting xfermode to 34 (multiword DMA mode2) using_dma = 1 (on)
[root@terrarium xine]#
- The following should work for most distributions:
nano /etc/rc.d/rc.local
- Add as the last line of the script:
hdparm -d1 -X34 /dev/hdc
- Then save and exit.
- If this doesn't work, try looking around on Linux Forums, or post a question on the TechBuilder Recipe forums.
- More xine-check - No problem entries skipped:
[ hint ] No xine-config found. Assuming xine from RPMs
The xine-config script can be used to deternime some file locations used by xine-lib, but you don't have such a script on your system.
However, it looks like you installed xine from the RedHat packages.
So I'll just guess that you are using the standard locations.
If you want me to be sure about those file locations, you can install the 'xine-lib-devel' package (or 'xine-devel', depend on what packages you're using, which contains xine-config. However, this package is not really needed to run xine...
[ good ] plugin directory /usr/lib/xine/plugins exists.
[ good ] found unknown plugin: *.so
[OUCH!!] There are no input plugins.
- [list of missing plugins]
You should probably reinstall xine-lib...
- The missing xine-lib-devel caused all three problems. The next problem was finding out which filename of xine-lib-devel is right for FC2. In this case, it is xine-lib-devel , and I found this out via Google search on: "FC2 xine-devel" and "FC2 xine-lib-devel." I then installed it with yum:
yum install xine-lib-devel
[ good ] /dev/cdrom points to /dev/hdc
[ hint ] /dev/dvd is /dev/dvd, not a DVD device
/dev/dvd is the default device that xine uses for playing DVDs.
You could make your life easier by creating a symlink named /dev/dvd pointing to your DVD device (something like /dev/scd0 or /dev/hdc).
If your DVD-ROM device is /dev/hdb (slave ATAPI device on primary bus),
rm /dev/dvd
ln -s hdb /dev/dvd
typed as root will give you the symlink.
- Do this if called for, substituting your DVD location for hdb if appropriate. Mplayer and xine appear to duplicate some functionality, so you still want to install both. Some files will work better on some multimedia applications than others.
- VI.) Flash
- This is Flash running a Flash animation in Mozilla:
- To install:
yum install flash-plugin
- The last step, courtesy of Macromedia Flash 7 for Linux FAQ:
[root@terrarium download]# /usr/lib/flash-plugin/setup
Registering flashplayer as a XPCOM component in
/usr/lib/mozilla-1.6
Setup is complete.
- This step may have to be repeated later. The FAQ is a good troubleshooting resource, should you need one.
- You may also find that other multimedia applications installed with your Linux distribution or Windows manager -- KDE, Gnome, etc. -- will start working after you've installed the above applications. For instance, xmms and kaboodle (a KDE music player) started working for me after I installed the applications mentioned here. Don't be afraid to try them. Look for a Sound/Video, Multimedia, etc., folder on your Start Menu. This is especially true if one of the above applications doesn't work on a specific file.
- Making sure your multimedia apps can be opened from your GUI.
- For the most part, these applications will install with desktop icons or menu items in your Start Menu Sound/Video folder, giving easy GUI access.
- If, while using the KDE window manager, you don't get a desktop icon or menu entry, simply create a new desktop icon by doing the following:
- Right-click and hold the mouse button down on any blank area in the main part of the desktop Then click on Create New > File > Link to Application.
- On the General tab, fill in the application name. Then click on the square under the General tab with a generic icon in it. A Select Icon window will appear with a collection of icons in it; the System icons will be selected by default. Look through the icons to see if you can find one that matches your program on the default System Icons.
- If you do find one, double-click on it. The icon will appear. If that doesn't work, select Other icons and do the same. If you can't find one there, then use Browse and go to the directory in which the multimedia application files are contained; look for an icon there. If you don't find an icon specific to the application, find any one that seems appropriate and not already in use on the Desktop, and use it.
- Click the Application tab. Fill in the Command line with the command-line command for the program you want to run from the icon. The other entries are optional and self-explanatory.
- You can find more information on adding desktop application launchers to gnome on this Gnome Project page.
- Finally, I recommend that you update all that you installed every 90 days or so. To do this, login as root and then, for example:
yum update w32codec
- Now you know how to keep your customers and users happily running multimedia on their white-box Linux systems.
- A. LIZARD is an Internet consultant in the San Francisco Bay Area. He has writen for technology magazines and Web media since 1987.