How to install Multimedia Codecs in Linux

By default, the Linux system cannot play most video files that are in encrypted formats (proprietary media formats) if you do not have the required Media Codecs installed on your system.

It contains lots of packages like flash plugin, gstreamer, mp4, libavcodec, etc (especially decoder), which are not open source and some of them involve copyright patent or legal issues. Hence, these are not installed by default nor shipped with official repository.

If you try to play proprietary media formats without installing media codecs, you will see the following error message “Unable to play the file”.

In this brief tutorial, we’ll show you how to install Media Codes on Ubuntu, Fedora and openSUSE systems.

1) Installing Multimedia Codecs on Ubuntu

Essential multimedia codecs can be installed in Ubuntu and their derivatives using “ubuntu-restricted-extras” package. It is a software package that contains various multimedia packages.

In order to install the multimedia codecs, you need to enable multiverse repository, which is created by Ubuntu to provide non-open source software to its users.

Run the following commands to enable multiverse and restricted repository:

To enable ‘multiverse’ repository, run:

$ sudo add-apt-repository multiverse

To enable ‘restricted’ repository, run:

$ sudo add-apt-repository restricted

To update the repository index, run:

$ sudo apt update

Finally, install multimedia codecs by running the below command. It prompts you to confirm twice as part of this package installation, so confirm it by hitting the “Enter” button.

$ sudo apt install ubuntu-restricted-extras

2) Installing Multimedia Codecs on openSUSE

Multimedia codecs can be installed in openSUSE by enabling the third-party Packman repository.

Packman is the largest external repository that offers various additional packages for openSUSE, which is not limited to multimedia related applications and libraries and offer other applications too.

Use the following commands to enable Packman repository on openSUSE.

On Tumbleweed:

$ sudo zypper addrepo -cfp 90 'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/' packman

On openSUSE Leap:

$ sudo zypper addrepo -cfp 90 'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_$releasever/' packman

To refresh the local repository database, run:

$ sudo zypper refresh

Finally, install the required multimedia codecs by running the below commands:

$ sudo zypper dist-upgrade --from packman --allow-vendor-change
$ sudo zypper install --from packman ffmpeg gstreamer-plugins-{good,bad,ugly,libav} libavcodec-full vlc-codecs

3) Installing Multimedia Codecs on Fedora

You can install multimedia codecs on Fedora system by enabling the RPM Fusion repository.

The RPM Fusion repository is community-maintained software repository providing additional packages that cannot be shipped in Fedora for legal reasons.

Run the following command to enable RPM Fusion repositories (Free & Non-Free):

For RPM Fusion free repository, run:

$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

For RPM Fusion Non-free repository, run:

$ sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Use the dnf command to install packages that provide multimedia libraries:

$ sudo dnf install gstreamer1-plugins-{bad-*,good-*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel
$ sudo dnf install lame* --exclude=lame-devel
$ sudo dnf group upgrade --with-optional Multimedia

Closing Notes

In this guide, we’ve shown you how to install essential multimedia codecs on Ubuntu, Fedora and openSUSE systems.

If you have any questions or feedback, feel free to comment below. Happy learning!

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

2 Comments on “How to install Multimedia Codecs in Linux”

  1. “How to install Multimedia Codecs in Linux”?

    You mean how to install multimedia codecs in Ubuntu, OpenSUSE and Fedora.

    Other distros are available…

Leave a Reply

Your email address will not be published. Required fields are marked *