How to configure Ubuntu to play Videos and Audio

Ubuntu, with the default installation, is not able to play some popular videos and audio formats, like the ones from .mp3 audio files, .mp4 video files or streaming videos like YouTube.

It is possible to configure Ubuntu to play them, but it needs some extra configuration.

This post explains how to configure Ubuntu to be able to play videos and audio.

Why can’t Ubuntu play Videos and Audio as default?

The default Ubuntu installation package includes only open source code software and no patented software. This is done to avoid dealing with the complex regulations of each country, not because it is illegal to include this software.

Common video and audio formats make use of closed source software or the use of patents, like patented MP3 audio coding format or video codec H.264.

Ubuntu comes by default with the open source multimedia framework gstreamer but lacks some components to play video and audio formats using patents, as for example, package gstreamer0.10-ffmpeg.

Ubuntu has grouped all these useful closed source and patented software in the metapackage ubuntu-restricted-extras. You can find more information about the content of this metapackage on this external link.

If you want to install the closed source and patented codecs, you need to apply some manual steps.

Some users want a pure open source OS, and refrain from installing closed source or patented software on Ubuntu. There are video and audio patented-free alternatives, like .ogg files with compression methods like Theora (video), Vorbis (audio), Opus (audio), FLAC (audio) and OggPCM (audio).

On the other hand, if you do not install patented software you will not be able to access popular media content like the one inside YouTube platform, DVDs or MP3/MP4 files. So the final choice is yours.

Step-by-step Instructions to configure Ubuntu to play Videos and Audio

The main steps are:

  1. Install package ubuntu-restricted-extras
  2. Configure Ubuntu software packages

Step 1: install package ubuntu-restricted-extras

Open a terminal.

Install ubuntu-restricted-extras package by typing:

sudo apt install ubuntu-restricted-extras

A screen will be displayed so user can accept EULA (End User License Agreement). You need to use the Down, Tab and Enter keys to accept the conditions.

You can check whether ubuntu-restricted-extras is installed anytime by typing:

apt search ubuntu extras

Some users report that if you just want to play videos you do not need to install the whole ubuntu-restricted-extras metapackage, but only the FFmpeg package:

sudo apt install ffmpeg

Step 2: Configure Ubuntu software packages

On the Ubuntu side bar, click on the “Show applications” button (grid icon), type “Software & Updates” and click on the blue icon for the application of the same name.

In the “Software & Updates” dialog, ensure that these values are checked:

  • Canonical-supported free and open-source software (main)
  • Community-maintained free and open-source software (universe)
  • Proprietary drivers for devices (restricted)
  • Software restricted by copyright or legal issues (multiverse)

Click on “Close”.

Testing Results

There are 3 test scenarios:

  1. Play a video with sound and audio
  2. Play a video without sound
  3. Play an audio file

You may go for the first one, and if it works, stop testing.

If it does not work, go for the rest of scenarios to know the cause of the issue.

Test 1: play a video with sound and audio

Visit YouTube (or any other video streaming service) and play any video. Confirm that it is played.

If it freezes, it seems you have an issue related to any of the video or audio. Perform test 2 and 3 to verify whether the error comes from the audio or video part.

If it works then… IT WORKS! You do not need to perform any other test. 🙂

Test 2: play a video without sound

There are two tests that can be performed on this scenario:

  • Play video with patented coding (e.g., H.264)
  • Play video without patented coding (e.g., .ogg video file)

You can download patented MP4 sample files from this external link.

You can download non-patented OGG video files from this external link.

Test 3: play an audio file

There are two test test that can be performed on this scenario:

  • Play audio with patented coding (e.g., .mp3 file)
  • Play audio without patented coding (e.g., .ogg audio file)

You can download patented MP3 sample audio files from this external link.

You can download non-patented OGG sample audio files from this external link.

Troubleshooting

Please perform the tests in the previous section to check which is the scenario where we are.

Non-patented video is played (test 2.b), but patented video isn’t (test 2.a)

According to some users, like reported on this external link, Ubuntu 22.04 and 22.10 have an issue.

The workaround would be to uninstall the VAAPI plugin for Gstreamer, the default Ubuntu video and audio coding package.

Open a terminal and type:

sudo apt remove gstreamer1.0-vaapi

Reboot and test again.

Video is played (test 2), but not audio (test 3)

If both patented and non patented videos are played but audio don’t, it is probably an issue with the Ubuntu audio configuration.

Please check this post about troubleshooting no sound on Ubuntu issue.

You might be also interested in…

External References

Leave a Reply

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