As most users are aware of, due to various reasons, most GNU/Linux distributions don’t include proprietary multimedia codecs by default, which is also the case with Ubuntu. But these days, as long as you have a reasonably fast internet connection, you can install these codecs easily by using a single command anyway.
However, if you have installed Ubuntu on a computer that doesn’t have an internet connection, then how can you install those codes for watching your naught ‘content’ ? (kidding! ). That’s where an ‘offline’ codec pack comes in real handy, and as long as you have access to another computer that has an internet connection, you can create one by yourself, without much difficulty!.
Things that you’re gonna need …
1. A computer with an Internet connection.
2. A LiveCD/DVD or a USB drive or any other media containing Live desktop session of Ubuntu.
3. Another storage media to copy the offline codecs (optional if you have a USB live session as you can save the file inside it).
For this example, I’m using Ubuntu 12.04 Precise Pangolin.
That’s pretty much what you nee.
Special note: Please remember that, an offline codec pack that you created using a certain version of Ubuntu (say 12.04 Precise Pangolin), can only be installed on another computer that runs the exact same version of Ubuntu.
Okay, let’s do it …
Step 1: First, boot into Ubuntu Live desktop session using the CD/DVD or the USB media etc in the computer that has an Internet connection. Once you log into the desktop, set up the network settings and make sure the Internet connection is up and running.
You can also use a computer with an existing Ubuntu installation, but, unless it’s a newly installed system, this might not work (due to dependencies issues etc). So I recommend always using a Live desktop session.
Step 2: Once that’s done, open the ‘Ubuntu Software Center’. If you use recent versions (11.04 and up) you should be able to find it from the ‘application launcher’ from the left side of the screen as shown below. If you can’t find, it then put the below command in your Terminal window to open it.
Step 3: What we’re trying to do here is to enable the repository (a server that holds software packages) that has the proprietary software. According to Ubuntu, this is enabled in recent versions, but in my 12.04, it was disabled for some reason. So anyway, once it’s opened, just to make sure, from the menu go to:
Edit -> Software Sources
Then, under the ‘Ubuntu Software’ tab, make sure the option called ‘Software restricted by copyright or legal issues (multiverse)’ is enabled as shown below. After that, click on the ‘Close’ button and also close the ‘Ubuntu Software Center’ itself as well.
Step 4: Now put the below command into the Terminal window.
sudo apt-get update
Step 5: After that, enter the below command to download the proprietary codec pack temporarily into the HDD.
sudo apt-get -d install ubuntu-restricted-extras
Optional: Only for those who wants to play encrypted DVDs (other users, please go directly to the ‘Step 9′)
Step 6: Please remember that, playing encrypted DVDs might get you into trouble as in some countries it’s illegal. So I won’t hold any responsibility over this dues, use it at your own risk .
Enter the below command to install a package called ‘libdvdnav4′ (this package will also be saved automatically where the above codecs are saved).
sudo apt-get install libdvdnav4
Step 7: Then, enter the below command to install it in the LiveCD (I won’t go into details why you have install this, but this makes it including in the codec pack a hell lot easier).
Now, when the installation finishes, take a careful look at the Terminal output (you might have to scroll up a bit) and locate a text field that says something like
‘Saving to: `/tmp/dvdcss-ZqV4wg/libdvdcss.deb’
as shown below. The ‘ZqV4wg‘ part will change (thus the saving location), but the rest should be the same.
Step 8: Then, enter the below command so the newly downloaded ‘libdvdcss.deb’ is also copied to the same folder where other codecs are located. But make sure to replace ‘ZqV4wg‘ with the code your Terminal output gives you, otherwise it won’t work, because if you install this again, then it first will be saved into a different location, temporarily.
sudo cp /tmp/dvdcss-ZqV4wg/libdvdcss.deb /var/cache/apt/archives
*End of Restricted DVD installation *
Step 9: Now, enter the below commands so all the downloaded codecs are copied into a new folder called ‘offlinecodecs’ in your LiveCD user’s ‘Home’ folder (first command will copy the content, other will delete a file that we don’t need). Do not change the ‘offlinecodecs’ folder name.
sudo cp -a /var/cache/apt/archives /home/ubuntu/offlinecodecs
sudo rm /home/ubuntu/offlinecodecs/lock
That’s pretty much it actually. Now we have a folder called ‘offlinecodecs’ which has all the proprietary codecs Ubuntu repository holds. In the final step, open your ‘Home’ folder and safely save (copy) this folder to another portable storage media so you can use it later on other machines.
Installing it on another computer …
This is bloody easy and you can do it using two commands!. First, boot into the computer which runs Ubuntu where you want to install the codec pack. Then, insert the media and copy that ‘offlinecodecs’ folder to your ‘Home’ folder on this computer.
Step 1: Then, open your Terminal and enter the below command.
Step 2: Now, enter the below command and when asked give the ‘sudo’ password, and it’ll install all the codecs for you!.
sudo dpkg -i *.deb
If packages manager such as ‘apt-get’ refused to work afterwards, then enter the below command to fix it.
sudo apt-get purge flashplugin-installer
That’s it, now you’ve successfully created and installed an offline codec pack in Ubuntu. Good luck.