A guide that teach you build a custom version of Chrome / Electron on macOS / Windows / Linux that supports hardware / software HEVC decoding.

enable-chromium-hevc-hardware-decoding

A guide that teach you build a custom version of Chrome / Electron on macOS / Windows / Linux that supports hardware / software HEVC decoding.

English | 简体中文

Get release build?

Click to download

What's the hardware supported HEVC profile?

HEVC Main (Up to 8192x8192 pixels)

HEVC Main 10 (Up to 8192x8192 pixels)

HEVC Main Still Picture (macOS only, Up to 8192x8192 pixels)

HEVC Rext (macOS only, Up to 8192x8192 pixels)

What's the OS requirement?

macOS Big Sur (11.0) and above

Windows 8 and above

Linux + Vaapi (Not tested)

What's the GPU requirement?

Independent GPU

NVIDIA GTX950 and above

AMD RX460 and above

Integrated GPU

Intel HD4400, HD515 and above

AMD Radeon R7, Vega M and above

Apple M1, M1 Pro, M1 Max, M1 Ultra and above

Detail Table

Intel

AMD

NVIDIA

HDR Supports? (Compared with Edge / Safari)

PQ (SDR Screen) PQ (HDR Screen) HLG (SDR Screen) HLG (HDR Screen)
Chromium macOS (EDR) (EDR)
Chromium Windows
Chromium Linux Not Tested Not Tested Not Tested Not Tested
Edge Windows
Safari macOS (EDR) (EDR)

What's the tech diff? (Compared with Edge / Safari)

Windows

Edge uses VDAVideoDecoder to call MediaFoundation (need to install HEVC Video Extension) to finish the HEVC HW decoding which is the same tech behind Movies and TV builtin system app.

Chromium uses D3D11VideoDecoder to call D3D11VA (no need to install anything) to finish the HEVC HW decoding which is the same tech behind video players like VLC.

macOS

Safari and Chromium use the same VideoToolbox to finish the HEVC HW decoding.

How to verify HEVC hardware support is enabled?

  1. Open chrome://gpu, and search Video Acceleration Information, you should see Decode hevc main field and Decode hevc main 10 field (macOS will show Decode hevc main still-picture and Decode hevc range extensions as well) present if hardware decoding is supported (macOS is an exception here, you see this field doesn't means the decode will use hardware, it actually depends on your GPU).
  2. Open chrome://media-internals and play some HEVC video (Test Page) if the decoder is VDAVideoDecoder or D3D11VideoDecoder or VaapiVideoDecoder that means the video is using hardware decoding (macOS is an exception here, if the OS >= Big Sur, and the GPU doesn't support HEVC, VideoToolbox will fallback to software decode which has a better performance compared with FFMPEG, the decoder is VDAVideoDecoder in this case indeed), and if the decoder is FFMpegVideoDecoder that means the video is using software decoding.
  3. Open Activity Monitor on Mac and search VTDecoderXPCService, if the cpu usage larger than 0 when playing video, that means hardware (or software) decoding is being used.
  4. Open Windows Task Manager on Windows and switch to Performance - GPU, if Video Decoding usage larger than 0 when playing video, that means hardware decoding is being used.

Why my GPU support HEVC, but still not able to hardware decode?

OS version is too low

Windows

Please make sure you are using Windows 8 and above, this is because the D3D11VideoDecoder doesn't support Windows 7, and will use VDAVideoDecoder to hardware decoding. while VDAVideoDecoder based on Media Foundation , and Media Foundation start to support HEVC since Windows 10 1709 (which need you to install the HEVC Video Extension).

macOS

Please make sure you are using macOS Big Sur and above, this is because CMVideoFormatDescriptionCreateFromHEVCParameterSets API has compatibility issue on lower macOS.

GPU driver has bug

Some GPU driver may has bug which will cause D3D11VideoDecoder forbidden to use. in this case, you need to upgrade your GPU driver and try again. See reference

GPU hardware has bug

Some GPU hardware may has bug which will cause D3D11VideoDecoder forbidden to use. in this case, we can't do anything else but to use the FFMPEG software decode. See reference

Will HEVC decoding be enabled in Chrome by default in the future?

