Codec install fails on Ubuntu 22.04 – quick fix
Can't play MP4 or MP3 on Ubuntu? The culprit is usually missing multiverse repo or restricted extras. Here's the fix.
This error drives everyone nuts
You try to play a video or song, and bam — "No suitable decoder found" or "GStreamer plugin missing". Usually happens after a fresh install of Ubuntu 22.04 or 24.04. Don't panic. The fix is one command away.
The real fix
Open a terminal (Ctrl+Alt+T). Run this first:
sudo apt update
sudo apt install ubuntu-restricted-extras
That's it. This package pulls in all the common codecs: MP3, MP4, AAC, WMV, Flash, and DVD playback support. It also installs the Microsoft TrueType fonts.
But wait — if it fails because the package isn't found, you need to enable the multiverse repository:
sudo add-apt-repository multiverse
sudo apt update
sudo apt install ubuntu-restricted-extras
99% of the time this solves the problem. After installing, restart your media player or log out and back in.
Why this works
Ubuntu doesn't ship these codecs by default due to patent and licensing issues. The ubuntu-restricted-extras package lives in the multiverse repo — it's a curated collection of legal-but-restricted software. Without that repo enabled, the package never shows up in apt. The add-apt-repository command just flips that switch.
A common mistake: people try to manually install individual plugins like gstreamer1.0-plugins-bad or libavcodec-extra. That works too, but it's more work. The meta-package handles everything.
When the basic fix doesn't work
Sometimes the package installs but you still get errors. Here are the edge cases I've seen:
1. Firefox or Chromium won't play video
For browser-based media, install the FFmpeg plugin:
sudo apt install ffmpeg
And for Chromium-based browsers, you might need the VA-API drivers:
sudo apt install intel-media-va-driver
Replace intel-media-va-driver with the right driver for your GPU (AMD users use mesa-va-drivers).
2. DVD playback still broken
Ubuntu restricted extras includes libdvdcss, but sometimes it's blocked by regional codes. Install it separately:
sudo apt install libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg
This compiles and installs the decryption library. You need build-essential installed first.
3. Flatpak or Snap versions of apps
If you installed VLC or Rhythmbox via Snap or Flatpak, the system codecs don't apply. These sandboxed apps use their own codec stacks. For Snap, run:
sudo snap install vlc
For Flatpak, use:
flatpak install flathub org.videolan.VLC
Both include codecs out of the box.
How to prevent this from happening again
Do this on every fresh install:
- Enable multiverse repo during setup (or right after)
- Run
sudo apt install ubuntu-restricted-extras ffmpeg - If you use DVDs, also install
libdvd-pkg - Set up Flatpak or Snap for media apps if you prefer them
That's it. You won't see this error again. The whole process takes under 2 minutes once you know the steps.
Quick troubleshooting table
| Symptom | Fix |
|---|---|
| "Package not found" | Enable multiverse repo |
| "No decoder" in VLC | Install ubuntu-restricted-extras |
| Browser video broken | Install ffmpeg and VA-API driver |
| DVD doesn't play | Install libdvd-pkg |
| Snap app missing codecs | Reinstall via snap or flatpak |
"I spent 3 hours trying to fix this. One command did it. Wish I'd found this sooner." — Real feedback from a user on Ubuntu 22.04
If you still have issues after all this, check if your media file is corrupted or uses a very old codec like RealVideo. Those are rare and require separate steps. But for 99% of modern media, the above fixes it.
Was this solution helpful?