Unfortunately, for various reasons — mostly having to do with copyright laws, and other such nonsense — a lot of audio and video won't work “out of the box” with Ubuntu, or most Linux distros. So there are some things you will need to download, in order to get things working.
This article will give a brief explanation of what a “codec” is — and why you need codecs — and how to get the necessary ones installed on your system.
If you're very new to Ubuntu, and aren't familiar with packages and all of that nonsense yet, see the Advanced Packaging Tool article, first, before you tackle this. (Or just follow along and do exactly as I say, and trust me that I'm doing the right thing.)
This page was written for Ubuntu 7.10 (Gutsy Gibbon). If you have an earlier version of Ubuntu, the instructions will be very different, and if you have a later version, the instructions might also be different.
I've noticed that these instructions have changed drastically from version to version of Ubuntu. On the bright side, they've always changed in a way that this is getting simpler and simpler to do.
What is a “Codec?”
Audio and video files are analog, by nature, while computer files are digital. So in order to store audio or video in a computer file, it needs to be encoded into digital. A codec is a converter, which can convert digital to analog or analog to digital. (The word “codec” is short for “COde-DECode.”)
There are many different codecs available. In fact, there are various categories of codecs, each of which can have its own variants. For example, if you use Windows, you've probably seen AVI files — movies ending with the extension .avi — which are a particular kind of movie file. However, there are many AVI codecs available; even if your computer can play AVI files, it still might not be able to play a particular file, if you don't have the right codec.
This article has intructions for getting Ubuntu up and running, with the audio and video codecs you'll likely need, to play the types of files you're used to playing on Windows.
The First Step
With Ubuntu 7.04 — Feisty Fawn — they introduced a new application you can installed, called Ubuntu restricted extras. This will install some of the things you need to install, to get up and running.
I've read some documentation that claims this package is enough to get you up and running, watching DVDs and playing MP3 music. It's simply not true. But it is a good first step…
Go to Add/Remove Applications, and choose to install the program called Ubuntu restricted extras. (At the top of the window, there is a “filter” on the types of software that are shown; you'll have to change that filter to show “All available applications,” for this option to appear.)
When you select it, you may be warned that this is “unsupported” and “restricted.”
Tell Ubuntu to go ahead and install it anyway.
The Audio Codecs
With Ubuntu 7.10, this is all you have to do to get audio working. MP3 music will play, and you'll be able to rip CDs to MP3, using Sound Juicer.
Installing Video Codecs
At this point, you have installed all of the codecs you need for watching videos; things like .mpg and .avi videos. However, there are some things you'll also need to install, to get DVDs working, because you have to worry about something called the Content Scrambling system (CSS), which is built into DVDs. Any player which is going to play back DVDs is supposed to pay a fee to the DVD Copy Control Association, for permission to play back CSS-encoded disks. You can download DeCSS, which is software to get around the CSS software, but DeCSS is in a bit of a legal grey area. (Are you starting to see why some of these things aren't installed with Ubuntu by default?)
Assuming that you want to take the legal risks, here are the instructions for getting DVD playback running on Ubuntu.
First, you need the totem-xine package. Open the Synaptic Package Manager again, and search for totem-xine. In this case, there is only one package; install it. It will prompt you that it needs to add some dependent packages, and possibly remove some packages:
The screenshot above is old; on a fresh install of Ubuntu 8.04, a lot more packages were installed, and none were removed.
This is okay; continue with the installation.
Once that's done, you should also install these packages, also from the Synaptic Package Manager:
- libdvdnavX (at the time I wrote this, it was libdvdnav4 for me)
- libdvdreadX (at the time I wrote this, it was libdvdread3 for me)
Some of these may already be installed, in which case you can ignore them and install the others.
Finally, we need to install the software for working with CSS. Open a Terminal window, and find the install-css.sh script, and execute it. You might need to do some hunting around, to find it; it will be somewhere under /usr/share/doc/libdvdreadx. For example, on my system, I used the following command:
$ sudo /usr/share/doc/libdvdread3/install-css.sh
Once you've done this, when you pop a DVD into your DVD drive, Totem should start up, and play the DVD.
Actually, I don't really use RealPlayer that much, so I haven't installed it on Ubuntu. If/when I ever do, I'll come here and complete this section.