4K video hardware decoding low performance

Hello everyone.
Half of the problem was resolved on this post: Sluggish system on i9-11900H and RTX3080M - #52 by astrodarius
After that whole story, I got my system to score very very well in Unigine_Heaven, Geekbench and Geekbench --compute (OpenCL). OpenCL was even better than on Windows.


TL;DR

I have performance issues when playing youtube 4k videos.

  • When I play a youtube 4k video in Brave or Librewolf without doing other things on the laptop, I’m getting some dropped frames. Best result was about 10 dropped out of 10000, but only after many many days of trial and error.
  • When I play two youtube 4k videos at once, the entire system becomes unresponsive and dropped frames go up to 70%. I can barely take one screenshot but it takes me about a minute to do it.
  • On HDMI I get choppy playback. On USB-C I get almost good playback for videos.
  • CPU usage goes very high, together with intel GPU usage.
  • Brave in chrome://media-internals shows the software VpxVideoDecoder.
  • Sometimes Brave shows the Dav1dVideoDecoder. For VP09 sometimes it’s Dav1d and sometimes it’s Vpx, driving me crazy!
  • I tried tens of combinations of flags for Brave, with the help of ChatGPT and various posts I found here and there.
    • Best result, 10 frames dropped out of 10000: LIBVA_DRIVER_NAME=iHD brave --enable-features=VaapiVideoDecoder --ignore-gpu-blocklist. But it’s still the software VpxVideoDecoder, I’m very confused.
    • brave --enable-features=VaapiVideoDecoder --use-gl=desktop --ignore-gpu-blocklist --enable-zero-copy
    • and other combinations
  • I found a workaround using mpv, mpv-handler, the ViolentMonkey browser extension and a user script in Brave. I’ll detail this later in the post because it’s the solution with the best performance.

In the image, see the Dav1d decoder, so it’s hardware but still dropping lots of frames.

I keep getting this error from Brave, in the terminal:

[20697:20697:0705/095236.238020:ERROR:components/viz/service/main/viz_main_impl.cc:184] Exiting GPU process due to errors during initialization

[20464:20464:0705/095236.834522:ERROR:mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:732] Message 0 rejected by interface blink.mojom.WidgetHost

Hardware

I’m running Garuda Mokka with KDE and Wayland on a laptop, an ASUS Zenbook Pro Suo UX502HS with the following specs:

  • CPU: Intel i9 11900H
  • RAM: 32Gb
  • GPU: Nvidia RTX 3080 Mobile, 8Gb
  • Displays:
    • Primary integrated display, 4k, OLED, 3840x2160, scaling 200%
    • Secondary integrated display, 3840x1100, scaling 150%
    • External display, Asus PA279CV, 4k, 3840x2160, scaling 150%. On HDMI playback is choppy but Unigine_Heaven is better. On USB-C playback is smoother.

The primary integrated display and the external display have ICC profiles assigned to them in Display settings


Why do I need to play 2 videos at once

I really want to keep using linux as my daily driver. I like Garuda and Pop!_OS, and Pop!_OS is too old at this point, it’s from 2022 and we’re in 2025.
But I need to be able to do the following with my computer:

  1. Edit 4K multicam videos in DaVinci Resolve Studio. By the way, Resolve works great in Garuda. Even the Speed Editor works via Bluetooth. I’m very very happy about this. In Pop!_OS it was only working via wired USB.

  2. Connect via Moonlight to a Sunshine server that runs in a Windows VM. Thi VM is on a separate Proxmox server. There, in Windows, I have CaptureOne.

  • The thing is that Moonlight actually displays a 4k video stream, and I like to also have youtube playing on another screen while I work in CaptureOne. So in total there are 2 video streams playing on my laptop.
  1. Be able to play 2 videos at once with mpv, vlc or any other player, side by side, for comparison.

What did I try so far

Based on the initial post linked at the top of this one, I did the following:

sudo pacman -Rdd garuda-nvidia-config nvidia-dkms nvidia-settings nvidia-utils opencl-nvidia libxnvctrl lib32-nvidia-utils lib32-opencl-nvidia gwe python-py3nvml nvidia-prime
sudo pacman -S nvidia-open-dkms egl-wayland lib32-nvidia-utils lib32-opencl-nvidia nvidia-settings opencl-nvidia nvidia-utils nvidia-prime
sudo pacman -S dxvk vulkan-icd-loader vulkan-tools lib32-vulkan-icd-loader
paru -S lib32-libdxvk-gplasync
kwriteconfig5 --file kwinrc --group Compositing --key Backend OpenGL3

Then, I did the following:

sudo pacman -S libva-nvidia-driver

What I have now

So at this point I have:

  • correct drivers for my RTX3080, the nvidia-open-dkms
  • vulkan
  • dxvk
  • libva nvidia, for nvidia-vaapi decoding.
  • getting very good results in benchmarks.

