OpenWV is a free and open-source reimplementation of Google's Widevine Content Decryption Module (CDM), the portion of the Widevine DRM system that runs in your browser, obtains content keys for protected media, and decrypts the media using those keys. OpenWV is a drop-in replacement for Google's official, proprietary CDM and implements the same shared library API.
OpenWV does not come with a device identity and will not work without one.
A device identity, typically stored as a .wvd
file, contains
metadata about a Widevine client as well as a private key that authenticates
that client to Widevine license servers. Depending on the client's identity, a
license server may return low-value content keys (e.g. standard definition
only), high-value keys (e.g. HD/UHD), or no keys at all. If you want to use
OpenWV, you must obtain an appropriate .wvd
file yourself and include it in
the build as described below.
Because CDM libraries are heavily sandboxed by browsers, OpenWV cannot read configuration from disk at runtime. That means that all configuration, including the device identity mentioned above, must be present at build-time. As such, there are no official precompiled binaries: the only way to use OpenWV is to build it yourself.
To build OpenWV, follow these steps:
- Make sure that Git, Rust, and Clang are
installed on your system. (To install Clang on Windows 10/11, run
winget install LLVM.LLVM
.) - Clone this repository:
git clone https://github.com/tchebb/openwv.git
- Enter the newly-cloned
openwv/
directory, then fetch Git submodules:git submodule init && git submodule update
- Place your
.wvd
file in the project root (alongside this README) and name itembedded.wvd
. You may set other configuration options as desired by editing theCONFIG
variable insrc/config.rs
. - Build the library:
cargo build --release
- Find the built library in
target/release/
. Depending on your OS, it will be namedlibwidevinecdm.so
,widevinecdm.dll
, orlibwidevinecdm.dylib
.
NOTE: In these instructions, "the OpenWV library" means the library you built
in the last section—libwidevinecdm.so
on Linux, widevinecdm.dll
on Windows,
or libwidevinecdm.dylib
on macOS.
- Open
about:support
and note your "Profile Directory". - Open
about:config
. Setmedia.gmp-widevinecdm.autoupdate
tofalse
(creating it if needed), and setmedia.gmp-widevinecdm.version
toopenwv
(or to any other name for the directory you create in step 3). - Navigate to
gmp-widevinecdm/
within your profile directory. - Create a subdirectory named
openwv
and place the OpenWV library andmanifest-firefox.json
, renamed tomanifest.json
, inside it. Note that you must use OpenWV'smanifest.json
instead of Google's, as Firefox will not play video if we falsely advertise decoding support.
If you manually check for addon updates, Firefox will replace OpenWV with
Google's CDM. The media.gmp-widevinecdm.autoupdate
setting prevents
automatic updates, but there's no way to prevent manual
updates. If this happens, you need only set media.gmp-widevinecdm.version
back
to openwv
—no need to repeat the other steps.
- Open
chrome://version/
and note the parent directory of your "Profile Path". This is Chrome's "User Data Directory". - Navigate to
WidevineCdm/
within the User Data Directory. - If there are any existing subdirectories, delete them.
- Create a subdirectory named
9999
(or any numeric version greater than that of Google's CDM), and place OpenWV'smanifest-chromium.json
, renamed tomanifest.json
, inside it. - Beside
manifest.json
, create a directory named_platform_specific
with a directory named{linux,win,mac}_{x86,x64,arm,arm64}
, as appropriate, inside it. For example,_platform_specific/linux_x64/
on 64-bit Intel Linux. Place the OpenWV library in this innermost directory. - On Linux only, launch and quit the browser once before playing any Widevine-protected media. OpenWV will not be loaded on the first launch due to an implementation quirk of Chromium.
Kodi (via InputStream Adaptive)
- Build OpenWV with
encrypt_client_id: EncryptClientId::Never
, as Kodi cannot handle service certificate request messages as of this writing (InputStream Adaptive v21.5.10). - In Kodi, navigate to "Add-ons > My add-ons > VideoPlayer InputStream > InputStream Adaptive" and select "Configure".
- Ensure the settings level (the gear icon) is set to at least "Advanced".
- In the "Expert" tab, set "Decrypter path" to the directory where you've put the OpenWV library. Don't include the library name itself.
The APIs, algorithms, and data types used in OpenWV were gathered from a variety of official and unofficial sources:
- API headers (
third-party/cdm/
) come from the Chromium source. - Widevine protobuf definitions (
third-party/widevine_protos.pb
) were extracted fromchromecast_oss/chromium/src/out_chromecast_steak/release/pyproto/
in Google's Chromecast Ultra v1.42 source drop. - The
.wvd
format and many algorithmic details come from the pywidevine project.