HEVC on Linux

On Linux the HEVC decoder comes from FFmpeg (libavcodec), already used by VLC, mpv and Kodi. What needs setting up is hardware acceleration, especially for 4K.

Updated 6 sources cited

Key points

  • The HEVC decoder lives in FFmpeg (libavcodec): VLC, mpv, Kodi and Celluloid use it.
  • Ubuntu: ubuntu-restricted-extras. Debian: ffmpeg and gstreamer1.0-libav. Fedora: RPM Fusion.
  • For smooth 4K enable acceleration: VA-API (Intel, AMD) or NVDEC (NVIDIA), and verify it with vainfo.

Ubuntu and derivatives (Linux Mint, Pop!_OS)

sudo apt update
sudo apt install ubuntu-restricted-extras ffmpeg gstreamer1.0-libav vainfo
# Intel (Broadwell or newer):
sudo apt install intel-media-va-driver-non-free
# AMD:
sudo apt install mesa-va-drivers

Linux Mint offers to install multimedia codecs during setup or from the welcome screen.

Debian

Since Debian 12, FFmpeg and GStreamer from the official repositories include HEVC. Enable contrib non-free non-free-firmware in /etc/apt/sources.list if you want Intel's non-free VA-API driver.

sudo apt install ffmpeg gstreamer1.0-libav gstreamer1.0-plugins-bad vainfo
sudo apt install intel-media-va-driver-non-free   # Intel
sudo apt install mesa-va-drivers                  # AMD

Fedora

Fedora ships no HEVC because of patents: its FFmpeg is cut down and its Mesa disables HEVC acceleration. RPM Fusion fixes it:

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
  https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf swap ffmpeg-free ffmpeg --allowerasing
sudo dnf install gstreamer1-plugin-libav libva-utils
sudo dnf swap mesa-va-drivers mesa-va-drivers-freeworld    # AMD
sudo dnf install intel-media-driver                        # Intel

On openSUSE the equivalent is the Packman repository; on Arch, everything is in the official repos (ffmpeg, libva-utils, intel-media-driver or libva-mesa-driver).

Verify hardware acceleration

  1. Run vainfovainfo | grep -i hevc should list VAProfileHEVCMain (and Main10) with VAEntrypointVLD.
  2. Test with mpvmpv --hwdec=auto video.mkv and press i: you'll see "HW: vaapi" or "nvdec".
  3. NVIDIAWith the proprietary driver, mpv uses NVDEC directly; Firefox and Chrome need the nvidia-vaapi-driver bridge.
  4. BrowserFirefox 137 or later plays HEVC with working VA-API; in Chrome, check chrome://gpu.

GPUs with an HEVC decoder

Intel
  1. 2015 6th gen (Skylake): 8-bit
  2. 2016 7th gen (Kaby Lake): 10-bit
AMD
  1. 2015 Carrizo APUs and R9 Fury: 8-bit
  2. 2016 RX 400 (Polaris): 10-bit
NVIDIA
  1. 2015 GTX 950/960: Main y Main 10
  2. 2016 GTX 10: up to 12-bit
Before those dates HEVC can only be decoded in software (slow at 4K). Sources: NVIDIA, Intel, Wikipedia.

If you use Flatpak

Flathub players (VLC, mpv, Celluloid, Haruna, Kodi) bring their own FFmpeg with HEVC through the org.freedesktop.Platform.ffmpeg-full runtime; for acceleration on Intel, also install org.freedesktop.Platform.VAAPI.Intel. It's the easiest route on Fedora if you'd rather not enable RPM Fusion.

Frequently asked questions

Why doesn't Fedora play HEVC out of the box?

Because of patents, Fedora ships no HEVC decoders in its official repositories and its Mesa build disables HEVC acceleration. Enable RPM Fusion and install full ffmpeg and mesa-va-drivers-freeworld.

How do I know if my GPU accelerates HEVC on Linux?

Run vainfo (package vainfo or libva-utils) and look for VAProfileHEVCMain and VAProfileHEVCMain10 with VAEntrypointVLD. With NVIDIA's proprietary driver, use mpv with --hwdec=nvdec.

Sources

  1. FFmpeg Wiki. Hardware acceleration (VA-API, NVDEC, QSV, VideoToolbox)
  2. Arch Wiki. Hardware video acceleration (VA-API, comprobación con vainfo)
  3. RPM Fusion. Configuration and multimedia
  4. Debian Wiki. Multimedia codecs
  5. Ubuntu Desktop documentation (paquete ubuntu-restricted-extras)
  6. GStreamer. Plugins: libav, va y x265