146

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

How to install them and play the multimedia?

Kulfy
  • 18,154
Balram Jamale
  • 1,561
  • 2
  • 10
  • 3

7 Answers7

168

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 onwards, you want libavcodecXX instead of 54:

For example:

sudo apt-get install libavcodec58 ffmpeg # Ubuntu 20.04
sudo apt-get install libavcodec59 ffmpeg # Ubuntu 22.04
sudo apt-get install libavcodec60 ffmpeg # Ubuntu 23.10

You can use apt search libavcodec to find the current version for your particular installation.

Peachy
  • 7,235
  • 10
  • 40
  • 47
38

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.

Oleg Abrazhaev
  • 146
  • 1
  • 7
webwurst
  • 2,495
26

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

Alex
  • 224
Kulfy
  • 18,154
9

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.

7

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.

Serge Stroobandt
  • 5,719
  • 1
  • 54
  • 59
1

In my case I also needed intel-media-va-driver-non-free on top of the above answers
¯\_(ツ)_/¯

1

In the last Ubuntu ver 14.04 , 14.10 the best way for setup them is :

To install ubuntu-restricted-extras package:

Open a terminal by pressing Ctrl+Alt+T.

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg gstreamer0.10-ffmpeg libavcodec-extra-53 libavcodec53

and N-joy

A1Gard
  • 260