A guide that teach you build a custom version of Chrome / Electron on macOS / Windows that supports hardware / software HEVC decoding.
English | 简体中文
Click to Download then launch.
Click to Download then passing --enable-features=PlatformHEVCDecoderSupport
and launch (version >= 104.0.5084.0).
Click to Download then passing --enable-features=PlatformHEVCDecoderSupport
and launch (version >= 104.0.1293.0).
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)
macOS Big Sur (11.0) and above
Windows 8 and above
Android (already support, not tested)
ChromeOS (already support, not tested)
Currently supports HTML Video Element, MSE, and Clearkey EME, and not support WebRTC and video encode.
NVIDIA GTX950 and above
AMD RX460 and above
Intel HD4400, HD515 and above
AMD Radeon R7, Vega M and above
Apple M1, M1 Pro, M1 Max, M1 Ultra and above
PQ (SDR Screen) | PQ (HDR Screen) | HLG (SDR Screen) | HLG (HDR Screen) | |
---|---|---|---|---|
Chromium 105 macOS | ✅ (EDR) | ✅ | ✅ (EDR) | ✅ |
Chromium 105 Windows | ✅ | ✅ | ✅ | ✅ |
Edge 102 Windows | ❌ | Partial | Partial | ❌ |
Safari 15.3 macOS | ✅ (EDR) | ✅ | ✅ (EDR) | ✅ |
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
.
Safari and Chromium use the same VideoToolbox
to finish the HEVC HW decoding.
- Open
chrome://gpu
, and searchVideo 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). - Open
chrome://media-internals
and play some HEVC video (Test Page) if the decoder isVDAVideoDecoder
orD3D11VideoDecoder
orVaapiVideoDecoder
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 isVDAVideoDecoder
in this case indeed), and if the decoder isFFMpegVideoDecoder
that means the video is using software decoding. - Open
Activity Monitor
on Mac and searchVTDecoderXPCService
, if the cpu usage larger than 0 when playing video, that means hardware (or software) decoding is being used. - Open
Windows Task Manager
on Windows and switch toPerformance
-GPU
, ifVideo Decoding
usage larger than 0 when playing video, that means hardware decoding is being used.
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
).
Please make sure you are using macOS Big Sur and above, this is because CMVideoFormatDescriptionCreateFromHEVCParameterSets
API has compatibility issue on lower macOS.
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
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
Chrome 104 and above version will integrate HEVC hw support for ChromeOS, Mac, Windows and Android, 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)
- Follow the official build doc to prepare the build environment then fetch the source code from
main
branch (HEVC HW codes has been merged). - (Optional) To enable HEVC software decoding: switch to
src/third_party/ffmpeg
dir, then executegit am /path/to/add-hevc-ffmpeg-decoder-parser.patch
. - (Optional) To enable other HEVC profiles (non main / main 10 profiles): switch to
src
dir, then executegit am /path/to/remove-main-main10-profile-limit.patch
. - (Optional) To default enable hardware decode: switch to
src
dir, then executegit am /path/to/enable-hevc-hardware-decoding-by-default.patch
. - (Optional) To integrate Widevine CDM to support EME API (like Netflix): switch to
src
dir, then executecp -R /path/to/widevine/* third_party/widevine/cdm
(Windows:xcopy /path/to/widevine third_party\widevine\cdm /E/H
). - If you are using
Mac
+ want to buildx64
arch (target_cpu tox86
,arm64
,arm
also available) + want to add CDM support, then rungn 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 usingWindows
, you need to addenable_media_foundation_widevine_cdm = true
as well, if you are usingWindows
and want to buildarm64
arch, then need to changebundle_widevine_cdm
tofalse
. - Run
autoninja -C out/Release64 chrome
to start the build. - Run
./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-features=PlatformHEVCDecoderSupport
to open chromium if you are using macOS. - 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.
If Electron >= v20.0.0-beta.9 (Chromium >= v104.0.5084.0), 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 < v20.0.0-beta.9, please follow the CL in Trace Crbug
to manually integrate HEVC features. Pull request of Patches for different version of Electron are welcome.
2022-07-15
Update Electron v20.0.0-beta.9 and above version support status
2022-06-21
Update Microsoft Edge (Mac) feature test guide
2022-06-18
Fix HLG/PQ tone mapping, and update Patch to 105.0.5127.0
2022-06-17
Remove Linux support, Update Other Platform and HDR support status
2022-05-26
Update Chrome Canary HEVC feature test guide
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
MIT