Monday, November 4, 2024
HomeTutorialsHow to Install Multimedia Codecs on Ubuntu Linux

How to Install Multimedia Codecs on Ubuntu Linux

Multimedia Codec is defined by the Coder and Decoder of multimedia files. When you want to play an audio or video file on your Ubuntu Linux through a media player, the file starts finding a suitable decoder package to be played. Multimedia files can be explained as a container, where audio, video, and metadata are stored in a single file format.

There are various types of multimedia formats available to make a file playable, such as MP3, AAC, MP4, AVI, FLV, etc. Sometimes, due to software policy, a few multimedia codecs could be missing or not installed inside your Ubuntu Linux machine. Without installing those media codecs, you would not be able to open or edit some particular formatted multimedia files.

Multimedia Codecs on Ubuntu Linux


Most Ubuntu Linux users love the VLC media player to play video or watch a movie. VLC player has almost every multimedia codecs pre-installed inside the software. But somehow, if you cannot find any suitable media player to open your media file, that could be the reason that your Ubuntu Linux doesn’t fulfill the required multimedia codecs to respond with that specific format of the file.

In that case, you get an error saying, ‘Unable to play the file.’ In this post, we will see how to install multimedia codecs on Ubuntu Linux.

Multimedia Codecs on Ubuntu Linux error

Method 1: Installing Multimedia Codecs on Ubuntu via Command Line


At the very beginning, I must mention that the multimedia codecs that are not pre-installed inside the Ubuntu Linux are commonly known as ubuntu-restricted-extras. In Ubuntu Linux, the multimedia codecs packages can be stored and installed inside the proprietary drivers.

In order to install the multimedia codecs, you need to make sure that the restricted proprietary drivers and the multiverse copyright are checked and updated. To update the multiverse repository,  you can use the following terminal command line. Then reload and update the Ubuntu repository.

$ sudo add-apt-repository multiverse
$ sudo apt update

repository for restricted codec

Now you can install the restricted multimedia extra codec packages. We will use the apt-get command to install the restricted extra multimedia codec packages on Ubuntu distro.

$ sudo apt-get install ubuntu-restricted-extras

Multimedia Codecs on Ubuntu Linux extra

If your hardware configuration has an optical device or a DVD driver installed, you can install the libdvdcss media codecs for better performance.

$ sudo /usr/share/doc/libdvdread4/install-css.sh

Method 2: Installing Multimedia Codecs on Ubuntu via Software Store


In this method, I will show how to download and install the multimedia codecs on Ubuntu Linux from the official Ubuntu Software Store. This method is also known as the GUI method of installing multimedia codecs. Before that, make sure that you have the Gnome Software Store installed inside your machine and, it functions perfectly.

If you can’t find the Software Store, there is a chance that you have accidentally removed the Software Store from your Ubuntu distro. But no worries, as it is a Gnome package, you can install the Software Store anytime.

$ sudo apt update
$ sudo apt install gnome-software

Now, you can see that an Advanced Package Tool (APT) address is kept below into the preformatted text format.

apt:ubuntu-restricted-extras?section=universe?section=multiverse

You need to copy the AptURL and paste it in your browser’s address bar, then hit the Enter button. The URL will automatically ask you to choose the Software Store.

Once you select the Software Store, it will take you to the Official Software Store of Ubuntu Linux, where you will be able to install the restricted extra multimedia codecs. Normally, the APT-URL is installed by default in Debian or Ubuntu derivatives, but if your system doesn’t have the APT package installed, you can install the Apt-URL for offline uses.

$ sudo apt-get install apt-offline

open with software center

Now, press the install button and complete the installation process of Ubuntu restricted extras by entering your system administration password.

Multimedia Codecs on Ubuntu Linux GUI

Extra Tips – 1: Features of FFmpeg Plugin on Ubuntu Linux


Till now, we have seen how to install the multimedia codecs on Ubuntu Linux distribution. The ubuntu-restricted-extra package kind of includes the Gstreamer FFmpeg package as well. So we do not need to install the FFmpeg (Fast Forward Moving Pictures Expert Group) package individually. You can check the current version of FFmpeg, encoders, and decoders list on your Ubuntu Linux.

$ ffmpeg -version
$ ffmpeg -encoders
$ ffmpeg -decoders

Here are some primary terminal commands of FFmpeg, that you can use to convert, stream, and compress media files. You can use the FFmpeg tool to get the necessary information and metadata information about any video.

$ ffmpeg -i samplevideo.mp4

Use the following terminal command to convert a media file from one format to another format.

$ ffmpeg -i samplevideo.mp4 samplevideo.flv

You can also use the FFmpeg tool to remove audio from a video file and extract the audio file from the video file.

$ ffmpeg -i input.mp4 -an output.mp4
$ ffmpeg -i input.mp4 -vn output.mp3

Besides these, you can change the video aspect ratio, join or remove multiple media files, add subtitles, and change the video resolution by the FFmpeg tool.

Extra Tips – 2: Get Your Graphics Driver Updated


Linux distributions always come with the pre-installed graphics driver settings. Very often, the extended graphics card is also known as the Video Decode and Presentation API (VDPAU). If your system is running based on an Intel CPU and has an additional dedicated graphics card (GPU), then you should update your graphics driver properly.

In Linux distros, the Intel integrated graphics card is known as Video Acceleration API. When any media file is played on your system, the decoding and rendering job is done by the graphics card. Here, I am showing the video codecs that are currently functional on my Nvidia GeForce Graphics card.

NVDIA codec for ubuntu

So, keeping your graphics drives up to date is also an alternative and smart method to get the most used multimedia codecs installed in your Ubuntu Linux distro. In your Debian/Ubuntu distro of Linux, you will find an option to choose the dedicated graphics driver from the Software Center.

In Ubuntu Linux, the graphics card drivers can be configured through the Additional Driver settings under the Software & Updates. You may also manually download and install the latest Nvidia Graphics Drivers for your Linux distribution.

nvidia driver for linux codecs

Final Thoughts


Multimedia codecs are not only helpful to play video and audio files smoothly, but it also accelerates the hardware of your Linux system. Integrated video drivers and multimedia codecs are essential to establish real-time connections through web browsers. All the multimedia codec packets perform their functions with a demultiplexer and a multiplexer.

The primary job of multimedia codecs is to compress and decompress media files while playing or rendering any media file. In this post, I have outlined the method of how to install multimedia codecs on Ubuntu Linux.

In Linux, multimedia codecs are open-source and free. Furthermore, installing multimedia codecs are totally safe and harmless. If you find this post beneficial and helpful, please share this post on your social media. Also, do comment in the comment segment to write your valuable observation.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

You May Like It!

Trending Now