Codecs & Video Playback
Due to patent and licensing restrictions, Ubuntu does not include certain multimedia codecs by default. This article explains how to install full codec support and video players.
Installing ubuntu-restricted-extras
ubuntu-restricted-extras is a meta-package that installs most commonly needed codecs and fonts in one go:
sudo apt install ubuntu-restricted-extras -yThis package includes:
- MP3, AAC, and other audio codecs (GStreamer plugins)
- H.264 and other video codecs
- Microsoft TrueType core fonts
- unrar extraction tool
During installation, you may need to accept the Microsoft fonts EULA license agreement.
Installing Additional Codecs
GStreamer Plugins
GStreamer is Ubuntu’s default multimedia framework:
# Base plugins
sudo apt install gstreamer1.0-plugins-base -y
# Good plugins
sudo apt install gstreamer1.0-plugins-good -y
# Bad plugins (may have patent issues)
sudo apt install gstreamer1.0-plugins-bad -y
# Ugly plugins (have patent issues but widely used)
sudo apt install gstreamer1.0-plugins-ugly -y
# FFmpeg integration
sudo apt install gstreamer1.0-libav -y
# Install all at once
sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav -yFFmpeg
FFmpeg is the most powerful multimedia processing tool:
sudo apt install ffmpeg -y
ffmpeg -versionCommon operations:
# Video format conversion
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4
# Extract audio
ffmpeg -i video.mp4 -vn -c:a libmp3lame audio.mp3
# Compress video
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium output.mp4
# Trim video
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:03:00 -c copy clip.mp4
# Convert to GIF
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1" output.gifVA-API and VDPAU Hardware Acceleration
# VA-API (AMD and Intel)
sudo apt install va-driver-all libva2 vainfo -y
vainfo
# VDPAU (NVIDIA)
sudo apt install vdpau-driver-all libvdpau1 vdpauinfo -y
vdpauinfoVideo Players
VLC
VLC is the most feature-complete video player, supporting nearly all formats:
# Method 1: apt install
sudo apt install vlc -y
# Method 2: Snap install
sudo snap install vlc
# Method 3: Flatpak install
flatpak install flathub org.videolan.VLC -yVLC has its own built-in codecs, so it can play most formats even without installing ubuntu-restricted-extras.
mpv
mpv is a lightweight yet powerful video player, widely loved by Linux users:
sudo apt install mpv -yBasic usage:
# Play a video
mpv video.mp4
# Play a network video
mpv https://example.com/video.mp4
# Play a YouTube video (requires yt-dlp)
mpv "https://www.youtube.com/watch?v=VIDEO_ID"mpv configuration file ~/.config/mpv/mpv.conf:
# Hardware decoding
hwdec=auto
# High-quality scaling
profile=gpu-hq
# Default volume
volume=80
# Subtitle font size
sub-font-size=40
# Screenshot save path
screenshot-directory=~/Pictures/mpv
# Enable OSD
osd-bar=yesmpv keyboard shortcuts:
| Shortcut | Action |
|---|---|
Space | Pause/Play |
f | Toggle fullscreen |
← / → | Rewind/Forward 5 seconds |
↑ / ↓ | Rewind/Forward 60 seconds |
9 / 0 | Decrease/Increase volume |
s | Screenshot |
v | Toggle subtitles |
Celluloid (GNOME MPV)
A GTK graphical frontend for mpv, better suited for the GNOME desktop:
sudo apt install celluloid -yShowtime
The default GNOME video player, pre-installed in Ubuntu 26.04 — no manual installation needed. Showtime can play common formats after codecs are installed. For broader format compatibility, VLC or mpv is still recommended.
Audio Playback
Installing Audio Codecs
sudo apt install libavcodec-extra -yPopular Music Players
# Rhythmbox (GNOME default)
sudo apt install rhythmbox -y
# Audacious (lightweight)
sudo apt install audacious -y
# Spotify
sudo snap install spotifyDVD and Blu-ray Playback
DVD Playback
sudo apt install libdvd-pkg -y
sudo dpkg-reconfigure libdvd-pkgBlu-ray Support
sudo apt install libbluray-bdj libaacs0 -y
mkdir -p ~/.config/aacs
# You will need to obtain a KEYDB.cfg file from the internetSubtitle Support
# Install subtitle-friendly fonts
sudo apt install fonts-noto-cjk fonts-wqy-zenhei fonts-wqy-microhei -yConfigure subtitles in mpv:
# ~/.config/mpv/mpv.conf
sub-auto=fuzzy
sub-font="Noto Sans CJK SC"
sub-font-size=36
sub-border-size=2yt-dlp Video Downloading
# Install yt-dlp
sudo apt install yt-dlp -y
# Or install the latest version with pipx (under Python 3.13, the system pip is
# restricted by PEP 668, so plain pip install will not work)
sudo apt install pipx
pipx install yt-dlp
# Download a video
yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"
# Download best quality
yt-dlp -f "bestvideo+bestaudio" "URL"
# Download audio only
yt-dlp -x --audio-format mp3 "URL"After installing the full codec suite, Ubuntu 26.04 can smoothly play all common audio and video formats.