Widevine DRM AV1 Video Encryption and Decryption
This article explains the end-to-end technical process of how Google's Widevine Digital Rights Management (DRM) secures elementary AV1 video streams. It outlines the preparation and subsample encryption of AV1 Open Bitstream Units (OBUs) using Common Encryption (CENC) standards, the key exchange via Encrypted Media Extensions (EME), and the final hardware- or software-level decryption within the Content Decryption Module (CDM).
The Structure of Elementary AV1 Streams
An elementary AV1 video stream consists of a sequence of Open Bitstream Units (OBUs). Each OBU contains a header indicating its type and payload data. Key OBU types include:
- Sequence Header OBU: Contains profile, level, bit depth, and color format parameters.
- Frame Header OBU: Contains frame dimensions, render size, and presentation parameters.
- Tile Group OBU / Frame OBU: Carries the actual compressed video sample data (transform coefficients, motion vectors, and intra/inter prediction data).
- Metadata OBU: Contains optional HDR metadata, timing data, or custom user data.
To allow players and decoders to parse stream parameters without needing immediate decryption keys, Widevine relies on subsample encryption. Non-visual metadata—such as Sequence Headers, Frame Headers, and standard OBU headers—remain unencrypted (in the clear). Only the raw compressed pixel payload inside the Tile Group or Frame OBUs is targeted for encryption.
The Encryption Process
Widevine integrates with standard Common Encryption (ISO/IEC 23001-7, or CENC) to protect AV1 content. Content packaging tools (such as Shaka Packager or FFmpeg) follow these steps:
Key Generation and Packaging:
- A 128-bit Content Encryption Key (CEK) and an associated Key ID (KID) are requested from the Widevine Key Management System (KMS).
- A Protection System Specific Header (PSSH) box is generated,
populated with the Widevine System ID
(
edef8ba9-79d6-4ace-a3c8-27dcd51d21ed), the KID, and optional provider metadata.
Subsample Mapping:
- The packager parses the elementary AV1 stream at the OBU boundary.
- It measures the unencrypted bytes (OBU headers, configuration OBUs) and flags them as "clear bytes."
- It locates the tile payload bytes inside the Tile Group OBU and flags them as "protected bytes."
Payload Encryption:
- The packager encrypts the protected bytes using either AES-128 CTR
(
cenc) or AES-128 CBC with 10% pattern protection (cbcs). The AV1 specification under the Alliance for Open Media (AOM) heavily favorscbcs. - Initialization Vectors (IVs) of 8 or 16 bytes are generated for each sample or subsample.
- The encrypted OBUs are reassembled alongside the subsample mapping index and encapsulated into a container format (commonly MP4/ISOBMFF or WebM/Matroska) for distribution via DASH or HLS.
- The packager encrypts the protected bytes using either AES-128 CTR
(
License Exchange via EME
Before the client can decode the stream, the AV1 elementary stream data and DRM metadata must be exchanged with the Widevine license server:
- The media player extracts the PSSH box or
initDataand passes it to the browser via the W3C Encrypted Media Extensions (EME) API. - The browser forwards the initialization data to the Widevine Content Decryption Module (CDM).
- The CDM generates an encrypted License Request (challenge) containing device integrity tokens, client identity, and the requested KID.
- The application sends this challenge to the Widevine License Server, which verifies user entitlements.
- The server responds with an encrypted License Response containing the CEK wrapped with a device-specific key.
The Decryption Process
Once the CDM receives the license response, decryption of the elementary stream takes place:
Key Unwrapping: The CDM un-wraps the CEK. In Widevine Level 1 (L1), the CEK is loaded directly into the device’s Trusted Execution Environment (TEE) or hardware Secure Video Path (SVP). In Level 3 (L3), the key remains in host memory within a software-protected CDM.
Subsample Extraction: The player’s demuxer separates the elementary AV1 OBUs from the transport container and passes the encrypted slices, IVs, and subsample maps to the CDM.
AES Decryption:
- The decryptor parses the subsample map.
- The clear bytes (OBU headers, Sequence Headers) bypass the AES engine directly to the decoder.
- The protected bytes (tile data) pass through the AES-128 engine with the IV and CEK, outputting decrypted AV1 tile payload.
Decoding and Rendering:
- In Widevine L3: The decrypted, complete elementary AV1 stream is reconstructed in system memory and sent to a software or hardware video decoder.
- In Widevine L1: The elementary stream is decrypted strictly inside the protected hardware memory. The hardware AV1 decoder receives the clear stream internally, decodes the frames, and directs the video planes straight to the display processor via the Secure Video Path, preventing the decrypted elementary stream or raw pixel buffers from being read by user-space applications.