How to Enable Ubuntu 18.04 LTS to Play Videos Files

After Ubuntu 18 .04 LTS was released, I decided to install it for testing purposes… the steps below is how I got Ubuntu to play video files and other video formats… If you’re looking for a simple way to enable Ubuntu desktops to play videos, the steps below should be a great place to start…

By default Ubuntu Desktop will not play most videos files and some other media formats. 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 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 format.

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

Hope this helps!

~Enjoy!

You may also like the post below:

Setup Apache2 SSL Certificates on Ubuntu 17.04 / 17.10

26 Replies to “How to Enable Ubuntu 18.04 LTS to Play Videos Files

  1. I cant thank the Ubuntu community enough for all the hard work they’ve put into fixing bugs. Without people like the authors of this page and others like it Linux would be nothing. Cheers to you!!!

  2. There still appears to be a problem with playing a .mod file on my computer. I have the gstreamer bad plugins installed, which supposedly are needed, but the video player crashes with a segmentation fault on 18.04. It worked fine on 16.04. Videos is able to play other types of file such as AVI. And I noticed VLC player can play the .mod file, possibly because VLC uses its own codecs. Needless to say, thumbnails, which appear to rely on gsttreamer, don’t work for .mod files anymore, although they do work for other videos. And I would not expect programs like video editors that rely on gstreamer to work, either. Just thought your readers should know.

  3. When I pasted the above text in my terminal, it asked for my password but wouldn’t let me type anything. What could be wrong?

    1. it seems like you type nothing, but it actually types. just enter your password, you won’t see it but terminal will.

    2. Terminal in Ubuntu doesn’t show your password being typed! But it does recognise what you are Typing! Just type your password – nothing shows – then ‘Enter’ and continue.. That, which gets all newcomers, is how it works!

  4. What other decoders or whatever and II: why the hell not include in a distribution?

  5. Thank you so much for this.

    I had been tearing my hair out getting the video streaming services “SBS on Demand” and “ABC iView” to work on the latest Firefox (62.0) under Ubuntu 18.04. They worked using the same version of Firefox under Windows 7, but nothing I could do would make them work under Ubuntu.

    Out of desperation, I tried what you suggested, not thinking it would work (I had assumed that Firefox and/or its add-ins came with their own codecs embedded), but it fixed everything. Awesome!

  6. thank for your help. I have got most thing sorted out but the only thing I am having trouble is playing video from putlocker and movies123 sites. Videos on youtube, amazom, face book and netfix all work just not putlocker

  7. Thanks a lot for this post. In fact I recently installed ubuntu 18.04 and Firefox won’t play videos, even though Google Chrome play them, and it turns that I have to install ubuntu-restricted-extras.

  8. Yesterday I could stream youtube videos with VLC, but after the system update, it says “Codec not supported:
    VLC could not decode the format “h264″ (H264 – MPEG-4 AVC (part 10))”. I’ve successfully followed the above steps, but VLC still won’t stream.

  9. Je suis sur Ubuntu 18.04 LTS et j’ai mis cette commande par Ctrl+Alt+T et malheureusement ça ne marche pas pour la bonne raison que libdvd-pkg n’existe pas (selon la réponse donnée lorsque j’ai taper “enter”) … Avez-vous une solution ?
    Translation by Google translate :
    I am on Ubuntu 18.04 LTS and I put this command by Ctrl + Alt + T and unfortunately it does not work for the good reason that libdvd-pkg does not exist (according to the answer given when I type “enter” ) …. Do you have a solution ?

  10. nope. didn’t work on lenovo t510 thinkpad running 18.10 ….why do they make it so hard to play mpeg4 …do they hate apple that much? going on 3rd hr trying this and that….may have to go back to 18.04. now that all this trying has added junk I didn;t need or didn’t work…..

    1. loaded gsteamer good bad ugly tried new ubuntu installs lenovo t510 ….. still cant play /edit mpeg4….
      is this snap layer the issue?

  11. Fixed Netflix not playing error in Firefox 66.0.2, on 18.04.2 LTS. Thanks for this!
    Can’t believe that all the other Netflix fix-it sites are pointing to DRM and CDM work-arounds and checks; spent the first half of a day going though all those and as a last resort looked for codec fixes and found this. Perfect.

  12. I just installed ‘ubuntu-restricted-extras’ and it works well.
    Question: Why install ‘sudo apt install libdvdnav4 libdvdread4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg’ when ‘sudo apt install ubuntu-restricted-extras’ duplicates the 1, 2, 4 and ignores 3, 5?
    viz: cabextract, gstreamer1.0-fluendo-mp3, gstreamer1.0-libav, gstreamer1.0-plugins-ugly, gstreamer1.0-vaapi liba52-0.7.4, libaacs0, libass9, libavcodec-extra, libavcodec-extra57, libavfilter6, libavformat57, libavresample3, libbdplus0, libbluray2, libbs2b0, libchromaprint1, libdvdnav4, libdvdread4, libflite1, libgme0, libgstreamer-plugins-bad1.0-0, libmpeg2-4, libmysofa0, libnorm1, libopencore-amrnb0, libopencore-amrwb0, libopenmpt0, libpgm-5.2-0, libpostproc54, librubberband2, libsidplay1v5, libssh-gcrypt-4, libswscale4, libva-wayland2, libvo-amrwbenc0, libzmq5, ttf-mscorefonts-installer, ubuntu-restricted-addons, ubuntu-restricted-extras, unrar
    – If you look at https://gstreamer.freedesktop.org/modules/ it explains that ‘gst-plugins-bad’ = a set of plug-ins that need more quality, testing or documentation whereas ‘gst-plugins-ugly’ is a set of good-quality plug-ins that might pose distribution problems.

Leave a Reply

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

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

%d bloggers like this: