How to install the MPEG-4 AAC decoder and the H.264 decoder?

497,564

Solution 1

ubuntu-restricted-extras package allows users to install ability to play popular non-free media formats, including DVD, MP3, Quicktime, and Windows Media formats.

To install ubuntu-restricted-extras package:

  1. Open a terminal by pressing Ctrl+Alt+T.

  2. Run this command:

     sudo apt-get install ubuntu-restricted-extras
    
  3. Alternatively, you can install the package via Software Center by launching it via Dash and searching the package and clicking on Install.

enter image description here

Also, try installing libavcodec54 libav-tools and ffmpeg with this command:

sudo apt-get install libavcodec54 libav-tools ffmpeg

EDIT: Ubuntu 20.04

In Ubuntu 20.04, you want libavcodec58 instead of 54:

sudo apt-get install libavcodec58 ffmpeg

Solution 2

Support to decode MPEG-4 AAC is provided by gstreamer1.0-libav and to decode H.264 there is ffmpeg:

$ sudo apt-get install gstreamer1.0-libav ffmpeg

For more information have a look at the Ubuntu Documentation.

Solution 3

The other answers seems to work on older versions but today when I was installing the same on clean install of Ubuntu 18.04 using Peachy's answer I got lot of errors. Using these commands I installed that in Ubuntu 18.04 LTS successfully.

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

Note: In 20.04, libdvdread4 has been updated to libdvdread7, and in 20.10, it's now libdvdread8 (see Ubuntu packages for the current version).

Solution 4

Unfortunately none of these options seem to work on Ubuntu 16.04. I get a python 3.5 message for searching MPEG-4 AAC in one of the videos I try to play. None of the above fixing the missing codec.

A fine workaround is to install VLC:

sudo apt-get install vlc

(or from software center)

Update: found a fix:

sudo apt-get install gstreamer1.0-plugins-bad

This made sound work for Totem (Video)

Update: Try going to 'Software & Updates' and enabling the checkbox for 'Software restricted by by copyright or legal issues'. Then allow Ubuntu to update after clicking the close button. You should now be able to run:

sudo apt-get install ubuntu-restricted-extras

You'll also have to accept the EULA's terms and conditions before continuing.

Solution 5

Beware of the audio-only gstreamer bug

Hearing only audio on H.264 playback with an otherwise black video screen was reported as gstreamer1.0 bug #1562875.

Luckily, this bug can easily be resolved by issuing the following command once:

$ rm -R ~/.cache/gstreamer-1.0

This will take effect after restarting the application.

Share:
497,564

Related videos on Youtube

Balram Jamale
Author by

Balram Jamale

Updated on September 18, 2022

Comments

  • Balram Jamale
    Balram Jamale almost 2 years

    Where do I get the MPEG-4 AAC decoder, and the H.264 decoder.

    How to install them and play the multimedia?

    • Coder Guy
      Coder Guy over 3 years
      This thread is hilarious, everyone has as different proposition of packages to install and I don't think any of them work, I haven't found a combination that works yet anyhow. I gave-up and loaded an MP3 stream instead.
  • Saeed Entezari
    Saeed Entezari almost 6 years
    This actually works for 18.04. Thanks bro!!
  • Juan
    Juan over 5 years
    I use Ubuntu Studio 18.04.1 LTS, and I have installed all the pieces of software you mentioned here, but... The problem is still the same! VLC player can play those videos but not Parole. So...
  • Juan
    Juan over 5 years
    I didn't help to me! I use Ubuntu Studio 18.04.1 LTS and Parole 1.0.1.
  • Shayan
    Shayan almost 5 years
    Is ubuntu-restricted-extras enough for mp4 playback from Twitch.tv? Or do I need the libavcodec54 libav-tools ffmpeg as well? @Peachy
  • Shayan
    Shayan almost 5 years
    Also: Package libav-tools is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: ffmpeg:i386 ffmpeg E: Unable to locate package libavcodec54 E: Package 'libav-tools' has no installation candidate
  • Henok Tesfaye
    Henok Tesfaye over 4 years
    This should be the accepted answer.
  • dannypaz
    dannypaz about 4 years
    This also worked for Ubuntu 20. I had the same issue with a new install
  • Nathan
    Nathan almost 4 years
    @Shayan Are you also on Ubuntu 20.04?
  • Shayan
    Shayan almost 4 years
    @Nathan I wrote these comments back when I was using 16.04.3 and still am using it.
  • Nathan
    Nathan almost 4 years
    Ah, okay. As edited-in above, I solved this for Ubuntu 20.04. For Ubuntu 20.04, you've gotta do sudo apt-get install libavcodec58 instead of 54
  • John Dee
    John Dee over 3 years
    Ubuntu 20.04 libav-tools has no installation candidate
  • Ivan Marjanovic
    Ivan Marjanovic over 3 years
    For me on 20.04 sudo apt-get install ubuntu-restricted-extras sudo apt-get install libavcodec58 ffmpeg Finished the job, video app is now playing videos.
  • Nathan
    Nathan over 3 years
    You may also have to refresh your shell for it to work. exec bash or source ~/.bashrc
  • user1325696
    user1325696 about 3 years
    I would not install it. It installs hel of a lot executable & some fonts. Why do I need executables is that windows or .net mono/core?
  • QMaster
    QMaster almost 3 years
    Excellent on Ubuntu 20.04.1, Thanks.
  • Eido95
    Eido95 over 2 years
    It doesn't work on Ubuntu 21.04
  • Pouria Moosavi
    Pouria Moosavi over 2 years
    It helped and saved me after two days of researching. I was trying to play GTA SA on Ubuntu 20.04. Thanks a lot!
  • Admin
    Admin about 2 years
    Besides these packages I installed libavcodec58 package too, I face an issue into Ubuntu 20.04