【如何在 Debian、Ubuntu 或 Linux Mint 上的 Google Chrome、Brave、Vivaldi 和 Opera 浏览器中启用硬件加速视频解码】

如何在 Debian、Ubuntu 或 Linux Mint 上的 Google Chrome、Brave、Vivaldi 和 Opera 浏览器中启用硬件加速视频解码
  铬, 操作方法, 视频

Google Chrome 88(及更新版本)已在Linux上提供了硬件加速视频解码功能,但默认情况下未启用。不过,Google Chrome并不是唯一支持Linux硬件加速的基于Chromium的网络浏览器。本文解释了如何在运行在Debian,Ubuntu,Pop!或Linux Mint(仅限Xorg)上的Google Chrome,Brave,Vivaldi和Opera网络浏览器中启用硬件加速视频解码_OS。
在 Web 浏览器中使用硬件加速视频解码应该可以在播放在线视频时使用更少的 CPU 使用率(从而减少电池消耗)。
值得注意的是,Chromium Web浏览器的补丁允许在Linux上提供硬件加速视频解码一段时间,并且一些Linux发行版使用这些补丁打包了它。因此,Chromium用户在Linux上进行硬件加速已经有一段时间了,这取决于他们的Linux发行版,或者他们是否以其他方式安装了修补的Chromium。例如,在Ubuntu / Linux Mint上,有一个带有VA-API补丁Chromium构建的PPA。因此,这些说明也可能适用于 Chromium 浏览器,具体取决于它的构建方式。
我还想补充一点,这些启用硬件加速视频解码的说明也适用于其他 Linux 发行版,而不仅仅是基于 Debian / Ubuntu 的 Linux 发行版,但是驱动程序名称不同。
我使用带有 Nvidia 显卡的 Ubuntu 20.10 桌面测试了这些说明,下面列出的 Web 浏览器使用其原始 Ubuntu 包装(使用 DEB 包)安装。还在 Ubuntu 10.20 和 04.20 上使用带有英特尔显卡(第 10 代)的笔记本电脑进行了测试。我没有配备AMD显卡的设备来测试这一点。
在我的测试中,我能够使用以下方法让硬件加速的视频解码在 Linux 上工作:
谷歌浏览器稳定 88
勇敢的稳定 1.19
维瓦尔第快照 3.6 / [编辑] 最新的维瓦尔第稳定版 3.6 也可以工作
歌剧测试版 74
显然,它应该继续使用比这些更新的版本(因此Google Chrome 89,Brave 1.20等)。
对我来说,硬件加速视频解码无法使用:
维瓦尔第稳定3.5。Vivaldi 稳定版现在是版本 36,并且确实具有有效的硬件加速视频解码功能
歌剧马厩 73
Microsoft Edge - 甚至没有 chrome://flags/#enable-accelerated-video-decode 标志(用于启用硬件加速视频解码)。
你可以在XWayland上使用VA-API,使用–use-gl=egl命令行标志,但我没有尝试过。从Google Chrome 91(以及其他基于Chromium 91的浏览器)开始,您还需要附加–enable-features=VaapiVideoDecoder和–disable-features=UseChromeOSDirectVideoDecoder标志。
[[编辑]]我尝试使用以下说明,然后在Wayland,在具有英特尔显卡的笔记本电脑上启动浏览器–use-gl=egl和–disable-features=UseChromeOSDirectVideoDecoder标志,硬件加速视频播放工作。但是,使用这些设置,视频在这台笔记本电脑上卡顿不休。所以在这种情况下,我更喜欢具有硬件加速视频播放功能的 Firefox(在同一台笔记本电脑上使用 Wayland 和 Firefox,视频播放是流畅的,但 CPU 使用率高于使用基于 Chromium 的浏览器)。
在我上面提到的网络浏览器中启用硬件加速视频解码所需的东西(所以谷歌Chrome 88+,Brave 1.19+,Vivaldi 3.6+和Opera 74+):

  1. 启用以下 Web 浏览器标志:
    对于基于 Google Chrome 90 及更早版本的浏览器:
    覆盖软件渲染列表:chrome://flags/#ignore-gpu-blocklist
    硬件加速视频解码:chrome://flags/#enable-accelerated-video-decode
    对于基于 Google Chrome 91 及更高版本的浏览器(不再有硬件加速的视频解码,但我们需要使用新的命令行标志 - 请参阅步骤 4):
    覆盖软件渲染列表:chrome://flags/#ignore-gpu-blocklist
  2. 安装 VA-API 驱动程序以便能够解码媒体(源),以及 libva-drm2 和 libva-x11-2(这两个可能已经安装,但以防万一;我在以后的编辑中添加了这 2 个,因为我注意到没有它们硬件加速就无法工作,一旦我安装了将这两个包作为依赖项的 vainfo,它就会开始工作):
    对于英特尔第 7 代及更早版本的硬件:
    sudo apt install i965-va-driver-shaders libva-drm2 libva-x11-2

