Debian Multimedia Howto
Posted by jrswift on January 26, 2008
This is a bit of an experiment as I am actually composing this entry offline in a word processing program (OpenOffice) and then uploading it to my blog. Don’t know if it will look better but it should give me the ability to edit it a bit more and maybe add a few bells and whistles. As always, we shall see.
The purpose of this article is to talk about what I do to get Debian GNU/Linux up and running and the tricks I have learned along the way to make it easier. While there are other articles like this that purport to do the same thing, I have always had to hunt around amongst several of them to get things working the way I like it. Hopefully my experiences will be helpful to others and allow some people to read one article instead of twelve.
For todays purposes, we are assuming a fresh install of the current “stable” version of Debian which is known as Etch. Many, if not most, of the instructions would also apply to running the “testing” version of Debian currently known as Lenny or even the “unstable” version which is always called Sid.
I will only briefly touch on the installation process as this is covered fairly well elsewhere and is similar to an install of any other Linux distribution. For most people, the correct version of Debian will be the same as the one I used which is the “i386” (sometimes simply called x86) version. This is pretty important as many of the instructions won’t work with the versions designed for other processors and also because you need to make sure that you download the correct version for your computer. Some of you may be tempted to try the “amd64” version if you have a 64-bit processor but using that version will give you a few more hoops to jump through in order to get everything “working” the way you’ll probably want. The “i386” version will also work on your system and is simpler to set up.
You might notice that the full Debian CD set is over 20 discs but you don’t really need most of them. Debian has an enormous number of packages that it maintains and a full set of CD’s includes all of them. The exception might be someone without a regular internet connection or someone using dial-up. For those people, purchasing a set of Debian CD’s might be a good choice. For most anyone else, the best option is downloading a small netinstall disc which can easily be used to start the installation process. The rest of the packages you might want can be downloaded during (or after) the installation and will be updated if there have been any security issues since the last official Debian release. The netinstall disc is only about 200 MB and contains enough information to boot the system and set up the base system and networking. From there it will offer to add more programs from an ftp mirror near you. Assuming you select the default choices, you’ll find yourself downloading about 700 packages which will give you a good base installation as well as the GNOME desktop and several useful programs including the popular OpenOffice suite which I am using right now. Most of the other popular open source programs like the Gimp graphics program and the Firefox web browser (here known as Iceweasel for mostly political reasons) and numerous others are also included.
(An important sidenote here: Debian, as well as most recent Linux distributions does a very good job of recognizing and supporting most modern hardware. There are exceptions. Those of you with high end graphics cards from Nvidia or ATI may find that the current video drivers do not do a good job of supporting your display. Both companies provide Linux drivers but they are not included in the Debian installation so you will have to manually install them if you wish to use them. I have (thankfully) not had to deal with this problem so I will not cover this process. The other major issue is with wireless cards. The manufacturers of most of these cards have not done a good job of providing drivers nor have they provided the Linux community with the specs that would be needed to create open source drivers. This is a particularly tough issue with laptop computers where portability is severely compromised when you must remain tethered to a corded internet connection. It is one of the major challenges that must be overcome if Linux is going to continue to grow as a mainstream operating system for home users. This is another issue I have not had to deal with so I will not discuss it either. Both of these problems are well known and a quick Google or two should provide some possible solutions.)
Most of the modifications that I will discuss involve overcoming one of the major obstacles that people have with using any Linux system and that is being able to enjoy the tremendous variety of multimedia available on the web. There are several smaller distributions out there that do a better job of including the necessary programs, libraries and codecs required to play most all of these multimedia formats but none of them have either the history or stability that you find in Debian, Suse or Redhat (CentOS) and none of these large distributions provide these formats installed “out of the box.” The reason for this is that many of these formats are non-free and require (at least in some countries like the USA) payment of a royalty to the patent holder in order to be distributed. Furthermore, many people in the Free Software movement are opposed to using these non-free codecs and distributions like Debian or Fedora have been particularly strong in avoiding the use of any of them in their releases. I will say that I personally use free multimedia formats whenever I can and rip my music as ogg vorbis files and subscribe to podcasts in that format whenever possible. Sadly, most of the multimedia on the web is not available in these free formats so I compromise.
I must point out that, at least technically, some of the advice given here may be illegal in your country (in particular in USA) so take it at your own risk. It is offered as there are many other nations where such restrictions are not in place. In particular, it is considered a violation of the DMCA (Digital Millennium Copyright Act) to evade the copy protection that prevents your DVD drive from playing most any commercially available DVD movie. Keep that in mind as your read this.
The first thing we are going to do is go ahead and change our apt sources. In plain English, we are going to make sure and enable our package manager (apt-get, aptitude or synaptic) so that it will be able to download the necessary packages we will need for our multimedia enhanced version of Debian. You will have to edit a file by hand in order to do this but the instructions are fairly simple and, if you follow them, you should have no problems. The file you will need to change is located in your etc directory. To edit it, simply open up the terminal program listed under the Accessories category of your Applications list. The GNOME terminal will pop up on your screen. In order to make these changes, you will have to become “root.” To do this simply type “su -” without the quotes and hit enter. You will then be asked for your root password. Type it in and hit enter again. Next, you will type the following “nano /etc/apt/sources.list” and wait for the nano editor to come up on the screen. I use nano here as it is a very simple editor for a newbie to navigate. Feel free to use another if you prefer.
You should now see a fairly short list of deb sources. The CD Rom you installed from may be listed here and you should probably comment that out by placing a hashmark (#) in front of those lines. When you have finished, your list of sources should look something like this:
# deb cdrom:[Debian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21]/ etch contrib main
# deb cdrom:[Debian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21]/ etch contrib main
deb http://www.debian-multimedia.org etch main
deb http://ftp.us.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.us.debian.org/debian/ etch main contrib non-free
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
Don’t be concerned if you have a different listing under the cdrom category as you may not have used the Netinstall Disc and don’t be concered if the ftp site is not the same as mine as you may have chosen a different mirror during the installation process. The main thing to check is that the main deb source has the words “contrib” and “non-free” listed in addition to “main” and that you have the debian-multimedia source added. After you’ve finished editing the file, type CTRL-X and hit enter. Type yes when it asks if you want to save it and save it to the same file name. Now you are almost done. I would tell you to simply type apt-get update or aptitude update at this point but, if you do so, your system will complain that you are installing programs from an untrusted source. This is annoying and there is an easy way around it…well, fairly easy.
The problem lies with our “foreign” apt-source which is on the debian-multimedia site. It is important (particularly if you want to play dvd’s) as you will need packages not available in the main Debian repositories. In order to avoid these annoying messages, you will need to import a key so that your package manager will recognize this repository as “safe.” To do this visit the debian-multimedia website at http://debian-multimedia.org. On the main page, you will see instructions on how to import a key for this repository. Simply download the key “debian-multimedia-keyring” and save it in a place you’ll remember. Then open up your terminal again if you have closed it. Navigate to the correct folder and then type the following “dpkg -i debian-multimedia-keyring_2007.02.14_all.deb” and hit Enter. Be sure you are still logged in as root when you do this or it will fail. Once the key has been installed, you can safely update your system. I prefer to use “aptitude update” but you can also use “apt-get update” or simply open up the Synaptic program listed Desktop under Administration. For simplicity’s sake, I will encourage you to use Synaptic for these installations. So log out of the terminal and open Synaptic. It will ask you for your password again so type it and hit Enter. Now we can start with the fun.
Since most of the multimedia we are going to be viewing is going to be in our browser, you are going to be installing a few browser plug-ins that will, fortunately, bring along a number of other programs you will probably want anyway. Before we do that, make sure the system is updated if you haven’t already. Click “Reload” and then “Mark All Upgrades” and, if there are any updates, you’ll click “Apply.” Wait for all of the updating to finish and, when it does, click on “Search.” The first thing we will search for is “flash.” One of the packages that will come up is “flashplayer-mozilla” and you will want to install it. Once you’ve marked it for installation, you can simply continue on to find the other packages you’ll need. In addition to flash content, you’ll also want to be able to view any Quicktime, Real Media or Windows Media files. The best way to do this (in my opinion) is with the mplayer plugin. Search for “mplayer” and then mark “mozilla-mplayer” for installation. This will bring along a number of other packages and you’ll need them. This plugin will do a pretty good job of playing these proprietary formats but you can do a little better in one instance and that is by installing the Real Player for Linux. So do a search for it and mark “realplayer” for installation. There are a couple of other packages you’ll probably want for basic multimedia and that is “ffmpeg” and “w32codecs.” Search for and mark them as well. Finally, you are likely going to want to have java installed so you can utilize any java content on web pages. Linux comes with a number of different forms of java but you will want the original from Sun.
Search for sun java and mark “sun-java5-plugin” for installation. It will bring along the other packages you need. (If you like, you might also install the acroread program which will give you the free Adobe Acrobat Reader. I used to do this but have since found the the Evince Document Viewer that is installed in Debian does just about as good a job and is a lot less of a resource hog so I just use that when I encounter a pdf file.) At this point you are going to have a lot of packages marked so just go ahead and click “Apply” and install them. This may take a while depending on how fast your internet connection is. When it comes time to install java, you will be prompted to agree to the licensing agreement in order for it to install so don’t just walk away from the installation process.
After all these packages have been installed, you can open up your web browser (Iceweasel/Firefox is probably what you are using but Iceape/Seamonkey will work too) and open a new tab. Simply type “about:plugins” and hit Enter. You should now see a large number of plugins accessible to your browser and you can feel free to test them out if you like. If you do so, you’ll notice an annoying thing that happens when you try to open a Real Media file: Real Player will not open up but, instead, the mplayer-plugin will try and play it instead. Some of the time, it will be successful, but not always. Fortunately, there is a work around that will make those files open in Real Player. First off, if you haven’t already started the Real Player program, do so now. It will be under Applications in the Sound & Video section. I believe you’ll be prompted to accept a license agreement but I don’t remember for sure. You will be asked if you want to check for updates and configure browser plugins. The answer, of course, is yes. This should place the Real Player plugin in your browser but that won’t solve your problem. Mplayer will still try to play these files unless you specifically tell it not to. So go test the plugin by trying to play a Windows Media file in your browser. It will probably play but, whether it does or not, the little “mplayerplug-in screen will pop up. Hover your mouse over it and right-click. When the menu pops up, click on configure. Now uncheck the boxes that say “Enable RealMedia Support,” “Enable SMIL Support” and “Enable Helix Emulation” and then click OK. Now those files should open with Real Player instead. Remember I said “should.” There is one more step. Even though you’ve told mplayer not to play these files, that isn’t what your browser thinks. It has created a file that tells it what to do when it encounters certain types of files and you are also going to have to change that. It sounds complicated but it isn’t. Open a terminal but don’t become root. Type “ls -a” and look for the directory that is called “.mozilla” and change to that directory. Once there, simply type “rm pluginreg.dat” and hit enter. This will remove the (now) faulty configuration file that was telling Firefox (Iceweasel) to use mplayer when you wanted to use Real Player. Don’t worry. The file will recreate itself but now it will do what you want it to do…almost. If you close and then restart your browser and try to open a Real Media file of some sort, you will get a message asking what you want the browser to do with this type of file. It will probably suggest opening it with some program but you want to choose to “open it with another application” and then you will have to choose a custom command and browse for “usr/bin/realplay.” When you find it, you also want to tell Firefox to use that application from now on when encountering that type of file so click that box. From now on, Real Player should pop up whenever you click on a Real Media file. Complicated…well, a little. But now you have a mostly functional multimedia browser.
If you want to install DVD playback, there are a few packages that you’ll want to install. If you haven’t added the debian-multimedia repository, you won’t find them all so be sure to do that if you want to continue. Open up synaptic again and do a search for “dvd” and cllck on the libdvdcss, libdvdnav and libdvdread packages. I would also recommend installing vlc as I think it is the best program for watching DVD’s once you’ve enabled that function. Mplayer, Totem and Xine will also work but vlc is better. Try the other programs if you want but I believe you’ll prefer vlc. Now apply the changes and wait. You should now magically be able to watch most any DVD you can throw at your drive. Again, keep in mind that doing so may technically violate the law depending on where you live so I’m not advising you to do so. I’m just telling you how you can.
Well, there you go. That’s how I make Debian “work” better, particularly as regards multimedia playback. Hope that this was helpful to you and I welcome your comments as suggestions.