But my problem is that when I play 4k videos, especially in a browser, my system gets slow.
With some settings in mpv.conf, I can get decent performance.

MPV settings in ~/.config/mpv/mpv.conf:

geometry=50%:50%
keep-open=yes
force-window=immediate
vo=gpu
ytdl-format=bestvideo+bestaudio
hwdec=nvdec
profile=gpu-hq
gpu-context=x11

And /etc/environment

__GLX_VENDOR_LIBRARY_NAME=nvidia
__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json:/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
MOZ_DISABLE_RDD_SANDBOX=1
LIBVA_DRIVER_NAME=nvidia

Workaround, but cumbersome

I always get dropped frames when playing a 4k video. It’s unwatchable sometimes.
So what I did as a workaround is:

  1. Install Rust
sudo pacman -S rustup
rustup default stable
  1. install mpv-handler
git clone https://github.com/akiirui/mpv-handler.git
cd mpv-handler
cargo install --path .
cp ~/.cargo/bin/mpv-handler ~/.local/bin/
cp ~/mpv-handler/share/linux/mpv-handler.desktop ~/.local/share/applications
cp ~/mpv-handler/share/linux/mpv-handler-debug.desktop ~/.local/share/applications

Then register the mime types

xdg-mime default mpv-handler.desktop x-scheme-handler/mpv
xdg-mime default mpv-handler-debug.desktop x-scheme-handler/mpv-debug
  1. Add .loca/bin to path if it’s not already there, in ~/.bashrc
export PATH="$HOME/.local/bin:$PATH"
  1. Install the ViolentMonkey extension for Brave/Chromium/Chrome

  2. Add the following user script in ViolentMonkey:

// ==UserScript==
// @name         YouTube ▶ MPV Handler
// @version      1.0
// @match        https://www.youtube.com/watch*
// @grant        none
// ==/UserScript==
(function() {
  const insertBtn = () => {
    var clicked = false;
    const actions = document.querySelector('.ytp-left-controls');
    if (!actions || document.querySelector('#mpv-handler-btn')) return;
    const btn = document.createElement('button');
    btn.innerText = '▶ MPV';
    btn.id = 'mpv-handler-btn';
    btn.style = 'margin-left:8px;padding:6px 12px;background:#555;color:#fff;border:none;border-radius:4px;cursor:pointer;';
    btn.onclick = () => {
      if (clicked) { return; }
      document.querySelector('video').pause();
      let data = btoa(window.location.href);
      let safe = data.replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
      //window.location.href = 'mpv://' + window.location.href;
      window.open('mpv://play/' +safe)
      clicked = true;
    };
    actions.appendChild(btn);
  };
  new MutationObserver(insertBtn).observe(document.body, { childList: true, subtree: true });
  window.addEventListener('yt-navigate-finish', insertBtn);
})();

How the script works:

  • It runs on all pages derived from YouTube.
  • It adds a “MPV” button in the bar below the video, where the regular play button is.
  • When you click the button, it will:
    • Pause the currently playing video
    • Open MPV and start the video at maximum quality, because of the ytdl-format=bestvideo+bestaudio in mpv.conf.
    • If you don’t want 4k but prefer 2k or something, it’s possible to customize the value of ytdl-format.

So it works but it’s clunky, and you don’t have autoplay unfortunately. I’ll see if I can implement this feature in the user script, that would be perfect. And possibly adding several buttons for 1080p, 2k and 4k.


Workaround 2

Instead of Moonlight + Sunshine, I’m ussing Remmina with some custom settings for scaling and size, so I can get a 4k RDP connection to my Windows VM.


If anyone else managed to resolve this issue, please let me know how. The videos that I’m using for these tests are the ones from Gamers Nexus because they’re 4k @ 60fps. I don’t really need 60fps though. I’m fine if there’s a slight drop in performance for 60fps videos.

Or if you can post a screenshot of the System Monitor while a youtube 4k video is playing and when 2 are playing at the same time.
I’m curious if I’m the only one facing this issue on a dual-gpu laptop.


Data

Garuda Inxi:

