Skip to content

Add hardware decoding support for .webm video files (VP9) using DXVA (relies on WebM pull request) - #125908

Open
Joy-less wants to merge 101 commits into
godotengine:masterfrom
Joy-less:add-webm-hardware-acceleration
Open

Joy-less wants to merge 101 commits into
godotengine:masterfrom
Joy-less:add-webm-hardware-acceleration

Conversation

@Joy-less

@Joy-less Joy-less commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What problem(s) does this PR solve?

Dependencies

This PR is based on #119299 (Add initial experimental support for .webm video files (VP9)).

Which is in turn based on #117921 (Add support for .opus audio files).

Additional information

This pull request adds DXVA (DirectX Video Acceleration) hardware decoding to the WebM pull request. If this pull request is accepted, my suggestion is to add the following:

  • On Windows, use DXVA, because it supports the widest range of hardware (including GPUs like the GTX 1080 Ti, which doesn't support hardware decoding through Vulkan Video because it's out of support).
  • On other desktop/mobile platforms, use Vulkan Video, because it should be similar to DXVA, and it is cross-platform.
  • On the web, use WebCodecs.
  • The only platform which wouldn't be supported is when using the Compatibility renderer without being on the web.

I added a new property to VideoStreamPlayer, called hardware_decoding_mode:

  • Automatic: Chooses either software or hardware decoding based on the video, format, and platform. This is the default value.
  • Software Only: Always uses software decoding. This can be used to check the performance of playing videos on platforms where hardware decoding is not supported. It can also be used if there are issues with hardware decoding.
  • Hardware Only: Always uses hardware decoding. This can be used to check if hardware decoding is available for a given video, and to compare the performance with Software Only.

This property can be updated while the video is playing, causing the video will restart and seek to the original position.

I implemented most of the changes in https://github.com/The-Simplicity-Group/libsimplewebm, which is a third party dependency, rather than in Godot, which means the Godot code can use it with a very similar API to the libvpx API. However, many of the changes haven't been merged yet, so the copy of libsimplewebm in this pull request is essentially a future version.

Images

image image

Results

The numbers fluctuate a lot so it's difficult to get exact numbers, but here are rough estimates based on the Task Manager.

System info

Godot v4.8.dev (9ef472f) - Windows 11 (build 26300) - Multi-window, 1 monitor (1920x1080 @ 60.00 Hz) - Direct3D 12 (Forward+) - dedicated NVIDIA GeForce GTX 1080 (NVIDIA; 32.0.15.8278) - Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz (8 threads) - 15.93 GiB memory - WASAPI (48000 Hz, Stereo/mono)

1080p sample video (Godot 2025 showreel)

Decoder CPU usage GPU usage
Software (libvpx) 20-30% 10-15%
Hardware (DXVA) 10-15% 15-20%

4K sample video (Planet Earth spinning)

Decoder CPU usage GPU usage
Software (libvpx) 45%-55% 10%-15%
Hardware (DXVA) 10-15% 35-40%

AI Disclosure

DXVA is very complicated, so I used AI (ChatGPT and Gemini) to guide me through the APIs, find bugs, explain how DXVA works, and write example code. However, I wrote every line of code by myself, and I also designed the structure of the code to be maintainable. I didn't use AI at all to write this pull request or the documentation.

Joy-less and others added 30 commits October 13, 2026 19:27
Co-Authored-By: Douglas Leão <60024671+DeeJayLSP@users.noreply.github.com>
Co-Authored-By: Douglas Leão <60024671+DeeJayLSP@users.noreply.github.com>
Co-Authored-By: Douglas Leão <60024671+DeeJayLSP@users.noreply.github.com>
Co-authored-by: Kongfa Waroros <gongpha@hotmail.com>
Co-authored-by: Kongfa Waroros <gongpha@hotmail.com>
Co-Authored-By: Kongfa Waroros <13400398+gongpha@users.noreply.github.com>
Co-Authored-By: Kongfa Waroros <13400398+gongpha@users.noreply.github.com>
Co-Authored-By: Kongfa Waroros <13400398+gongpha@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-Authored-By: Ben Lubar <ben.lubar@gmail.com>
Co-Authored-By: D.J.L. Sales <60024671+DeeJayLSP@users.noreply.github.com>
Co-authored-by: D.J.L. Sales <60024671+DeeJayLSP@users.noreply.github.com>
@Joy-less
Joy-less requested review from a team as code owners November 28, 2026 20:22
@Joy-less
Joy-less force-pushed the add-webm-hardware-acceleration branch 2 times, most recently from 472bf08 to 23414e5 Compare November 28, 2026 20:39
@Joy-less
Joy-less force-pushed the add-webm-hardware-acceleration branch from 23414e5 to 7c0aa72 Compare November 28, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant