139

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

How to install them and play the multimedia?

Kulfy
  • 17,696
Balram Jamale
  • 1,491
  • 2
  • 10
  • 3
  • 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. – Coder Guy Feb 22 '21 at 01:05

7 Answers7

159

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,117
  • 10
  • 38
  • 46
  • Is ubuntu-restricted-extras enough for mp4 playback from Twitch.tv? Or do I need the libavcodec54 libav-tools ffmpeg as well? @Peachy – Shayan Aug 27 '19 at 12:38
  • 8
    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

    – Shayan Aug 27 '19 at 12:43
  • @Shayan Are you also on Ubuntu 20.04? – Nathan majicvr.com Aug 12 '20 at 01:34
  • 1
    @Nathan I wrote these comments back when I was using 16.04.3 and still am using it. – Shayan Aug 12 '20 at 05:12
  • 5
    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 – Nathan majicvr.com Aug 12 '20 at 05:19
  • 8
    Ubuntu 20.04 libav-tools has no installation candidate – John Dee Jan 03 '21 at 07:08
  • 1
    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. – Ivan Marjanovic Jan 25 '21 at 11:45
  • You may also have to refresh your shell for it to work. exec bash or source ~/.bashrc – Nathan majicvr.com Mar 06 '21 at 03:19
  • 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? – user1325696 Jun 26 '21 at 04:38
  • 1
    It doesn't work on Ubuntu 21.04 – Eido95 Nov 10 '21 at 07:54
  • Libavcodec is now libavcodec59 (and presumably it'll increase in future: just apt search libavcodec to find the latest version available) – Tim Perry Jan 27 '23 at 13:59
  • It worked like charm on ubuntu 20.04. Thank you – Neeraj Kumar Nov 29 '23 at 06:52
  • 1
    @Shayan The libav fork was dead; everybody switched back to ffmpeg. – mcendu Feb 05 '24 at 01:47
37

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.

webwurst
  • 2,385
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
  • 17,696
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.

Vincent Gerris
  • 2,437
  • 1
  • 20
  • 14
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.

Serge Stroobandt
  • 5,268
  • 1
  • 48
  • 59
1

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

  • Solved my problem in Ubuntu 22.04 to play old mpgeg videos. VLC didn't work well. With this installation, I can use the system's default player. – Badaro Jul 16 '23 at 23:23
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