System:
  Kernel: 6.15.4-zen2-1-zen arch: x86_64 bits: 64 compiler: gcc v: 15.1.1 clocksource: tsc
    avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=28bd6bff-8598-41ce-bec6-ae24465d3bca rw rootflags=subvol=@
    vt.default_red=30,243,166,249,137,245,148,186,88,243,166,249,137,245,148,166
    vt.default_grn=30,139,227,226,180,194,226,194,91,139,227,226,180,194,226,173
    vt.default_blu=46,168,161,175,250,231,213,222,112,168,161,175,250,231,213,200 quiet
    nvidia-drm.modeset=1 rd.luks.uuid=316249cc-7193-456f-89c1-f3206c9aa185
    rd.luks.key=316249cc-7193-456f-89c1-f3206c9aa185=/.docs/2025.jpg:UUID=C676-0984
    rd.luks.options=316249cc-7193-456f-89c1-f3206c9aa185=keyfile-timeout=10s
    rd.luks.uuid=eafba6ea-1842-45d3-8af3-5ce617c6f478
    resume=/dev/mapper/luks-eafba6ea-1842-45d3-8af3-5ce617c6f478 loglevel=3 ibt=off
  Desktop: KDE Plasma v: 6.4.2 tk: Qt v: N/A info: frameworks v: 6.15.0 wm: kwin_wayland vt: 2
    dm: SDDM Distro: Garuda base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: ZenBook Pro Duo UX582HS_UX582HS v: 1.0
    serial: <superuser required>
  Mobo: ASUSTeK model: UX582HS v: 1.0 serial: <superuser required> uuid: <superuser required>
    UEFI: American Megatrends LLC. v: UX582HS.303 date: 04/21/2022
Battery:
  ID-1: BAT0 charge: 92.6 Wh (100.0%) condition: 92.6/92.6 Wh (100.0%) volts: 15.9 min: 15.9
    model: ASUSTeK ASUS Battery type: Li-ion serial: N/A status: not charging cycles: 11
  Device-1: hidpp_battery_0 model: Logitech MX Ergo Multi-Device Trackball serial: <filter>
    charge: 55% (should be ignored) rechargeable: yes status: discharging