Chrome 104 will integrate HEVC hw support for ChromeOS, Mac and Windows, disabled by default, and you can enable it by passing --enable-features=PlatformHEVCDecoderSupport when opening. it should be enabled by default in the future version when stable. (only platform decoder that provided by the OS will be supported in chrome, thus this will be optional depends on the GPU and OS support)

How to Build?

  1. Follow the official build doc to prepare the build environment then fetch the source code from main branch (HEVC HW codes has been merged).
  2. (Optional) To enable HEVC software decoding: switch to src/third_party/ffmpeg dir, then execute git am /path/to/add-hevc-ffmpeg-decoder-parser.patch.
  3. (Optional) To enable other HEVC profiles (non main / main 10 profiles): switch to src dir, then execute git am /path/to/remove-main-main10-profile-limit.patch.
  4. (Optional) To default enable hardware decode: switch to src dir, then execute git am /path/to/enable-hevc-hardware-decoding-by-default.patch.
  5. (Optional) To integrate Widevine CDM to support EME API (like Netflix): switch to src dir, then execute cp -R /path/to/widevine/* third_party/widevine/cdm (Windows: xcopy /path/to/widevine third_party\widevine\cdm /E/H).
  6. If you are using Mac + want to build x64 arch (target_cpu to x86 , arm64 , arm also available) + want to add CDM support, then run gn gen out/Release64 --args="is_component_build = false is_official_build = true is_debug = false ffmpeg_branding = \"Chrome\" target_cpu = \"x64\" proprietary_codecs = true media_use_ffmpeg = true enable_widevine = true bundle_widevine_cdm = true enable_platform_hevc = true enable_hevc_parser_and_hw_decoder = true", if you are using Windows, you need to add enable_media_foundation_widevine_cdm = true as well, if you are using Windows and want to build arm64 arch, then need to change bundle_widevine_cdm to false, an if you are using Linux and don't want to build x64, then need to change enable_widevine to false, bundle_widevine_cdm to false.
  7. Run autoninja -C out/Release64 chrome to start the build.
  8. Run ./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-features=PlatformHEVCDecoderSupport to open chromium if you are using macOS.
  9. Create a desktop shortcut and passing the args like C:\Users\Admin\Desktop\Chromium\chrome.exe --enable-features=PlatformHEVCDecoderSupport then double click the desktop shortcut to open chromium if you are using Windows.

How to integrate this into Chromium based project like Electron?

If Electron = 20 (Chromium 104), then the HEVC hw decoding feature for Mac and Windows should have already been integrated, and you can use app.commandLine.appendSwitch('enable-features', 'PlatformHEVCDecoderSupport') to enable HEVC hw decoding. to add HEVC ffmpeg sw decoding, the method should be the same with Chromium guide above.

If Electron < 20, please follow the CL in Trace Crbug to manually integrate HEVC features, pull request of the patch code wecome.

Change Log

2022-05-25 Update Chrome 104 support status, and Electron 20 enable method

2022-05-24 Update Patch to 104.0.5080.1

2022-05-23 Add CDM compile guide, and update Patch to 104.0.5077.1

2022-05-17 Update detail of tech implement and guide to integrate into electron

2022-05-14 Update Patch to 104.0.5061.1

2022-05-13 Add HEVC Test page

2022-05-10 Update README, add more special detail of the hardware support and GPU models

2022-05-05 Add support for MSP & Rext on macOS, and fix the issue that some HDR & Rec.709 Main10 video can't be hw decoded on Windows

2022-04-27 Replace to git am patch

2022-04-24 Support chinese README

2022-04-21 Add Crbug trace

2022-04-20 Modify README

2022-04-19 Initial commit

Trace Crbug

Windows
macOS

License

MIT

Comments
  • 无法播放hevc mkv

    无法播放hevc mkv

    感谢

    浏览器支持HEVC是一个划时代的进步。感谢!

    代码

    <body bgcolor=#000000>
    <p align=center>
    <video controls="controls" autoplay>
    <source src="TearsOfSteel_720p_h265.mkv" type="video/mp4">
    </video>
    </p>
    </body>
    

    现象

    黑屏。换H.264的mkv文件,可以正常播放。

    平台

    1. Win11最新版
    2. Chrome最新版

    问题

    1. 现在用--enable-features=PlatformHEVCDecoderSupport能不能播放hevc mkv?
    2. 如果不能,那么什么时候能?
  • Linux 所有 hevc 视频无法硬解

    Linux 所有 hevc 视频无法硬解

    测试页的视频都可以软解播放,但是 CPU 占用很高,decoder 占用始终为 0。 测试过使用如下参数:--use-gl=desktop --enable-features=VaapiVideoDecoder --disable-features=UseChromeOSDirectVideoDecoder 加和不加都不能硬解。 显卡:NVIDIA 1660s 系统:Arch Linux 最新 kernel 5.17.7 驱动:nvidia 510.68.02-3 libva-vdpau-driver-vp9-git r57.509d3b2-4

  • Support HEVC with Alpha

    Support HEVC with Alpha

    一直以来,H.264 不具备 Alpha 通道的能力,在网页中有很多场景需要半透明的视频,例如:类似于剪映的视频剪辑工具。

    过去,我们只能选择 VP8/VP9 编码,但由于其兼容性不佳,极大的制约了 Alpha 视频的应用。

    我测试了最新的 Chrome canary(Mac),似乎还不支持带有 Alpha 通道 HEVC 视频,Safari 中可以播放:

    <video autoplay controls src="https://rotato.netlify.app/alpha-demo/movie-hevc.mov"></video>
    
    data:text/html;charset=UTF-8,<body style="background: pink;"><video autoplay controls src="https://rotato.netlify.app/alpha-demo/movie-hevc.mov"></video>
    
  • intel 核显 Iris Xe 在 Canary 107  中无法正确回放 HDR 内容

    intel 核显 Iris Xe 在 Canary 107 中无法正确回放 HDR 内容

    使用 Chrome 的时候偶然遇到播放HEVC HDR内容时,浏览器窗口闪烁的问题,由于我对 Chrome 和 Chromium 当前的开发情况不是很熟悉,遂来此向作者询问相关问题。

    本 issue 针对 Chrome Beta/Dev/Canary 及 Chromium latest build ,本仓库 Release latest 共五个版本进行测试。


    测试1

    版本:版本 107.0.5286.2(正式版本)dev (64 位)

    启动参数:无

    Video Acceleration Information: 无HEVC支持 image

    实际测试:

    • 测试页无法正确播放,表现为仅音频模式
    • bilibili强制使用HEVC,回报使用DashPlayer + WasmPlayer

    启动参数:--enable-features=PlatformHEVCDecoderSupport

    Video Acceleration Information: HEVC硬解正确支持 image

    实际测试:

    • 测试页部分正确播放,HDR内容(HLG,PQ)表现为整个浏览器窗口闪烁,视频窗口闪过紫色后变黑。
    • bilibili强制使用HEVC,回报使用DashPlayer + WasmPlayer

    测试2

    版本:版本 107.0.5293.0(正式版本)canary (64 位)

    有无启动参数表现均与测试一相同

    测试3

    版本:版本 107.0.5294.0(开发者内部版本) (64 位)

    启动参数:无

    Video Acceleration Information: 无HEVC支持 image

    实际测试:

    • 测试页无法正确播放,也不可仅播放音频 image
    • bilibil无法加载播放器?

    启动参数:--enable-features=PlatformHEVCDecoderSupport

    Video Acceleration Information: 无HEVC支持 image

    实际测试同无启动参数

    测试4

    版本:版本 106.0.5211.0(正式版本) (64 位) 本仓库 release 的 最新版

    启动参数:无

    Video Acceleration Information: HEVC硬解正确支持 image

    实际测试:

    • 测试页部分正确播放,HDR内容(HLG,PQ)表现为整个浏览器窗口闪烁,视频窗口闪过紫色后变黑。
    • bilibili强制使用HEVC,回报使用DashPlayer,任务管理器回报 Video Decode 不为 0, Video Decode 1 为0

    启动参数:--enable-features=PlatformHEVCDecoderSupport

    Video Acceleration Information: HEVC硬解正确支持 image

    实际测试:

    • 测试页部分正确播放,HDR内容(HLG,PQ)表现为整个浏览器窗口闪烁,视频窗口闪过紫色后变黑。
    • bilibili强制使用HEVC,回报使用DashPlayer,任务管理器回报 Video Decode 为 0,Video Decode 1 不为0

    由于我正在使用 Chrome Beta 编写此 issue,故该通道的表现将在稍后补充。目前来看 Chrome Beta 的表现与测试4的表现较为一致

    另外我留意到了这个提交 https://chromium-review.googlesource.com/c/chromium/src/+/3833477 想询问一下这项提交是否与HEVC硬解支持相关


    系统基础信息:

    Windows 11 Professional Insider Preview 
    Build 25197.rs_prerelease.220902-1559
    

    CPU&GPU:

    12th Gen Intel(R) Core(TM) i5-12500H (16 CPUs)
    Intel(R) Iris(R) Xe Graphics (驱动程序版本:30.0.101.1368)
    Monitor Capabilities: HDR Supported (BT2020RGB Eotf2084Supported )
    
  • Chrome 107是否会默认开启Webcodecs的hevc支持

    Chrome 107是否会默认开启Webcodecs的hevc支持

    背景: 目前公司用的http-flv,看到Chrome Canary终于支持hevc,所以想撸一个基于Webcodecs转码的flv播放器。

    困境: 但目前Chrome的Video Element硬解是需要改启动参数,对终端用户实在不是很友好。

    1. 请问下Chrome 107是否会默认开启Webcodecs的hevc支持
    2. Video Element的硬解的默认支持是否有计划

    以上,十分感谢!

  • HEVC hardware decode support not surfaced for WebRTC media streams?

    HEVC hardware decode support not surfaced for WebRTC media streams?

    Running Chrome Canary 105 with the --enable-feature=PlatformHEVCDecoderSupport commandline parameter, I still don't see the HEVC decode capability being announced by WebRTC: image

    Is the HEVC decode support limited to MSE APIs, or will it make it into WebRTC media streams as well?

    Thanks!

  • win11 更新到版本 107.0.5303.0(正式版本)canary (64 位),chrome://gpu/页面没有hevc支持

    win11 更新到版本 107.0.5303.0(正式版本)canary (64 位),chrome://gpu/页面没有hevc支持

    看到readme里面说107.0.5300.0 后会默认支持hevc不用加enable参数,下载了个canary试了一下,发现chrome://gpu/里面没有默认支持hevc,实测也是不支持,同一台设备之前104版本加上enable后,chrome://gpu/可以看到hevc,并且实测也是支持的

  • 在 Android 平台上不支持hevc硬解

    在 Android 平台上不支持hevc硬解

    如题,设备 小米 10 ultra,安卓12,Soc支持硬解hevc 8k60 HDR 之前使用 chrome 104 的时候尝试过参数启动,但是无论怎么折腾都没有hevc支持。 现在使用默认启用hevc的chrome canary 107.0.5302.0,打开 chrome://gpu 仍然没有hevc硬解支持,hevc视频也无法播放

  • Rebase

    Rebase

    @StaZhu Hi its alex again. Can you rebase your patches for the latest ffmpeg. They did a commit here that made it where the patches wont work anymore because they are off by like a line. > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/0564e9eec5a741b52804f06c56446cfee582f5cb

Teach you how to code an OS by yourself.
Teach you how to code an OS by yourself.

前言 操作系统,作为人类当前创造出来的最复杂的系统,其蕴含了大量精巧的设计。完全理解操作系统,应该是每一个程序员都想做的事情,但是每当我们想要去学习操作系统,了解其奥秘时,都会被里面 晦涩难懂的设计和一些闻所未闻的名词劝退。即使没有被劝退,非常痛苦的看完一本晦涩难懂的操作系统的书籍后,也会发现自己好

Jul 11, 2022
A desktop (supports macOS and Windows) implementation of uni_links plugin.

uni_links_desktop A desktop (supports macOS and Windows) implementation of uni_links plugin. uni_links_desktop Platform Support Quick Start Installati

Sep 16, 2022
hotcaKey is the global shortcut (aka hotkey) module for node.js and electron.

?? hotcaKey is the global shortcut (aka hotkey) module for node.js and electron. hotcakey is now actively under deploment, so api may have

Jun 20, 2022
Draw a triangle inside Electron's window using DirectX 11, mixing web and native content.
Draw a triangle inside Electron's window using DirectX 11, mixing web and native content.

Draw a triangle inside Electron's window using DirectX 11, mixing web and native content. Limitations The native content is rendered over a child wind

Jul 12, 2022
BOF implementation of chlonium tool to dump Chrome/Edge Masterkey

ChromiumKeyDump BOF implementation of Chlonium tool to dump Chrome/Edge Masterkey. Forked from https://github.com/crypt0p3g/bof-collection Setup How t

Feb 12, 2022
A custom macOS statusbar with shell plugin, interaction and graph support
A custom macOS statusbar with shell plugin, interaction and graph support

SketchyBar This is a rewrite of the spacebar project, which itself is a rewrite of the statusbar code from yabai. Features: As many widgets as you lik

Sep 30, 2022
A beginner friendly desktop UI for Tasmota flashed devices for Windows, macOS and Linux.
A beginner friendly desktop UI for Tasmota flashed devices for Windows, macOS and Linux.

TasmoManager A beginner friendly desktop UI for Tasmota flashed devices for Windows, macOS and Linux. Features Native Tasmota device discovery (via ta

Jul 16, 2022
"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

Sep 29, 2022
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Filament Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small a

Oct 3, 2022
Animated sprite editor & pixel art tool (Windows, macOS, Linux)

Aseprite Introduction Aseprite is a program to create animated sprites. Its main features are: Sprites are composed of layers & frames as separated co

Sep 30, 2022
MTEngineSDL is a SDL2+ImGui engine for macOS, Linux and MS Windows.

Hello and welcome to the MTEngineSDL! This is an application host framework for starting custom apps created using SDL2, ImGui and OpenGL. How to comp

Jan 10, 2022
C++ Library Manager for Windows, Linux, and MacOS

Vcpkg: Overview 中文总览 Español 한국어 Français Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constant

Sep 24, 2022
Sega Master System / Game Gear / SG-1000 emulator for iOS, macOS, Raspberry Pi, Windows, Linux, BSD and RetroArch.
Sega Master System / Game Gear / SG-1000 emulator for iOS, macOS, Raspberry Pi, Windows, Linux, BSD and RetroArch.

Gearsystem is a very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator written in C++ that runs on Windows, macOS, Linux, BSD, iOS, Raspberry Pi and RetroArch.

Sep 20, 2022
Feather is a free, open-source Monero wallet for Linux, Tails, macOS and Windows

Feather is a free, open-source Monero wallet for Linux, Tails, macOS and Windows. It is written in C++ with the Qt framework.

Sep 21, 2022
Utility to install kexts, Frameworks and PrivateFrameworks in the System of macOS. For macOS Monterey 12 and Big Sur 11
Utility to install kexts, Frameworks and PrivateFrameworks in the System of macOS. For macOS Monterey 12 and Big Sur 11

Command-Line-SnapShot-Mounter Credit: chris1111 Apple This utility uses the macOS terminal Command Line SnapShot Mounter is an utility that allows you

Sep 21, 2022
Had a tough time playing Microsoft Wordament ? Well WORDament_Solver has your back. It suggests you meaningful words you can use while playing the game and help you top the leaderboard.
Had a tough time playing Microsoft Wordament ? Well WORDament_Solver has your back. It suggests you meaningful words you can use while playing the game and help you top the leaderboard.

WORDament_Solver Had a tough time playing Microsoft Wordament ? Well WORDament_Solver has your back. It suggests you meaningful words you can use whil

Aug 19, 2021
Toolchain and dockerfile to build the Miyoo Custom Firmware (CFW)

Miyoo Toolchain Toolchain and dockerfile to build the Miyoo Custom Firmware (CFW) See https://github.com/TriForceX/MiyooCFW/wiki/Build-Source for more

Aug 5, 2022
A custom distribution of FreeImage, with a CMake-based build system. Used by the Athena Game Framework.

This is a custom distribution of FreeImage, version 3.13.1, with a XMake-based build system. License ------- FreeImage's license is unchanged: this

Apr 6, 2022
Sep 23, 2022