by

Installing Media Codecs for MP3, WMV, WMA, ACC (MP4, M4A), DVD, Quicktime (MOV) and Flash in Ubuntu

Ubuntu is distributed without codecs to play many of the most prevalent media formats due to license restrictions. If you want to watch DVDs (unencrypted and encrypted), run Flash (.swf and .flv extensions), play QuickTime movies (.mov ), watch Windows Media Video files (.wmv), listen to MP3s (.mp3), Windows Media Audio files (.wma), or unencrypted ACC songs (.acc, .mp4, and .m4a) you have to install some codecs. Luckily, these codecs are easy to install.

Step 1: Add Medibuntu to Your Repository List

Several of the codecs installed below are not in the default Ubuntu repositories. They are instead in the Medibuntu repository. Open a terminal and use the wget http file retrieval program to add a path to the Medibuntu repositories to your system source list. (Note that the following command has wrapped to a second line, but it is a single commands and should be typed without any carriage returns.)

sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list -O /etc/apt/sources.list.d/medibuntu.list

This command writes the path to the Medibuntu repository to a file called medibuntu.list in the appropriate directory.

Next you have to install Medibuntu's GPG key to ensure proper authentication.

sudo apt-get update
sudo apt-get medibuntu-keyring
sudo apt-get update

When prompted, type "Yes" to complete the package installation.

Step 2: Install Flash Plugins for Firefox

To start viewing Flash videos with Ubuntu, you have to install the Flash browser plugin. The following command should do the trick.

sudo apt-get install flashplugin-nonfree

I know this installs the plugin for Firefox. If you determine that this command works for other browsers as well, please leave a comment below.

Step 3: Installing Audio and Video Codecs

You can get most audio and video file formats working by installing a single package from the Medibuntu repository. If you are using a machine with a 32 bit processor, type the following command in the terminal.

sudo apt-get install w32codecs

If you have a 64 bit processor, replace w32codecs with w64codecs. If you have a PowerPC based machine I believe the appropriate package is ppc-codecs. If you install this codec and still do not hear sound when playing media files, make sure that your speakers are not muted. I discovered that by default my machine had sound muted. You can easily change volume levels by right clicking on the speaker icon in the status bar at the top of the screen.

Step 4: Installing DVD Playback Packages

The following command installs packages needed for DVD playback and DVD menu navigation functionality.

sudo apt-get install libdvdcss2 libdvdread3 libdvdnav4

However, before most DVDs will play, you need to set the region code of you DVD drive. Install the regionset package.

sudo apt-get install regionset

Next, put a DVD encoded for your region in the DVD drive and type the following at the command prompt replacing the XXXXX with your DVD drive's device name. (Mine is cdrom1 and yours is probably something with a similar prefix but possibly a different trailing number. All of your devices are listed in the /dev directory. If you type the wrong device name the regionset command will fail to compete and you can just try again.)

regionset /dev/XXXXX

When prompted enter your region code number (The United States and Canada are region 1).

Step 5: Installing DVD Playback Programs

Ubuntu is distributed with Totem for viewing video, but Totem is very bad at playing DVDs. For example, Totem does not include support for DVD menus. Two alternative programs are Xine and the related Totex-Xine. I prefer Xine but it is a little more difficult to configure (more options) than Totem-Xine. I recommend installing and trying them both. The following command will install Xine with some supporting codecs.

sudo apt-get install xine-ui libxine-extracodecs libxine1-ffmpeg

To run Xine type xine at the command prompt or navigate to Applications > Sound & Video > xine. The following command will install Totem-Xine and a Totem-Xine Firefox plugin.

sudo apt-get install totem-xine totem-xine-firefox-plugin

After these packages finish installing, type totem-xine at the command prompt to run the program. That it. Enjoy listening and viewing your favorite media on Ubuntu. If you know of packages that I omitted from this guide but would enhance the Ubuntu user experience, please leave a comment below.

1 Comment


  1. // Reply

    I recommend Avdshare Audio Converter which can batch Convert M4A Audio Files to WMA or Convert WMA to M4A.

Leave a Reply

Your email address will not be published.