CPU:
  Info: model: 11th Gen Intel Core i9-11900H bits: 64 type: MT MCP arch: Tiger Lake gen: core 11
    level: v4 note: check built: 2020 process: Intel 10nm family: 6 model-id: 0x8D (141) stepping: 1
    microcode: 0x56
  Topology: cpus: 1x dies: 1 clusters: 8 cores: 8 threads: 16 tpc: 2 smt: enabled cache:
    L1: 640 KiB desc: d-8x48 KiB; i-8x32 KiB L2: 10 MiB desc: 8x1.2 MiB L3: 24 MiB desc: 1x24 MiB
  Speed (MHz): avg: 800 min/max: 800/4900:4800 scaling: driver: intel_pstate
    governor: performance cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800
    10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800 bogomips: 79872
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel TigerLake-H GT1 [UHD Graphics] vendor: ASUSTeK driver: i915 v: kernel
    alternate: xe arch: Xe process: Intel 10nm built: 2020-21 ports: active: DP-1,DP-3,eDP-1
    empty: DP-2,HDMI-A-2 bus-ID: 0000:00:02.0 chip-ID: 8086:9a60 class-ID: 0300
  Device-2: NVIDIA GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] vendor: ASUSTeK
    driver: nvidia v: 575.64.03 alternate: nouveau,nvidia_drm non-free: 550-570.xx+ status: current
    (as of 2025-04; EOL~2026-12-xx) arch: Ampere code: GAxxx process: TSMC n7 (7nm)
    built: 2020-2023 ports: active: none empty: HDMI-A-1 bus-ID: 0000:01:00.0 chip-ID: 10de:249c
    class-ID: 0300
  Device-3: IMC Networks USB2.0 HD UVC WebCam driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s
    lanes: 1 mode: 2.0 bus-ID: 3-9:2 chip-ID: 13d3:56eb class-ID: fe01 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.18 with: Xwayland v: 24.1.8 compositor: kwin_wayland
    driver: X: loaded: modesetting,nvidia unloaded: nouveau,vesa alternate: fbdev,intel,nv dri: iris
    gpu: i915 d-rect: 3840x5420 display-ID: 0
  Monitor-1: DP-1 pos: primary,top model: ASUS PA279 serial: <filter> built: 2022 res:
    mode: 3840x2160 hz: 60 scale: 150% (1.5) to: 2560x1440 dpi: 163 gamma: 1.2
    size: 597x336mm (23.5x13.23") diag: 685mm (27") ratio: 16:9 modes: max: 3840x2160 min: 640x480
  Monitor-2: DP-3 pos: bottom model: BOE Display 0x085f built: 2021 res: mode: 3840x1100 hz: 60
    scale: 150% (1.5) to: 2560x733 dpi: 284 gamma: 1.2 size: 344x99mm (13.54x3.9")
    diag: 358mm (14.1") modes: max: 3840x1100 min: 1920x550
  Monitor-3: eDP-1 pos: middle model: Samsung 0x415f built: 2019 res: mode: 3840x2160 hz: 60
    scale: 200% (2) to: 1920x1080 dpi: 284 gamma: 1.2 size: 344x194mm (13.54x7.64")
    diag: 395mm (15.5") ratio: 16:9 modes: 3840x2160
  API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris device: 2 drv: swrast gbm:
    drv: iris surfaceless: drv: iris wayland: drv: iris x11: drv: iris inactive: device-1
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: nvidia mesa v: 575.64.03 glx-v: 1.4 direct-render: yes
    renderer: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2 memory: 7.81 GiB display-ID: :1.0
  API: Vulkan v: 1.4.313 layers: 7 device: 0 type: integrated-gpu name: Intel UHD Graphics (TGL
    GT1) driver: mesa intel v: 25.1.4-arch1.2 device-ID: 8086:9a60 surfaces: N/A device: 1
    type: discrete-gpu name: NVIDIA GeForce RTX 3080 Laptop GPU driver: nvidia v: 575.64.03
    device-ID: 10de:249c surfaces: N/A device: 2 type: cpu name: llvmpipe (LLVM 20.1.6 256 bits)
    driver: mesa llvmpipe v: 25.1.4-arch1.2 (LLVM 20.1.6) device-ID: 10005:0000 surfaces: N/A
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo de: kscreen-console,kscreen-doctor
    gpu: gputop, intel_gpu_top, lsgpu, nvidia-settings, nvidia-smi wl: wayland-info x11: xdriinfo,
    xdpyinfo, xprop, xrandr
Audio:
  Device-1: Intel Tiger Lake-H HD Audio vendor: ASUSTeK driver: sof-audio-pci-intel-tgl
    alternate: snd_hda_intel, snd_soc_avs, snd_sof_pci_intel_tgl bus-ID: 0000:00:1f.3
    chip-ID: 8086:43c8 class-ID: 0401
  Device-2: NVIDIA GA104 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
    bus-ID: 0000:01:00.1 chip-ID: 10de:228b class-ID: 0403
  API: ALSA v: k6.15.4-zen2-1-zen status: kernel-api tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.4.6 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Tiger Lake PCH CNVi WiFi driver: iwlwifi v: kernel bus-ID: 0000:00:14.3
    chip-ID: 8086:43f0 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
  Device-2: Realtek USB 10/100/1G/2.5G LAN driver: r8152 type: USB rev: 3.2 speed: 5 Gb/s
    lanes: 1 mode: 3.2 gen-1x1 bus-ID: 4-1:2 chip-ID: 0bda:8156 class-ID: 0000 serial: <filter>
  IF: enp0s20f0u1 state: up speed: 2500 Mbps duplex: full mac: <filter>
  Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1
    mode: 1.1 bus-ID: 3-14:3 chip-ID: 8087:0026 class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 2 state: up address: N/A
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd v: 0.6 port: N/A
    bus-ID: 0000:00:0e.0 chip-ID: 8086:9a0b rev: class-ID: 0104
Drives:
  Local Storage: total: 1.82 TiB used: 525.96 GiB (28.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 980 PRO 2TB size: 1.82 TiB
    block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 5B2QGXA7 temp: 39.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 410.15 GiB size: 410.15 GiB (100.00%) used: 72.41 GiB (17.7%) fs: btrfs
    dev: /dev/dm-0 maj-min: 253:0 mapped: luks-316249cc-7193-456f-89c1-f3206c9aa185
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 776 KiB (0.3%) fs: vfat
    dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 410.15 GiB size: 410.15 GiB (100.00%) used: 72.41 GiB (17.7%) fs: btrfs
    dev: /dev/dm-0 maj-min: 253:0 mapped: luks-316249cc-7193-456f-89c1-f3206c9aa185
  ID-4: /var/log raw-size: 410.15 GiB size: 410.15 GiB (100.00%) used: 72.41 GiB (17.7%)
    fs: btrfs dev: /dev/dm-0 maj-min: 253:0 mapped: luks-316249cc-7193-456f-89c1-f3206c9aa185
  ID-5: /var/tmp raw-size: 410.15 GiB size: 410.15 GiB (100.00%) used: 72.41 GiB (17.7%)
    fs: btrfs dev: /dev/dm-0 maj-min: 253:0 mapped: luks-316249cc-7193-456f-89c1-f3206c9aa185
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: partition size: 34.14 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/dm-1
    maj-min: 253:1 mapped: luks-eafba6ea-1842-45d3-8af3-5ce617c6f478
  ID-2: swap-2 type: zram size: 31.03 GiB used: 24 KiB (0.0%) priority: 100 comp: zstd
    avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 69.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 32 GiB note: est. available: 31.03 GiB used: 10.83 GiB (34.9%)
  Processes: 423 Power: uptime: 11h 11m states: freeze,mem,disk suspend: s2idle avail: deep
    wakeups: 0 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 12.36 GiB
    services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd v: 257
    default: graphical tool: systemctl
  Packages: 1665 pm: pacman pkgs: 1658 libs: 417 tools: octopi,paru,yay pm: flatpak pkgs: 7
    Compilers: clang: 20.1.7 gcc: 15.1.1 alt: 14 Client: Unknown Client: electron inxi: 3.3.38
Garuda (2.7.3-1):
  System install date:     2025-06-26
  Last full system update: 2025-07-05 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       No/Undetected
  Failed units:            afc.service drkonqi-coredump-processor@13-103747-0.service drkonqi-coredump-processor@14-103768-0.service


vainfo

This shows nvdec because I have installed libva-nvidia-driver

Trying display: wayland
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple            : VAEntrypointVLD
VAProfileMPEG2Main              : VAEntrypointVLD
VAProfileVC1Simple              : VAEntrypointVLD
VAProfileVC1Main                : VAEntrypointVLD
VAProfileVC1Advanced            : VAEntrypointVLD
VAProfileH264Main               : VAEntrypointVLD
VAProfileH264High               : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileHEVCMain               : VAEntrypointVLD
VAProfileVP8Version0_3          : VAEntrypointVLD
VAProfileVP9Profile0            : VAEntrypointVLD
VAProfileAV1Profile0            : VAEntrypointVLD
VAProfileHEVCMain10             : VAEntrypointVLD
VAProfileHEVCMain12             : VAEntrypointVLD
VAProfileVP9Profile2            : VAEntrypointVLD
VAProfileHEVCMain444            : VAEntrypointVLD
VAProfileHEVCMain444_10         : VAEntrypointVLD
VAProfileHEVCMain444_12         : VAEntrypointVLD

vainfo after export LIBVA_DRIVER_NAME=iHD

darius@darius-laptop in ~
󰛓 ❯ export LIBVA_DRIVER_NAME=iHD

darius@darius-laptop in ~
󰛓 ❯ vainfo
Trying display: wayland
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 25.2.5 ()
vainfo: Supported profile and entrypoints
VAProfileNone                   : VAEntrypointVideoProc
VAProfileNone                   : VAEntrypointStats
VAProfileMPEG2Simple            : VAEntrypointVLD
VAProfileMPEG2Simple            : VAEntrypointEncSlice
VAProfileMPEG2Main              : VAEntrypointVLD
VAProfileMPEG2Main              : VAEntrypointEncSlice
VAProfileH264Main               : VAEntrypointVLD
VAProfileH264Main               : VAEntrypointEncSlice
VAProfileH264Main               : VAEntrypointFEI
VAProfileH264Main               : VAEntrypointEncSliceLP
VAProfileH264High               : VAEntrypointVLD
VAProfileH264High               : VAEntrypointEncSlice
VAProfileH264High               : VAEntrypointFEI
VAProfileH264High               : VAEntrypointEncSliceLP
VAProfileVC1Simple              : VAEntrypointVLD
VAProfileVC1Main                : VAEntrypointVLD
VAProfileVC1Advanced            : VAEntrypointVLD
VAProfileJPEGBaseline           : VAEntrypointVLD
VAProfileJPEGBaseline           : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointFEI
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3          : VAEntrypointVLD
VAProfileHEVCMain               : VAEntrypointVLD
VAProfileHEVCMain               : VAEntrypointEncSlice
VAProfileHEVCMain               : VAEntrypointFEI
VAProfileHEVCMain               : VAEntrypointEncSliceLP
VAProfileHEVCMain10             : VAEntrypointVLD
VAProfileHEVCMain10             : VAEntrypointEncSlice
VAProfileHEVCMain10             : VAEntrypointEncSliceLP
VAProfileVP9Profile0            : VAEntrypointVLD
VAProfileVP9Profile1            : VAEntrypointVLD
VAProfileVP9Profile2            : VAEntrypointVLD
VAProfileVP9Profile3            : VAEntrypointVLD
VAProfileHEVCMain12             : VAEntrypointVLD
VAProfileHEVCMain12             : VAEntrypointEncSlice
VAProfileHEVCMain422_10         : VAEntrypointVLD
VAProfileHEVCMain422_10         : VAEntrypointEncSlice
VAProfileHEVCMain422_12         : VAEntrypointVLD
VAProfileHEVCMain422_12         : VAEntrypointEncSlice
VAProfileHEVCMain444            : VAEntrypointVLD
VAProfileHEVCMain444            : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10         : VAEntrypointVLD
VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
VAProfileHEVCMain444_12         : VAEntrypointVLD
VAProfileHEVCSccMain            : VAEntrypointVLD
VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
VAProfileHEVCSccMain10          : VAEntrypointVLD
VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444         : VAEntrypointVLD
VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
VAProfileAV1Profile0            : VAEntrypointVLD
VAProfileHEVCSccMain444_10      : VAEntrypointVLD
VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

vdpauinfo

󰛓 ❯ vdpauinfo
display: :1   screen: 0
API version: 1
Information string: NVIDIA VDPAU Driver Shared Library  575.64.03  Wed Jun 25 18:05:28 UTC 2025

Video surface:

name   width height types
-------------------------------------------
420     8192  8192  NV12 YV12
422     8192  8192  UYVY YUYV
444     8192  8192  NV24 YV24
420_16  8192  8192  P010 P016
422_16  8192  8192  UYVY YUYV
444_16  8192  8192  Y_U_V_444_16

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                           0 65536  4096  4096
MPEG2_SIMPLE                    3 65536  4096  4096
MPEG2_MAIN                      3 65536  4096  4096
H264_BASELINE                  51 65536  4096  4096
H264_MAIN                      51 65536  4096  4096
H264_HIGH                      51 65536  4096  4096
VC1_SIMPLE                      1  8190  2048  2048
VC1_MAIN                        2  8190  2048  2048
VC1_ADVANCED                    4  8190  2048  2048
MPEG4_PART2_SP                  3  8192  2048  2048
MPEG4_PART2_ASP                 5  8192  2048  2048
DIVX4_QMOBILE                   0  8192  2048  2048
DIVX4_MOBILE                    0  8192  2048  2048
DIVX4_HOME_THEATER              0  8192  2048  2048
DIVX4_HD_1080P                  0  8192  2048  2048
DIVX5_QMOBILE                   0  8192  2048  2048
DIVX5_MOBILE                    0  8192  2048  2048
DIVX5_HOME_THEATER              0  8192  2048  2048
DIVX5_HD_1080P                  0  8192  2048  2048
H264_CONSTRAINED_BASELINE      51 65536  4096  4096
H264_EXTENDED                  51 65536  4096  4096
H264_PROGRESSIVE_HIGH          51 65536  4096  4096
H264_CONSTRAINED_HIGH          51 65536  4096  4096
H264_HIGH_444_PREDICTIVE       51 65536  4096  4096
VP9_PROFILE_0                   1 262144  8192  8192
VP9_PROFILE_1                  --- not supported ---
VP9_PROFILE_2                   1 262144  8192  8192
VP9_PROFILE_3                  --- not supported ---
HEVC_MAIN                      153 262144  8192  8192
HEVC_MAIN_10                   153 262144  8192  8192
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   153 262144  8192  8192
HEVC_MAIN_444                  153 262144  8192  8192
HEVC_MAIN_444_10               153 262144  8192  8192
HEVC_MAIN_444_12               153 262144  8192  8192
AV1_MAIN                       16 262144  8192  8192
AV1_HIGH                       --- not supported ---
AV1_PROFESSIONAL               --- not supported ---

Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8         32768 32768    y  Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8
R10G10B10A2      32768 32768    y  Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8

Bitmap surface:

name              width height
------------------------------
B8G8R8A8         32768 32768
R8G8B8A8         32768 32768
R10G10B10A2      32768 32768
B10G10R10A2      32768 32768
A8               32768 32768

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             y
DEINTERLACE_TEMPORAL_SPATIAL     y
INVERSE_TELECINE                 y
NOISE_REDUCTION                  y
SHARPNESS                        y
LUMA_KEY                         y
HIGH QUALITY SCALING - L1        y
HIGH QUALITY SCALING - L2        -
HIGH QUALITY SCALING - L3        -
HIGH QUALITY SCALING - L4        -
HIGH QUALITY SCALING - L5        -
HIGH QUALITY SCALING - L6        -
HIGH QUALITY SCALING - L7        -
HIGH QUALITY SCALING - L8        -
HIGH QUALITY SCALING - L9        -

parameter name                  sup      min      max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH              y         1     8192
VIDEO_SURFACE_HEIGHT             y         1     8192
CHROMA_TYPE                      y
LAYERS                           y         0        4

attribute name                  sup      min      max
-----------------------------------------------------
BACKGROUND_COLOR                 y
CSC_MATRIX                       y
NOISE_REDUCTION_LEVEL            y      0.00     1.00
SHARPNESS_LEVEL                  y     -1.00     1.00
LUMA_KEY_MIN_LUMA                y
LUMA_KEY_MAX_LUMA                y

GPUs

󰛓 ❯ basename $(readlink /sys/class/drm/card0/device)
0000:01:00.0

󰛓 ❯ basename $(readlink /sys/class/drm/card1/device)
0000:00:02.0
sudo lspci -k | grep -A 2 -E "(VGA|3D)"

0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-H GT1 [UHD Graphics] (rev 01)
DeviceName: Second VGA
Subsystem: ASUSTeK Computer Inc. Device 1b52
Kernel driver in use: i915
--
0000:01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] (rev a1)
DeviceName: VGA
Subsystem: ASUSTeK Computer Inc. Device 1b52
Kernel driver in use: nvidia

so card0 is nvidia
and card is intel


pacman -Qs nvidia

󰛓 ❯ pacman -Qs nvidia
local/cuda 12.9.1-1
NVIDIA's GPU programming toolkit
local/egl-gbm 1.1.2.1-1
The GBM EGL external platform library
local/egl-wayland 4:1.1.19-1
EGLStream-based Wayland external platform
local/egl-x11 1.0.2-1
NVIDIA XLib and XCB EGL Platform Library
local/lib32-nvidia-utils 575.64.03-1
NVIDIA drivers utilities (32-bit)
local/lib32-opencl-nvidia 575.64.03-1
OpenCL implemention for NVIDIA (32-bit)
local/libva-nvidia-driver 0.0.14-1
VA-API implementation that uses NVDEC as a backend
local/libvdpau 1.5-3
Nvidia VDPAU library
local/libxnvctrl 575.64-1
NVIDIA NV-CONTROL X extension
local/linux-firmware-nvidia 20250627-1
Firmware files for Linux - Firmware for NVIDIA GPUs and SoCs
local/mhwd-nvidia 575.64.03.1-1
NVIDIA pci id list for MHWD
local/mhwd-nvidia-390xx 390.143-1
mhwd-nvidia-390xx PCI ID database
local/mhwd-nvidia-470xx 470.94-1
mhwd-nvidia-470xx PCI ID database
local/nvidia-open-dkms 575.64.03-1
NVIDIA open kernel modules - module sources
local/nvidia-prime 1.0-5
NVIDIA Prime Render Offload configuration and utilities
local/nvidia-settings 575.64-1
Tool for configuring the NVIDIA graphics driver
local/nvidia-utils 575.64.03-1
NVIDIA drivers utilities
local/opencl-nvidia 575.64.03-1
OpenCL implemention for NVIDIA
local/supergfxctl 5.2.7-2
A utility for Linux graphics switching on Intel/AMD iGPU + nVidia dGPU laptops
local/xf86-video-nouveau 1.0.18-1 (xorg-drivers)
Open Source 3D acceleration driver for nVidia cards

pacman -Qs mesa

pacman -Qs mesa
local/glu 9.0.3-2
Mesa OpenGL utility library
local/lib32-glu 9.0.3-2
Mesa OpenGL utility library (32 bits)
local/lib32-mesa 1:25.1.4-2
Open-source OpenGL drivers - 32-bit
local/lib32-mesa-demos 9.0.0-4
Mesa demos (32-bit)
local/lib32-vulkan-mesa-layers 1:25.1.4-2
Mesa's Vulkan layers - 32-bit
local/mesa 1:25.1.4-2
Open-source OpenGL drivers
local/mesa-demos 9.0.0-7
Mesa demos
local/mesa-utils 9.0.0-7
Essential Mesa utilities
local/vulkan-mesa-layers 1:25.1.4-2
Mesa's Vulkan layers

pacman -Qs intel

󰛓 ❯ pacman -Qs intel
local/acpica 20250404-1
ACPI tools, including Intel ACPI Source Language compiler
local/enblend-enfuse 4.2.r1546+hb66125418f7d-5
Intelligent blend tool for overlapping picture
local/intel-gmmlib 22.7.2-1
Intel Graphics Memory Management Library
local/intel-gpu-tools 2.0-1
Tools for development and testing of the Intel DRM driver
local/intel-media-driver 25.2.5-1
Intel Media Driver for VAAPI — Broadwell+ iGPUs
local/intel-media-sdk 23.2.2-4
Legacy API for hardware video acceleration on Intel GPUs (Broadwell to Rocket Lake)
local/intel-ucode 20250512-1
Microcode update files for Intel CPUs
local/lib32-libva-intel-driver 2.4.1-2
VA-API implementation for Intel G45 and HD Graphics family (32-bit)
local/lib32-vulkan-intel 1:25.1.4-2
Open-source Vulkan driver for Intel GPUs - 32-bit
local/libmfx 23.2.2-4
Intel Media SDK dispatcher library
local/libva-intel-driver 2.4.1-5
VA-API implementation for Intel G45 and HD Graphics family
local/libva-utils 2.22.0-1
Intel VA-API Media Applications and Scripts for libva
local/libvpl 2.15.0-1
Intel Video Processing Library
local/linux-firmware-intel 20250627-1
Firmware files for Linux - Firmware for Intel devices
local/onetbb 2022.2.0-1
oneAPI Threading Building Blocks - a high level abstract threading library
local/openvino 2025.2.0-1
A toolkit for optimizing and deploying deep learning models
local/supergfxctl 5.2.7-2
A utility for Linux graphics switching on Intel/AMD iGPU + nVidia dGPU laptops
local/vulkan-intel 1:25.1.4-2
Open-source Vulkan driver for Intel GPUs
local/whois 5.6.1-1
Intelligent WHOIS client

Thank you for reading this huge post!

I’ve updated the script for Violentmonkey.
New features:

  • Buttons for: max quality, 1440p, 1080p, 720p
  • Show a toast and loading animation after clicking a button

It’s the only way I can play 4k videos reliably. For 1440p and below I can do it in the browser but mpv uses way less resources (cpu,gpu) than playing the video in the browser.

It’s now on github: userscript-youtube-play-in-mpv/user-script.js at main · dariusmihai/userscript-youtube-play-in-mpv · GitHub

Here it is for convenience, but the most up to date will be on github.

// ==UserScript==
// @name         YouTube ▶ MPV Handler + Toast
// @version      1.4
// @match        https://www.youtube.com/watch*
// @grant        none
// @namespace    Violentmonkey Scripts
// @description  Adds buttons below the youtube player to allow the user to watch the video in mpv.
// @author       Darius
// ==/UserScript==

/**
 * Designed to work on Linux.
 *
 * Dependencies:
 * - mpv player
 * - yt-dlp
 * - mpv-handler https://github.com/akiirui/mpv-handler.git
 * - the Violentmonkey browser extension
 *
 * For details and installation instructions, see Readme
 *
 */

(function() {
  const btnStyle = `
    margin-left:8px;
    padding:6px 12px;
    background:#555;
    color:#fff;
    border:none;
    border-radius:4px;
    cursor:pointer;
    position:relative;
  `;

  const styles = `
    .spinner {
      display: inline-block;
      width: 12px;
      height: 12px;
      border: 2px solid rgba(255,255,255,0.3);
      border-top-color: white;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-left: 6px;
      vertical-align: middle;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .mpv-toast {
      position: fixed;
      bottom: 30px;
      right: 30px;
      background: #323232;
      color: white;
      padding: 60px 76px;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.2);
      font-size: 14px;
      opacity: 0;
      transition: opacity 0.3s ease;
      z-index: 9999;
    }
    .mpv-toast.show {
      opacity: 1;
    }
  `;

  const styleEl = document.createElement('style');
  styleEl.textContent = styles;
  document.head.appendChild(styleEl);

  function showToast(msg) {
    const toast = document.createElement('div');
    toast.className = 'mpv-toast';
    toast.textContent = msg;
    document.body.appendChild(toast);

    setTimeout(() => toast.classList.add('show'), 10);
    setTimeout(() => {
      toast.classList.remove('show');
      setTimeout(() => toast.remove(), 500);
    }, 3000);
  }

  function getMpvUrl(quality = '') {
    const data = btoa(window.location.href);
    const safe = data.replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
    return `mpv://play/${safe}${quality ? ('/?quality=' + quality) : ''}`;
  }

  function handleClick(btn, quality = '') {
    const mpvUrl = getMpvUrl(quality);
    window.open(mpvUrl);
    document.querySelector('video')?.pause();

    showToast(`Launching in MPV ${quality ? `(${quality})` : ''}...`);

    if (!btn.querySelector('.spinner')) {
      const spinner = document.createElement('span');
      spinner.className = 'spinner';
      btn.appendChild(spinner);
    }

    const allButtons = document.querySelectorAll('.mpv-handler-btn');
    allButtons.forEach(b => b.disabled = true);
    setTimeout(() => {
      allButtons.forEach(b => {
        b.disabled = false;
        b.querySelector('.spinner')?.remove();
      });
    }, 10000);
  }

  function insertButtons() {
    const controls = document.querySelector('.ytp-left-controls');
    if (!controls || controls.querySelector('.mpv-handler-btn')) return;

    const qualities = [
      { label: '▶ MPV (max)', quality: '' },
      { label: '▶ MPV (1440)', quality: '1440p' },
      { label: '▶ MPV (1080)', quality: '1080p' },
      { label: '▶ MPV (720)', quality: '720p' },
    ];

    for (const { label, quality } of qualities) {
      const btn = document.createElement('button');
      btn.className = 'mpv-handler-btn';
      btn.style = btnStyle;
      btn.textContent = label;
      btn.onclick = () => handleClick(btn, quality);
      controls.insertBefore(btn, controls.firstChild);
    }
  }

  const waitAndInsert = () => {
    const interval = setInterval(() => {
      const ready = document.querySelector('.ytp-left-controls');
      if (ready) {
        clearInterval(interval);
        insertButtons();
      }
    }, 500);
  };

  waitAndInsert();
  document.addEventListener('yt-navigate-finish', waitAndInsert);
})();