How to Install h.264 decoder on Ubuntu

We want to play a video on Ubuntu. We just went to the folder and double-clicked on the video to play it but wait, what is this? It gives an error that the playback requires an H.264(High Profile) decoder plugin that is not installed.

Before learning how to fix this problem, let us understand what an H.264 decoder plugin is? An H.264 decoder is a plugin that not only encodes but also decodes the content. Because of this, it is also known as a codec. Codec is a device that not only encodes the data but also decodes it after the encoding. Similarly to this concept, the codec in videos also encodes the data, or we can say it packages and un-packages the content for the streaming and recording of the video. In the process of encoding, the H.264 compresses the size of the video file so it can conveniently transfer over a long distance and when it is reached to the destination, then the process of decoding starts, which is opposite to the encoding and uncompress all the data of video and return the video contents to their original size and order.

This write-up is associated with how to fix the error of the H.264 decoder.

What is the installation and utilization of the H.264 decoder on Ubuntu

An error of an H.264, which we see when we play the video, can be fixed by installing the H.264 decoder on Ubuntu. For this, we will open the terminal and will update the repository.

$ sudo apt update

Once the update is completed, we will install some packages of different libraries and few packages of GStreamer:

$ sudo apt install libdvdnav4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg -y

As the installation process starts, a dialogue box will open for the configuration setting of libdvd.pkg. It will inform you that this package will begin launching downloads of the source files from videolan.org, compile them and install them. Accept this acknowledgment by pressing the Ok button.

Another dialogue box will acknowledge that the updates will be automatically enabled, so click on Yes to accept it.

After the installation of the packages, we will run the command to configure the dpkg:

$ sudo dpkg-reconfigure libdvd-pkg

Again a dialogue box will be open to confirm the installation of the package, so choose Yes.

In the last step, we will install the Ubuntu restricted extras:

$ sudo apt install ubuntu-restricted-extras

As we run the following command, the installation will begin, and a dialogue box will appear on the screen regarding the agreement, drag down the whole agreement, and press Ok.

Another dialogue box will appear asking you about the acceptance of the EULA license terms, so press Yes.

Now the installation will begin, and it will take some time depending on the system’s specifications, so have some patience. On completion of installation, you will see an output that no error was found and everything was done successfully.

Go to the video and open it to play it, and it will generate no error in playing the video, which means the H.264 decoder is installed successfully.


MPEG-4 AVC is also referred to as the H.264 decoder. The H.264 is the most effective and approved codec nowadays. The new version is the H.265 decoder which is also available in the development market now. We can also install a VLC player to resolve this problem as it contains all the players. This write-up is associated with installing the H.264 decoder to fix the error because you cannot play the video. I hope this write-up assists you in understanding the installation process of the H.264 decoder and helps you know what H.264 decoder is.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.