[HowTo] Enable Hardware Video Acceleration / Video Decode In Google Chrome, Brave, Vivaldi And Opera Browsers

Researched a bit further.
At first, greetings from Captain Obvious:
You will have to ensure that the graphics card is indeed supporting the desired codecs.
Nvidia NVDEC - Wikipedia is a good source.

In my case, using an NVIDIA GeForce GTX 750 Ti, it looks like VP9 is partly supported (8-bit only). Looks like I had tested previously with an 8-bit VP9 video and thus, got misled.

vainfo and vdpauinfo are even of the opinion that the card doesn’t support VP9 at all so it looks like I will have to either go for a new graphics card or live with h264ify and friends.

I think we need to update this topic since it looks like some flags are not needed i.e. --use-gl=(desktop|egl) has no effect unless you are on Wayland and need it to fallback to XWayland support then --use-gl=desktop is needed.
(Note: Wayland have issue with HW Accl on Electron apps right now as being not working at all.)
those are my flags on my setup (Intel 10870H - gen 9.0):

--ozone-platform-hint=auto
--enable-features=VaapiVideoEncoder,VaapiVideoDecoder,UseOzonePlatform
--disable-features=UseChromeOSDirectVideoDecoder 
--use-vulkan
--disable-gpu-vsync  <== this for monitors with high refresh rates > 60hz to enable those refresh rates not need for HW Accleration.

this need to be investigated further since the --enable-feature=VaapiVideoEncoder,VaapiVideoDecoder are not used <==((For some reason this was a fluke, on my browser (Brave in my case) --enable-feature=VaapiVideoEncoder,VaapiVideoDecoder aren’t needed when Use hardware accerleration when available is on )), in my case, and --use-vulkan is a must (I guess?).
I’ll update those flags if thing changed, and also I think it suppose to work without any need to edit it in both X11 and Wayland.
Tested on X11 with Brave browser and Feetube-git

There really isn’t anything to update.

That does nothing for me. I believe I tried something like this in the past:

--disable-gpu-vsync
--disable-frame-rate-limit
--max-gum-fps=144

This is what I currently use with Chrome, Chromium & Vivaldi:

Xorg session with NVIDIA using libva-vdpau-driver-vp9-git
--enable-gpu-rasterization
--enable-zero-copy
--enable-features=VaapiVideoEncoder,VaapiVideoDecoder,CanvasOopRasterization
Graphics Feature Status
Canvas: Hardware accelerated
Canvas out-of-process rasterization: Enabled
Direct Rendering Display Compositor: Disabled
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
OpenGL: Enabled
Rasterization: Hardware accelerated on all pages
Raw Draw: Disabled
Video Decode: Hardware accelerated
Video Encode: Hardware accelerated
Vulkan: Enabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
WebGPU: Disabled
Wayland session with AMD
--ignore-gpu-blocklist
--enable-gpu-rasterization
--enable-zero-copy
--enable-features=VaapiVideoEncoder,VaapiVideoDecoder,CanvasOopRasterization
--use-gl=egl
--ozone-platform-hint=auto
Graphics Feature Status
Canvas: Hardware accelerated
Canvas out-of-process rasterization: Enabled
Direct Rendering Display Compositor: Disabled
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
OpenGL: Enabled
Rasterization: Hardware accelerated
Raw Draw: Disabled
Video Decode: Hardware accelerated
Video Encode: Hardware accelerated
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
WebGPU: Disabled

In my case with --disable-gpu-vsync

I have three external monitors connected to my laptop: Two are connected to the NVIDIA GPU (DP & HDMI) and one is connected to the Intel GPU (Thunderbolt > DP). The former two are set to 144Hz and the latter I have to set to 60Hz as it turns on and off constantly if I set it any higher.

UFO Test reports 144Hz in Firefox, but not with any Chromium-based browser.

Very interesting, so it’s a chromium issue I guess? it must be that. worth debugging.

I swear everything was working just fine until you posted and I started fiddling with flags. :stuck_out_tongue_winking_eye:

I’ll do more investigation later and see what might need to be changed in both my own configs and the wiki.

Either way, thanks for reminding to keep an eye on things and update this wiki as necessary. :+1:

Here is my working conf for this setup: 86 Hz overclocked display, Vivaldi 5.6, X11, Nvidia GTX 1066, libva-vdpau-driver-vp9-git

--enable-features=VaapiVideoDecoder
--disable-features=UseChromeOSDirectVideoDecoder
--use-gl=desktop        <== this breaks vsync inside Vivaldi, so vsynctester.com shows ~43 fps instead of 86 fps
--disable-gpu-sandbox   <== this solves vsync issue and makes stable and synched 86 fps

