New users in Ubuntu will notice that for some reason, a lot of audio and video codecs aren't available immediately in Ubuntu, unlike Windows or Mac. This happens basically for legal and technical reasons. Ubuntu excludes these codecs because these video files and other media formats are copy-right protected, so you can't just add these protected technology to your operating systems and programs without agreeing to their licensing terms and conditions. The error is basically is the following one:
H.264 (Main Profile) decoder are required to play the file, but are not installed.
The solution for this issue is basically to install the missing codecs with the terminal in your system. For this, search for the terminal of Ubuntu and type the following commands. The first command will update the repositories:
sudo apt-get update
Then install the following packages that contain the most common codecs for video players:
sudo apt-get install libdvdnav4 libdvdread4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg
These packages are:
- libdvd: libdvdnav is a DVD navigation library, which provides an interface to the advanced features of DVDs, like menus and navigation. It contains the VM and other parts useful for writing DVD players. It's based on Ogle, but was modified to be used by xine and mplayer.
- gstreamer: GStreamer is a plugin to install codecs using QApt.
After installing the previous packages, proceed with the installation of the Ubuntu restricted extras with the following command:
sudo apt-get install ubuntu-restricted-extras
The ubuntu-restricted-extras package allows users to install ability to play popular non-free media formats, including DVD, MP3, Quicktime, and Windows Media formats. After running the commands, Ubuntu should be able immediately to play those videos that failed to play previously. If it doesn't, try restarting the computer and try to play the video again and it should work.
Happy coding !