How to Install Video / Audio Codecs on Ubuntu 18.10 / 18.04 | 16.04 LTS

laptop 4662049 640

I recently installed Ubuntu 18.10 [BETA] version to test my apps.  I wanted to play some videos from my desktop, and the steps below is how to got it done.

By default Ubuntu Desktop will not play most videos files, expecially encrypted formats. and and other popular ones. Unless you install restricted decoders and codecs that are purposely left out, you won’t be able to watch movies, or videos you downloaded from YouTube.

These restrictions are in place for legal and technical reasons. Ubuntu excluded these codecs because these video files and other media formats are copy-right protected. You can’t just add these protected technology to your operating systems and programs without agreeing to their licensing terms and conditions.

In order to watch these videos, you need to have these codecs installed. A codec is a piece of software that allows applications to read a video or audio format. That’s why when you try to watch a video in Ubuntu you sometimes get an error that Ubuntu is unable to play the file.

This brief tutorial shows you how to install these restricted programs and codecs so you can begin watching movies and videos files on Ubuntu.

When you attempt to watch a video file formatted in MPEG-4 you’ll get the error message as shown below:

XXX-X AAC decoder, H.264 (Main Profile) decoder are required to play the file, but are not installed.

play videos in ubuntu

The reason you get the error is because your Ubuntu desktop is missing the required codecs or decoders. The video you’re trying to watch is using a copy-right protected technology and Ubuntu is not designed to play them.

You must install these packages below in order to play those videos. Run the commands below to install the missing codecs and decoders from Ubuntu Desktops.

sudo apt update
sudo apt install libdvdnav4 libdvdread4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg
sudo apt install ubuntu-restricted-extras

After running the commands above, Ubuntu should immediately begin playing those videos that failed to play previously. This is how to get Ubuntu to play copy-right video files and other popular formats.

ubuntu vedeo error 1

If for some reasons the videos are still not playing, you may want to restart your computer and try again.

Hope this helps!


You may also like the post below:


  1. there is also programs like VLC which are completely open source and come with decoders as well

    1. it not working yar

  2. “If for some reasons the videos are still not playing, you may want to restart your computer and try again.”
    Man, i’ve restarted my ubuntu 127 times and still Video does not play, what shall i do? Restart it several more times?

  3. Does it need internet connection?

  4. I want video plugins for Ubuntu am I supposed to download it first and then install it in my computer??and how should I download because av tried but it’s not working

  5. David N. Andrews

    Didn’t work at all for me.

  6. Gracias por todo, perdon por tan poco!

  7. Perfect solution, thanks

  8. This is my extra install list some are extra codecs needed for audio and video, this list has been setup for my AMD laptop so ignore the amd plugins unless you are on an amd machine.

    sudo apt-get install mencoder icedax tagtool easytag id3tool lame libxine2-ffmpeg libdvdread4 libdvdnav4 nautilus-script-audio-convert exfat-fuse exfat-utils unace p7zip-full p7zip-rar sharutils rar uudeview mpack arj lrzip zpaq kgb flac faac faad sox ffmpeg2theora uudeview mpeg3-utils mpegdemux libmad0 libavcodec-extra gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg gstreamer1.0-libav liba52-0.7.4-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libjpeg-progs frei0r-plugins libmp3lame-dev:amd64

  9. If you see the following message: “libdvd-pkg: `apt-get check` failed, you may have broken packages. Aborting…” use the following command.

    sudo dpkg-reconfigure libdvd-pkg

    This is a suggestion from the Ubuntu Forums

  10. Yes I agree

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.