对于英特尔第 8+ 代硬件:
sudo apt install intel-media-va-driver-non-free libva-drm2 libva-x11-2

对于 Nouveau 和 AMD 驱动程序(我无法让任何浏览器使用带有 Nouveau 驱动程序的硬件加速,也许你的运气更好):
sudo apt install mesa-va-drivers libva-drm2 libva-x11-2

对于专有的 Nvidia 驱动程序 - 您可以从存储库或使用专有 GPU 驱动程序 PPA 安装它们(例如,在 Ubuntu 上启动“其他驱动程序”对话框并从那里安装它)。 如果您使用的是专有的 Nvidia 驱动程序,您还需要一个打补丁的 vdpau-va-driver ([[edit]] 此补丁不再支持 VP9,即使您的显卡支持它,因此您必须在所有情况下使用 h264ify 扩展 - 见下文)。你可以从这里获得它(你还需要libvdpau1,因为它是vdpau-va-driver的依赖项)用于Debian / Ubuntu / Linux Mint / Pop!_OS等。那里的 Ubuntu 20.04 软件包也适用于 Ubuntu 20.10 及更高版本。如果你想查看这个软件包使用的补丁,下载 .debian.tar.gz 存档(从与上面相同的链接)并查看“补丁”文件夹。如果这些 DEB 在 Debian 上不起作用(我没有尝试过),请使用 vdpau-va-driver (原始.tar.gz |Debian.tar.xz) 和 libvdpau (orig.tar.gz |debian.tar.xz) 下载 .orig.tar.gz 和 .debian.tar.xz 档案,并在您的系统上构建 DEB 软件包。同时安装 libva-drm2 和 libva-x11-2: sudo apt install libva-drm2 libva-x11-2

为什么是英特尔媒体 va-driver 和 i965-va-driver 的非自由版本?从理论上讲,这应该适用于免费版本(?),但在我在配备英特尔 Gen 10 的笔记本电脑上的测试中,硬件加速视频解码仅适用于英特尔媒体 va-驱动程序-非免费驱动程序,而不是英特尔媒体-va-驱动程序(我不确定 i965 驱动程序,但我认为它可能类似)。这里还有其他人,说这让他们工作。
3.不支持VP9硬件视频解码的显卡才需要:安装h264ify浏览器扩展。
如果您的显卡不支持 VP9 硬件视频解码,请安装 h264ify 浏览器扩展(或增强型 h264ify - 一些用户说这对他们有用,而原始扩展程序不起作用;对我来说,情况正好相反)并确保它已启用 VP9。
[[编辑]]Nvidia 用户:上面提到的修补后的 vdpau-va-driver 不再在基于 Chromium 的浏览器中硬件加速 VP9。因此,您必须使用 h264ify 扩展并避免使用 VP9 才能获得硬件加速的视频解码。
如果您仍然没有在 chrome://media-internals 选项卡中看到MojoVideoDecoder(请参阅下面的部分,了解如何检查浏览器是否启用了硬件加速视频解码并实际使用),请尝试在安装此扩展程序后重新启动Web浏览器。我见过需要这样做的情况,有些不需要这样做。
4. 使用 --use-gl=desktop 和标志启动 Web 浏览器以启用 VA-API 硬件加速。[编辑]对于基于 Chromium 91 及更高版本的浏览器,您还需要使用 --enable-features=VaapiVideoDecoder 标志启动它。[[另一个编辑]]现在似乎对于大多数人来说,还需要添加 --disable-features=UseChromeOSDirectVideoDecoder 标志。
为了能够使用VA-API进行视频解码,您需要使用以下命令行标志启动Web浏览器,无论是Chromium,Google Chrome,Brave,Opera还是Vivaldi:–use-gl=desktop,–enable-features=VaapiVideoDecoder和–disable-features=UseChromeOSDirectVideoDecoder。
例如,使用以下标志启动谷歌浏览器:
google-chrome-stable --use-gl=desktop --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder
使用以下命令启动勇敢:
brave-browser --use-gl=desktop --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder
等等。
要使此更改永久化,请将浏览器 .desktop 文件从 /usr/share/applications 复制到 /.local/share/applications(如果此文件夹不存在,请创建它)。通过在此处复制文件,我们确保它不会被更新覆盖。然后,使用文本编辑器从这个/.local/share/applications位置打开.desktop文件(例如brave-browser.desktop,brave-browser-beta.desktop,google-chrome.desktop等)。 在此文件中,搜索以 Exec= 开头的行,并将可执行文件更改为包含 --use-gl=desktop --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder。例如,对于 Brave:Exec=/usr/bin/brave-browser-stable --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder,或者对于 Google Chrome:Exec=/usr/bin/google-chrome-stable --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder %U
重要提示:如果您在使用 --use-gl=desktop 启动浏览器时看到完全白色的视频图像,请检查 chrome://flags 并确保那里未启用 Vulkan。启用 Vulkan 并使用 --use-gl=desktop 选项启动浏览器将导致这种情况发生。
另一个注意事项,这次是针对 Opera 用户:如果在使用 h264ify 扩展后,您无法再在 YouTube 和其他此类网站上播放视频,请参阅此处的解决方案以在 Opera 中启用 h264 支持(请注意,如果您使用的 Web 浏览器是 Opera Beta,则该文件夹必须是 /opera-beta)。
就是这样。