1 Like

By Jove, that works! :+1:

Just install the pack “libva-vdpau-driver-vp9-git” and setup the .conf ? do you need to do any extra step, Bcause when I use the command vainfo, it said the driver is not set. I still get high cpu bound

i keep getting video acceleration errors, everytime i try to play video on youtube.

[26733:26733:0221/191510.033476:ERROR:vaapi_wrapper.cc(2699)] : vaPutSurface failed, VA error: unknown libva error
[26733:26733:0221/191510.033613:ERROR:vaapi_video_decode_accelerator.cc(286)] : Failed putting surface into pixmap

i’m on x11
VA-API version: 1.17 (libva 2.17.1)
vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.1
Chrome/110.0.5481.100

Can you show us the output of vainfo ? Does it show VP9 for YouTube?

sure;

Trying display: wayland
Trying display: x11
vainfo: VA-API version: 1.17 (libva 2.17.1)
vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD

i\m using h264fy extension on chrome since i only have codecs for 264. video acceleration was working fine, just dont know when it stopped working. video acceleration works fine on other media players.

I see. YouTube uses VP9 or AV1 video encode by default. AFAIK.

What is your GPU?

sorry was bit late respond, i’m using h264fy extension on chrome since i only have codecs for 264. video acceleration was working fine, just dont know when it stopped working. video acceleration works fine on other media players.

iGPU is intel HD Graphics 4000;

Graphics:
  Device-1: Intel 3rd Gen Core processor Graphics vendor: Dell driver: i915
    v: kernel arch: Gen-7 process: Intel 22nm built: 2012-13 ports:
    active: LVDS-1 empty: DP-1,HDMI-A-1,VGA-1 bus-ID: 00:02.0
    chip-ID: 8086:0166 class-ID: 0300
  Device-2: AMD Thames [Radeon HD 7500M/7600M Series] vendor: Dell
    driver: radeon v: kernel arch: TeraScale-2 code: Evergreen
    process: TSMC 32-40nm built: 2009-15 pcie: gen: 1 speed: 2.5 GT/s lanes: 8
    link-max: gen: 2 speed: 5 GT/s lanes: 16 bus-ID: 01:00.0 chip-ID: 1002:6840
    class-ID: 0300 temp: 46.0 C
  Device-3: Microdia Laptop_Integrated_Webcam_HD type: USB driver: uvcvideo
    bus-ID: 1-1.5:3 chip-ID: 0c45:644a class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.7 compositor: kwin_x11 driver: X:
    loaded: modesetting,radeon alternate: fbdev,vesa dri: crocus,r600 gpu: i915
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
    s-diag: 414mm (16.31")
  Monitor-1: LVDS-1 model: LG Display 0x033a built: 2012 res: 1366x768 hz: 60
    dpi: 101 gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5")
    ratio: 16:9 modes: 1366x768
  API: OpenGL v: 4.2 Mesa 22.3.5 renderer: Mesa Intel HD Graphics 4000 (IVB
    GT2) direct-render: Yes

Maybe h264fy extension is outdated, because I know only YouTube breaks the compatibility of some 3rd-party programmings a few days ago. For example YouTube uploader ID was changed, that is why yt-dlp got a known issue

could be, i’ll report if find a way out of this. so far no bugs have been reported in chrome bug tracker. h264fy seems to function, in the youtube in-player stats indicate that the video stream is indeed; avc1.4d401f (135) / mp4a.40.2 (140) it is also confirmed by chrome developer tools media tab which also says software decoding is in place as also confirmed by intel_gpu_top. i’m having feeling something affecting VAAPI stack is the cause

Since a week or two I had to disable (#)
--use-gl=desktop
on amd and intel igpu to get “vaapi true”.

Edit:
There was a patch for libva (my old intel ivy-bridge needed it)
chromium: hardware video acceleration with VA-API (Page 30) / Applications & Desktop Environments / Arch Linux Forums see post from Akmt

https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/libva/trunk/PKGBUILD

1 Like

rebuilt libva as per instructions, and video acceleration is back again. other than what is already mentioned you can follow the bug@;

From https://chromium.googlesource.com/chromium/src/+/43cfb2f92a5cdc1a787d7326e74676884abf5052, having --ozone-platform-hint=auto will enable native Wayland support and using that on Brave will break hardware acceleration on my system. Not having it will make Brave run on XWayland by default and everything work as expexted.
This breakage seems to only happened recently.
Apparently when not launching from the terminal, Brave would still run in native Wayland. Adding --ozone-platform-hint=x11 “fixed” it but I don’t think this is the optimal solution?