How to Enable Ubuntu 18.04 LTS to Play Videos Files

e commerce 1606962 640

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 libdvd-pkg 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.

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. 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. Thanks! worked fine

  3. 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.

  4. 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. Mick from Ramsbottom

      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!

    3. Just type your password and hit enter

  5. No, it didn’t work. 🙁

    1. Also me,it doesn’t work.

  6. John-Albert Eadie


  7. John-Albert Eadie

    ALL videos are now green with some audio.

    1. was wondering how to Select rand on play on the video player in Ubuntu 18.04LTS.

  8. John-Albert Eadie

    Even after adding those extras, etc. DO I MUST GO BACK TO WINDOWS?

  9. John-Albert Eadie

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

  10. 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!

  11. 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

  12. 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.

  13. 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.

  14. 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 ?

    1. You have to enter the commands in a terminal window. That will do the job!

      1. U know what I think…I think all of u are ……

  15. 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?

  16. After doing the above I was able to correct it with:
    sudo apt-get remove gstreamer1.0-vaapi

    Thanks to this post:

  17. Shabir Ahmad Dar

    Thank you so much, it worked very well.

  18. 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.

  19. not worked

    1. did you install VLC?

  20. tks,worked

  21. 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 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.

    1. Didn’t work, none of the above works, Yes I double checked the commands.

  22. Thank you! Worked great.

  23. Thanks… you rock!! Ubuntu is awesome… I just ran this command in a terminal and restarted my video playing program, and it worked.
    sudo apt install libdvdnav4 libdvdread4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg

  24. great!!!! ubuntu 18.04 october 2019…

  25. It helps, THX!

  26. My phone is nokia 215 model apk and games is not inssatoling

  27. Hi,
    As Windows 7 is now defunct, I installed the latest version of the LTS Ubuntu software and found that my videos no longer worked, so after a few days of trying everything I could think of, I stumbled upon your post and it WORKED…for the most part.
    I have several disks for Series, like Criminal Minds, that have a menu on them that you SHOULD be able to select from the 4 options on the main menu page that shows up, with your cursor or up/down arrows, BUT it doesn’t allow you to use the cursor or arrow options, instead, you have to access the SMPlayer ‘Browse’ menu on the player and select each ‘Title’ from the drop-down menu as it ALSO doesn’t move along to the next sequence automatically. There is ALSO a lag in video playback, it often stalls and then gets stuck and has to restart…is this an issue with the player or Ubuntu? I’d never had these issues with Windows 7, so it’s unique to this installation.
    Any help/suggestions would be a help.

  28. thanks so much!

  29. The ‘sudo apt install ubuntu-restricted-extras’ comes up with a Microsoft License Agreement requirement with an link that is not active, and stops the process. What might be a workaround?

    1. You just have to accept the license. It worked just fine on my install. It’s about some fonts, if I’m correct. Not too much to worry about.

  30. After

    Configuring ttf-mscorefonts-installer

    You are suppose to accept the licence, but nothing work. You can’t click anything, nor type any key.

    Any hint?

    1. @PeeWhy -use Tab and then Return

  31. It worked perfectly, thanks for your help and cheers!

  32. Excellent! You made my day. thanks..

    Due to constantly breaking and poor internet connection, VLC installation was restarting all over again from 0%.
    Your method worked.

    I initially installed “Banshee Player” ( light weight of around 3MB) and then followed your instructions.
    They worked.

  33. I had a libdvd failure so had to also run

    sudo dpkg-reconfigure libdvd-pkg

  34. Worked great for me ,Thank You!

  35. Prashant Pimprikar


    I could play the .asf file, thanks for the help….

  36. Great! Worked for me.

Leave a Reply

Your email address will not be published.

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