You are not logged in.
Hardware video decoding drastically decreases CPU usage when watching videos.
NOTE: This message might become outdated with time, please refer to the wiki page for the up-to-date information.
extra/chromium is now being compiled with VA-API support!
IMPORTANT: There is no official support for HW acceleration from Chromium or Arch Linux teams, this is the place to get help from friendly community.
===========================================================================================
Depending on your GPU model, you may achieve HW acceleration on H.264 and VP8/VP9 video codecs.
To see whether you are currently using Hardware or Software acceleration, play a video and in a new tab open chrome://media-internals/, click on the video and check the video_decoder field:
Hardware acceleration: MojoVideoDecoder, GpuVideoDecoder
Software acceleration: VpxVideoDecoder, FFmpegVideoDecoder (some say it's Hardware acceleration?)
Also check chrome://gpu and ensure that you see:
Video Decode: Hardware accelerated
Here's a list of Chromium flags that may or may not be useful, experiment by adding some of them to ~/.config/chromium-flags.conf:
--enable-gpu-rasterization
--ignore-gpu-blacklist
--disable-gpu-driver-workarounds
For more info, see wiki for Hardware video acceleration in Chromium
---------------------------------------------------------------------------------
When asking for support, please post the output of $ vainfo (from libva-utils package).
---------------------------------------------------------------------------------
Drivers: See wiki for Hardware video acceleration
Notes for NVIDIA GPU:
VP8/9 video decoding WILL NOT WORK!
GeForce GTX 750 SE and after support HEVC and VP9 video decoding but VDPAU,the only VAAPI backend available for Nvidia users with libva-vdpau-driver, doesn't support VP8/9.
4 ways to solve this:
- Add VP9 support to VDPAU but it hasn't been actively maintained since at least 3 years
- Force the use of an other codec with an extension like h264ify
- Stream the video to mpv using https://aur.archlinux.org/packages/play-with-mpv-git/ and configure it to use the new NVDEC engine which does support VP9
- Make NVDEC able to be used by VA-API but it seems a dead-end (see https://devtalk.nvidia.com/default/topi … aapi-nvdec- )
Last edited by maximbaz (2020-07-09 14:21:31)
Offline
Hardware video decoding drastically decreases CPU usage when watching videos.
Currently AUR/chromium-vaapi is provided with VA-API support, but it might be soon integrated directly in extra/chromium.
Oh G-d no!
IMPORTANT: There is no official support for HW acceleration from Chromium or Arch Linux teams, this is the place to get help from friendly community.
Right -- this is exactly why as per https://wiki.archlinux.org/index.php/Ar … Simplicity and Arch's general "we don't add downstream features to software" policy, we shouldn't do this...
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
It's in with the latest update. https://git.archlinux.org/svntogit/pack … 7fdfbeed24
Offline
Right -- this is exactly why as per https://wiki.archlinux.org/index.php/Ar … Simplicity and Arch's general "we don't add downstream features to software" policy, we shouldn't do this...
All I can say is that it wasn't a rushed decision. Maxim asked me about including the VAAPI patch in Chromium back in November but I was still on the fence about it, for reasons similar to yours.
However, with other distros adopting this feature and the fact that it's basically enabling code that's already used on Chrome OS, I believe it's worth to make an exception (as done for Widevine too).
As per the above, chromium 72.0.3626.96-2 is the first official release with VAAPI enabled.
Offline
Okay. Given the suggestion "There is no official support for HW acceleration from Chromium or Arch Linux teams" I assume we're just going to punt all bugs to Fedora, where they will close the bugs due to not supporting Arch.
As I said elsewhere: I guess the chances of this being ever upstreamed have now dropped from 2% to 0%. Apparently there wasn't much hope of this anyway...
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Thank God, it's finally in the official package!
Thanks foutrelis and maximbaz, it works great on my machine.
Offline
Enabling CheckerImaging is no longer needed, since it is now used if an image has async=true.
Chromium#Hardware video acceleration on wiki attempts to document current state.
Offline
Thanks svito! The workaround for AMD/ATI is also shipped together with chromium, so no need to apply it manually anymore, and I believe VAAPI is enabled by default with the current patch, so there's no need for --enable-accelerated-* flags — could you please confirm?
Offline
Thanks svito! The workaround for AMD/ATI is also shipped together with chromium, so no need to apply it manually anymore, and I believe VAAPI is enabled by default with the current patch, so there's no need for --enable-accelerated-* flags — could you please confirm?
Yes, can confirm all above is true.
Thanks to everybody who helped this to happen
Last edited by svito (2019-02-08 13:21:47)
Offline
As I said elsewhere: I guess the chances of this being ever upstreamed have now dropped from 2% to 0%. Apparently there wasn't much hope of this anyway...
The onus is on Google, and always has been, to build vaapi in by default on Linux. If every major distro is shipping patched Chromium that demonstrates the vaapi parts work fine in deployment they might finally consider upstreaming it. Up until now their argument has always been "Linux is too niche and we don't want to dedicate resources to verify it all works".
Offline
maximbaz wrote:Hardware video decoding drastically decreases CPU usage when watching videos.
Currently AUR/chromium-vaapi is provided with VA-API support, but it might be soon integrated directly in extra/chromium.
Oh G-d no!
IMPORTANT: There is no official support for HW acceleration from Chromium or Arch Linux teams, this is the place to get help from friendly community.
Right -- this is exactly why as per https://wiki.archlinux.org/index.php/Ar … Simplicity and Arch's general "we don't add downstream features to software" policy, we shouldn't do this...
It doesn't matter that much, users still need to expliciet enable VA-API decoding, this patch simple allows it.
By default Chromium will (still) use software decoding.
Offline
Just a comment to say that this is working wonderfully on my XPS9550 using the integrated Intel graphics. No flags required.
Last edited by OdinEidolon (2019-02-08 19:30:58)
Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee
Offline
** "we don't add downstream features to software" policy, we shouldn't do this...
ok, now break rules, why not build wayland supported together?
Offline
ok, now break rules, why not build wayland supported together?
Because Wayland port of Chromium is still in the works by Igalia folks. It is in AUR nonetheless: chromium-ozone-wayland-git.
Last edited by svito (2019-02-09 08:47:46)
Offline
Hardware video decoding drastically decreases CPU usage when watching videos.
...Intel GPU:
Install libva-intel-driver
..
Any particular difference/reason to use this as opposed to intel-media-driver?
Offline
Looks like these are made for different GPUs:
extra/libva-intel-driver 2.3.0-2
VA-API implementation for Intel G45 and HD Graphics family
community/intel-media-driver 18.4.1-1
Intel Media Driver for VAAPI — Broadwell+ iGPUs
I have never heard of intel-media-driver before, is it working well for you? If so, I'll update the first post to include it.
I've tested out of curiosity, having intel-media-driver installed has no effect for me (Intel Core i7-7820HQ), having software decoding.
Offline
Also, is it normal that I'm seeing all 4 cores hitting 50-60% utilisation in htop when watching a YouTube video despite FFmpegVideoDecoder being reported in chrome://media-internals/ (which is GPU decoding, right?) ?
Looks like these are made for different GPUs:
extra/libva-intel-driver 2.3.0-2 VA-API implementation for Intel G45 and HD Graphics family community/intel-media-driver 18.4.1-1 Intel Media Driver for VAAPI — Broadwell+ iGPUs
I have never heard of intel-media-driver before, is it working well for you? If so, I'll update the first post to include it.
I've tested out of curiosity, having intel-media-driver installed has no effect for me (Intel Core i7-7820HQ), having software decoding.
I was using the libva-intel-driver, but learned about the other here: https://wiki.archlinux.org/index.php/Ha … tion#Intel . I'm using integrated intel graphics on an i5 SKL chip so opted for that driver over the libva-intel-driver package since the libva* one is described as being for supporting some older GPUs, but the subset of features that SKL GPU is capable of looks to be delivered by intel-media-driver: https://wiki.archlinux.org/index.php/Ha … PI_drivers & https://github.com/intel/media-driver/b … a-features.
I'm not sure how to "test" using either one really so at the moment I'm just trying to use "what the wiki says is right for my setup". I'm actually teetering on installing Chromium due to enabling hardware decoding turning out to be problematic in Brave Browser.
I'm still trying to verify my setup.
While I'm here, and I think it is related, if I look at the driver X has loaded I see:
$ grep -iE "vdpau|vaapi|va\-api|dri driver" ~/.local/share/xorg/Xorg.0.log
[ 75.287] (II) intel(0): [DRI2] DRI driver: i965
[ 75.287] (II) intel(0): [DRI2] VDPAU driver: va_gl
$ set | grep -i libva
LIBVA_DRIVER_NAME=iHD
$ vdpauinfo
display: :0.0 screen: 0
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
$ vainfo
vainfo: VA-API version: 1.4 (libva 2.4.0)
vainfo: Driver version: Intel iHD driver - 1.0.0
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
$ lsmod | grep -iE "i915|i965|ihd"
i915 2109440 16
intel_gtt 24576 1 i915
i2c_algo_bit 16384 1 i915
drm_kms_helper 208896 1 i915
drm 499712 9 drm_kms_helper,i915
Clearly not using VDPAU so would have thought X would load something relating to VAAPI, i915 (not i965) and the iHD_drv_video.so file that comes from the intel-media-driver package since LIBVA_DRIVER_NAME=iHD is set as per https://wiki.archlinux.org/index.php/Ha … ing_VA-API environment variable where i965 relates to VDPAU as provided by libva-intel-driver, according to that wiki article.
What is the difference between the following files:
$ sudo pacman -Fs i965_dri.so
extra/mesa 18.3.3-2
usr/lib/dri/i965_dri.so
$ sudo pacman -Fs i915_dri.so
extra/mesa 18.3.3-2
usr/lib/dri/i915_dri.so
$ sudo pacman -Fs iHD_drv_video.so
community/intel-media-driver 18.4.1-1
usr/lib/dri/iHD_drv_video.so
$ sudo pacman -Ql libva-intel-driver
libva-intel-driver /usr/lib/dri/i965_drv_video.so
Do the video drivers sit on top of mesa?
Also should iHD_drv_video.so be executable in this list?
$ ls -la /usr/lib/dri/ | grep -iE "i915|i965|ihd"
-rwxr-xr-x 5 root root 10088368 Feb 8 02:40 i915_dri.so
-rwxr-xr-x 5 root root 10088368 Feb 8 02:40 i965_dri.so
-rw-r--r-- 1 root root 28179752 Feb 4 10:10 iHD_drv_video.so
You mentioned testing, but I don't think I've even passed the verification of my setup. Should first make sure I'm using the correct driver (it's all quite confusing when you load i915 as a kernel module, but then there are still other articles about passing content directly to GPU via such and such driver which is an extra package). Still learning about this topic and have many things still to understand: intel/^xf86-*/{m,v}esa/vdpau/vaapi/i915/open{GL,CL} ....
Last edited by miomio (2019-02-10 04:23:37)
Offline
once wrote:ok, now break rules, why not build wayland supported together?
Because Wayland port of Chromium is still in the works by Igalia folks. It is in AUR nonetheless: chromium-ozone-wayland-git.
does this article matter?
https://www.phoronix.com/scan.php?page= … provements
Offline
YT likes to play VP9 => https://chrome.google.com/webstore/deta … kgioiakgal
Online
maximbaz wrote:Hardware video decoding drastically decreases CPU usage when watching videos.
...Intel GPU:
Install libva-intel-driver
..
Any particular difference/reason to use this as opposed to intel-media-driver?
Apparently you can have both installed and they do not seem to conflict... even though I have seen no difference if both are installed, if I remove `libva-intel-driver` `h264` youtube videos will decode with `FFmpegVideoDecoder` instead of `MojoVideoDecoder`, and CPU usage is similar. I have no idea which is better, but `vlc` seems to require `libva-intel-driver`, so I'll just keep them both installed.
PS: VP9 vides are not HW decoded in any case, on my XPS15 with SKL (i5-6300HQ).
PPS: I use the ImprovedTube extension to force h264.
Last edited by OdinEidolon (2019-02-10 08:18:46)
Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee
Offline
youtube videos will decode with `FFmpegVideoDecoder` instead of `MojoVideoDecoder`, and CPU usage is similar.
FFmpegVideoDecoder = No Hardware acceleration
MojoVideoDecoder / GpuVideoDecoder = Hardware acceleration
At least that's my observation, correct me if I'm wrong.
Regarding libva-intel-driver vs intel-media-driver:
intel-media-driver is a new driver which is only supported by newer iGPU generations (Broadwell+).
You can use vainfo command to see if `vaapi` is working and which driver is used.
See https://wiki.archlinux.org/index.php/Ha … son_tables for a feature comparison.
Both drivers can be installed simultanously and it is possible to select a specific driver with the environment variable LIBVA_DRIVER_NAME.
e.g. for using the new media-driver:
❯ LIBVA_DRIVER_NAME=iHD vainfo
vainfo: VA-API version: 1.4 (libva 2.3.0)
vainfo: Driver version: Intel iHD driver - 1.0.0
e.g. for using the "old" intel driver:
❯ LIBVA_DRIVER_NAME=i965 vainfo
vainfo: VA-API version: 1.4 (libva 2.3.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Kaby Lake - 2.3.0
This environment variable can also be used when starting chromium to try out different VAAPI drivers.
All available drivers are listed in /usr/lib/dri/.
All this is well described in the Wiki: https://wiki.archlinux.org/index.php/Ha … figuration
My observation is, that the old "i965" drivers is more stable when used with the chromium vaapi patch.
The new driver works too but videos load slowly and skipping does not work all the time. Errors appear in console.
When using the new driver in other applications like mpv everything appears to work fine.
issues with iHD/intel-media driver:
❯ LIBVA_DRIVER_NAME=iHD chromium
[14247:14247:0210/143633.570065:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
[14247:14247:0210/143802.443032:ERROR:vaapi_wrapper.cc(1149)] Failed syncing surface VA error: internal decoding error
[616:727:0210/143802.443646:ERROR:render_media_log.cc(30)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"VDA Error 4"}
[616:727:0210/143802.443828:ERROR:render_media_log.cc(30)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"video decode error"}
[616:616:0210/143802.444028:ERROR:render_media_log.cc(30)] MediaEvent: PIPELINE_ERROR PIPELINE_ERROR_DECODE
[14188:14188:0210/143855.862871:ERROR:media_internals.cc(112)] Cannot get RenderProcessHost
[14188:14188:0210/143855.945470:ERROR:http_bridge.cc(126)] Not implemented reached in virtual void syncer::HttpBridgeFactory::OnSignalReceived()
working vaapi/no issues with i965 driver:
❯ LIBVA_DRIVER_NAME=i965 chromium
[15717:15717:0210/143858.974914:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
[15654:15654:0210/143942.304932:ERROR:textfield.cc(1777)] Not implemented reached in virtual bool views::Textfield::ShouldDoLearning()
vaapi broken (driver missing):
❯ chromium
[17610:17610:0210/144825.010493:ERROR:vaapi_wrapper.cc(324)] vaInitialize failed: unknown libva error
[17610:17610:0210/144825.028780:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
Last edited by jbbr (2019-02-10 13:56:16)
Offline
OdinEidolon wrote:youtube videos will decode with `FFmpegVideoDecoder` instead of `MojoVideoDecoder`, and CPU usage is similar.
FFmpegVideoDecoder = No Hardware acceleration
MojoVideoDecoder / GpuVideoDecoder = Hardware accelerationAt least that's my observation, correct me if I'm wrong.
Regarding libva-intel-driver vs intel-media-driver:
intel-media-driver is a new driver which is only supported by newer iGPU generations (Broadwell+).
You can use vainfo command to see if `vaapi` is working and which driver is used.
See https://wiki.archlinux.org/index.php/Ha … son_tables for a feature comparison.Both drivers can be installed simultanously and it is possible to select a specific driver with the environment variable LIBVA_DRIVER_NAME.
e.g. for using the new media-driver:
❯ LIBVA_DRIVER_NAME=iHD vainfo vainfo: VA-API version: 1.4 (libva 2.3.0) vainfo: Driver version: Intel iHD driver - 1.0.0
e.g. for using the "old" intel driver:
❯ LIBVA_DRIVER_NAME=i965 vainfo vainfo: VA-API version: 1.4 (libva 2.3.0) vainfo: Driver version: Intel i965 driver for Intel(R) Kaby Lake - 2.3.0
This environment variable can also be used when starting chromium to try out different VAAPI drivers.
All available drivers are listed in /usr/lib/dri/.All this is well described in the Wiki: https://wiki.archlinux.org/index.php/Ha … figuration
My observation is, that the old "i965" drivers is more stable when used with the chromium vaapi patch.
The new driver works too but videos load slowly and skipping does not work all the time. Errors appear in console.
When using the new driver in other applications like mpv everything appears to work fine.issues with iHD/intel-media driver:
❯ LIBVA_DRIVER_NAME=iHD chromium [14247:14247:0210/143633.570065:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process. [14247:14247:0210/143802.443032:ERROR:vaapi_wrapper.cc(1149)] Failed syncing surface VA error: internal decoding error [616:727:0210/143802.443646:ERROR:render_media_log.cc(30)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"VDA Error 4"} [616:727:0210/143802.443828:ERROR:render_media_log.cc(30)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"video decode error"} [616:616:0210/143802.444028:ERROR:render_media_log.cc(30)] MediaEvent: PIPELINE_ERROR PIPELINE_ERROR_DECODE [14188:14188:0210/143855.862871:ERROR:media_internals.cc(112)] Cannot get RenderProcessHost [14188:14188:0210/143855.945470:ERROR:http_bridge.cc(126)] Not implemented reached in virtual void syncer::HttpBridgeFactory::OnSignalReceived()
working vaapi/no issues with i965 driver:
❯ LIBVA_DRIVER_NAME=i965 chromium [15717:15717:0210/143858.974914:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process. [15654:15654:0210/143942.304932:ERROR:textfield.cc(1777)] Not implemented reached in virtual bool views::Textfield::ShouldDoLearning()
vaapi broken (driver missing):
❯ chromium [17610:17610:0210/144825.010493:ERROR:vaapi_wrapper.cc(324)] vaInitialize failed: unknown libva error [17610:17610:0210/144825.028780:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
Thanks for testing. My feeling is that `FFmpegVideoDecoder` is also hardware decoding, since CPU usage is very similar between the two in my system, but I can't find documentation on this.
Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee
Offline
Wooow, thank you guys for sharing this information about different drivers! When launching LIBVA_DRIVER_NAME=iHD chromium, I get much better experience with intel-media-driver than with the "old" i965 driver from libva-intel-driver, now finally I get smooth playback for a 4k VP9 video with ~19% CPU usage!
When testing, I recommend you download a video using youtube-dl and then play it, otherwise CPU usage will jump once browser decides to download the next piece of the video.
Regarding FFmpegVideoDecoder, I don't know for sure, some say it's Software decoding, others say it's Hardware decoding (at least on NVidia). On Intel I have never seen this value, I've only seen Gpu and now Mojo.
Offline
Thanks for testing. My feeling is that `FFmpegVideoDecoder` is also hardware decoding, since CPU usage is very similar between the two in my system, but I can't find documentation on this.
CPU usage with this vaapi patch is not as low as one would expect (compared to mpv and other players). Still mostly better than CPU encoding.
If you have a strong CPU using it for decoding works very well. It's difficult to see if GPU encoding is working just by looking at the CPU usage.
You can use "intel_gpu_top" tool (Package intel-gpu-tools) to verify if HW video decoder of intel GPU is used. See if "Engine Video" shows any activity when playing a video.
i965:
iHD:
None/ffmpeg/vpx:
Last edited by jbbr (2019-02-10 14:51:36)
Offline
OdinEidolon wrote:Thanks for testing. My feeling is that `FFmpegVideoDecoder` is also hardware decoding, since CPU usage is very similar between the two in my system, but I can't find documentation on this.
CPU usage with this vaapi patch is not as low as one would expect (compared to mpv and other players). Still mostly better than CPU encoding.
If you have a strong CPU using it for decoding works very well. It's difficult to see if GPU encoding is working just by looking at the CPU usage.You can use "intel_gpu_top" tool (Package intel-gpu-tools) to verify if HW video decoder of intel GPU is used. See if "Engine Video" shows any activity when playing a video.
...
I'm not certain `FFmpegVideoDecoder` is hw decoding. My CPU cores (i5-6300U SKL) are high during that compared to mpv+vaapi with a *.mkv which is <10% on 2-3 cores. I've seen docs somewhere that describe `GpuVideoDecoder` being hw though.
Thanks for the suggestion on that tool, btw.
YT likes to play VP9 => https://chrome.google.com/webstore/deta … kgioiakgal
Yes, I use that.
Last edited by miomio (2019-02-10 16:54:24)
Offline