Ubuntu provides a meta-package named ubuntu-restricted-extras that consists of most of the common audio and video codecs along with some other packages like the Microsoft fonts.
Install this package and you won’t have to worry about the media codecs anymore.
Open the terminal in Ubuntu and type the following command:
```
sudo apt install ubuntu-restricted-extras
```
Since this meta-package contains software from Microsoft, you’ll have to accept the End User License Agreement (EULA).
![Press tab and hit enter to accept EULA][6]
The next screen may look like the one below. Just press tab and it will highlight the options. When the correct options are highlighted, press enter to confirm your selection.
![Press tab and when it highlights the correct option, press enter to confirm][7]
With the multimedia codecs installed, you should be able to play (almost) all kinds of media files. Your music player can play MP3 files and your video player should be able to play MP4, MKV, and whatnot.
However, this too is not the end of the story, at least for some people.
Why do I say that? Because I have noticed that the default video player in Ubuntu, Totem, often struggles while playing certain kinds of video files. You’ll notice that suddenly your system heats up, the fans start blowing and your mouse cursor stop functioning smoothly.
Why? Because Totem is struggling in decoding the video and taking too much processing power.
You can test it by running the top command while playing the video. Look for the process named totem (that’s the name of the default video player).
![Ubuntu’s default video player, Totem, may consume more than necessary CPU power][8]
What can you do now? Your trouble seems to be never ending. Fret not. There are [better video players in Linux][9] and they will help you solve the issue.
#### Method 3: Install a better video player (recommended)
There are many good video players in Linux. I find them better than the default Totem video player.
Personally, I prefer two of the lot: [VLC][10] and [MPV][11].
VLC is a versatile and hugely popular video player. Chances are that you have already used VLC.
MPV Media Player is not that popular but this lightweight application is quite good for playing video files.
Both VLC and MPV players are good at handling media codecs. You don’t even need to install media codecs separately with them. Just [install VLC][12] or MPV and you should be able to play various kinds of video files.
Either look for it in the software center:
![MPV player is available in Ubuntu software center][13]
Or [install MPV on Ubuntu][14] using the command line:
```
sudo apt install mpv
```
Now that you have another video player, you should right click on the video files and choose to open with the new video player.
Alternatively, you can [make it the default application][15] for playing video files and use double clicks.
### Did it work for you?
I hope I didn’t go into too much detail here. I wanted to explain the various methods and the pros and cons associated with each of them.
Did you manage to get rid of the h264 decoder problem in Ubuntu? Which method did you go for?