如何检查硬件加速视频解码是否已启用并在任何基于 Chromium 的网络浏览器中工作

现在让我们检查一下 Web 浏览器是否正在使用硬件加速视频解码。
首先,让我们检查浏览器是否支持硬件加速视频。通过打开新选项卡并访问 chrome://gpu 来执行此操作。在此页面上,您应该看到“视频解码:硬件加速”(绿色,如下所示):

这意味着您的 Web 浏览器现在支持硬件加速视频解码。但它真的能够对视频进行硬件解码吗?让我们也检查一下,通过打开YouTube视频,然后按Ctrl + Shift + i打开Chrome DevTools。从 3 个垂直点菜单中,单击更多工具 ->媒体。然后单击 DevTools 左侧面板中的视频标题(播放器部分),然后查看 Chrome DevTools 中“媒体”选项卡的“视频解码器”部分:

如果它说解码器名称是VideoDecode Accelerator,或者,我也看到它是VDAVideoDecoder(以前是MojoVideoDecoder,在此之前它是GpuVideoDecoder,所以如果你得到其中任何一个并且你使用的是较旧的浏览器版本,没关系,你有硬件加速),硬件解码器是真的 ,则您使用的是硬件加速视频解码。如果显示 FFmpegVideoDecoder、VpxVideoDecoder 或 Dav1dVideoDecoder(在这种情况下,硬件解码器应显示 false),则您的 Web 浏览器未使用硬件加速视频解码。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
世界上最快的VP9视频解码器 As before , I was very excited when Google released VP9 – for one, because I was one of the people involved in creating it back when I worked for Google (I no longer do). How good is it, and how much better can it be? To evaluate that question, Clément Bœsch and I set out to write a VP9 decoder from scratch for FFmpeg. The goals never changed from the original ffvp8 situation (community-developed, fast, free from the beginning). We also wanted to answer new questions: how does a well-written decoder compare, speed-wise, with a well-written decoder for other codecs? TLDR (see rest of post for details): as a codec, VP9 is quite impressive – it beats x264 in many cases. However, the encoder is slow, very slow. At higher speed settings, the quality gain melts away. This seems to be similar to what people report about HEVC (using e.g. x265 as an encoder). single-threaded decoding speed of libvpx isn’t great. FFvp9 beats it by 25-50% on a variety of machines. FFvp9 is somewhat slower than ffvp8, and somewhat faster than ffh264 decoding speed (for files encoded to matching SSIM scores). Multi-threading performance in libvpx is deplorable, it gains virtually nothing from its loopfilter-mt algorithm. FFvp9 multi-threading gains nearly as much as ffh264/ffvp8 multithreading, but there’s a cap (material-, settings- and resolution-dependent, we found it to be around 3 threads in one of our clips although it’s typically higher) after which further threads don’t cause any more gain. The codec itself To start, we did some tests on the encoder itself. The direct goal here was to identify bitrates at which encodings would give matching SSIM-scores so we could do same-quality decoder performance measurements. However, as such, it also allows us to compare encoder performance in itself. We used settings very close to recommended settings forVP8,VP9andx264, optimized for SSIM as a metric. As source clips, we chose Sintel (1920×1080 CGI content, source ), a 2-minute clip from Tears of Steel (1920×800 cinematic content, source ), and a 3-minute clip from Enter the Void (1920×818 high-grain/noise content,screenshot). For each, we encoded at various bitrates and plotted effective bitrate versus SSIM . sintel_ssimtos_ssimetv_ssim You’ll notice that in most cases, VP9 can indeed beat x264, but, there’s some big caveats: VP9 encoding (using libvpx) is horrendously slow – like, 50x slower than VP8/x264 encoding. This means that encoding a 3-minute 1080p clip takes several days on a high-end machine. Higher –cpu-used=X parameters make the quality gains melt away. libvpx’ VP9 encodes miss the target bitrates by a long shot (100% off) for the ETV clip, possibly because of our use of –aq-mode=1. libvpx tends to slowly crumble at higher bitrates for hard content – again, look at the ETV clip, where x264 shows some serious mature killer instinct at the high bitrate end of things. Overall, these results are promising, although the lack-of-speed is a serious issue. Decoder performance For decoding performance measurements, we chose (Sintel)500 (VP9), 1200 (VP8) and 700 (x264) kbps (SSIM=19.8); Tears of Steel4.0 (VP9), 7.9 (VP8) and 6.3 (x264) mbps (SSIM=19.2); and Enter the Void 9.7 (VP9), 16.6 (VP8) and 10.7 (x264) mbps (SSIM=16.2). We used FFmpeg to decode each of these files, either using the built-in decoder (to compare between codecs), or using libvpx-vp9 (to compare ffvp9 versus libvpx). Decoding time was measured in seconds using “time ffmpeg -threads 1 [-c:v libvpx-vp9] -i $file -f null -v 0 -nostats – 2>&1 | grep user”, with this FFmpeg and this libvpx revision (downloaded on Feb 20th, 2014). sintel_archs tos_archsetv_archs A few notes on ffvp9 vs. libvpx-vp9 performance: ffvp9 beats libvpx consistently by 25-50%. In practice, this means that typical middle- to high-end hardware will be able to playback 4K content using ffvp9, but not using libvpx. Low-end hardware will struggle to playback even 720p content using libvpx (but do so fine using ffvp9). on Haswell, the difference is significantly smaller than on sandybridge, likely because libvpx has some AVX2 optimizations (e.g. for MC and loop filtering), whereas ffvp9 doesn’t have that yet; this means this difference might grow over time as ffvp9 gets AVX2 optimizations also. on the Atom, the differences are significantly smaller than on other systems; the reason for this is likely that we haven’t done any significant work on Atom-performance yet. Atom has unusually large latencies between GPRs and XMM registers, which means you need to take special care in ordering your instructions to prevent unnecessary halts – we haven’t done anything in that area yet (for ffvp9). Some users may find that ffvp9 is a lot slower than advertised on 32bit; this is correct, most of our SIMD only works on 64bit machines. If you have 32bit software, port it to 64bit. Can’t port it? Ditch it. Nobody owns 32bit x86 hardware anymore these days. So how does VP9 decoding performance compare to that of other codecs? There’s basically two ways to measure this: same-bitrate (e.g. a 500kbps VP8 file vs. a 500kbps VP9 file, where the VP9 file likely looks much better), or same-quality (e.g. a VP8 file with SSIM=19.2 vs. a VP9 file with SSIM=19.2, where the VP9 file likely has a much lower bitrate). We did same-quality measurements, and found: ffvp9 tends to beat ffh264 by a tiny bit (10%), except on Atom (which is likely because ffh264 has received more Atom-specific attention than ffvp9). ffvp9 tends to be quite a bit slower than ffvp8 (15%), although the massive bitrate differences in Enter the Void actually makes it win for that clip (by about 15%, except on Atom). Given that Google promised VP9 would be no more than 40% more complex than VP8, it seems they kept that promise. we did some same-bitrate comparisons, and found that x264 and ffvp9 are essentially identical in that scenario (with x264 having slightly lower SSIM scores); vp8 tends to be about 50% faster, but looks significantly worse. Multithreading One of the killer-features in FFmpeg is frame-level multithreading, which allows multiple cores to decode different video frames in parallel. Libvpx also supports multithreading. So which is better?
todesk是一种开源操作系统,基于DebianUbuntuMint,它有自己独特的安装包以及相应的安装手册。 安装todesk之前,首先需要下载安装包。可以通过在官方网站或镜像站点上下载最新版本的安装包。下载完后,可以进行下一步操作。 对于Debian用户,可以使用命令行工具或图形化安装程序来安装todesk。首先,将下载的安装包解压缩到任何目录。然后,使用命令行进入解压缩后的目录,并运行安装命令。根据安装手册的指导,用户需要提供一些必要的信息,如语言、时区等。安装程序将自动完成各种操作,包括磁盘分区、软件包的安装等。完成安装后,用户可以重启计算机并选择todesk作为默认操作系统。 对于Ubuntu用户,安装todesk与Debian类似。可以通过命令行或图形化安装程序来完成安装过程。同样,解压缩安装包后,进入解压缩后的目录,并运行安装命令。根据安装手册的指导提供必要的信息,并完成安装。最后,重新启动计算机,选择todesk作为默认操作系统即可。 对于Mint用户,安装todesk步骤与上述两种操作系统类似。下载安装包后,解压缩到指定目录,并打开终端。通过命令行进入解压缩后的目录,并按照安装手册的指导进行操作。提供必要的信息,等待安装完成后重新启动计算机。 总之,todesk的安装包附带了相应的安装手册,用户可以根据手册的指导进行安装。虽然DebianUbuntuMint的安装步骤略有不同,但基本的原理是相似的。通过按照手册的步骤进行操作,用户可以顺利地在各种操作系统上安装todesk。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李树林gis

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值