mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-04 06:55:09 +00:00
feat(drm)!: load DRM systems beyond the built-ins from plugins in directories.plugins
This commit is contained in:
@@ -41,8 +41,9 @@ then decrypts the file with those keys.
|
||||
|
||||
## Supported DRM systems
|
||||
|
||||
unshackle implements seven DRM systems. Only the first two need a device file and a
|
||||
license-server handshake. The rest are special cases.
|
||||
unshackle has five DRM systems built in. Only the first two need a device file and a
|
||||
license-server handshake. The rest are special cases. A DRM plugin adds another system (see
|
||||
[DRM plugins](#drm-plugins)).
|
||||
|
||||
| System | Device file | License flow | Decryption |
|
||||
|--------|-------------|--------------|------------|
|
||||
@@ -50,8 +51,6 @@ license-server handshake. The rest are special cases.
|
||||
| **PlayReady** (Microsoft) | `.prd` | CDM challenge (WRM header) → license server → CDM parses → keys | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (CENC)**, W3C EME `org.w3.clearkey` or the W3C common PSSH | none | JSON `{"kids":[...],"type":"temporary"}` → license server returns a JWK Set. No CDM. | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (HLS)**, AES-128 `EXT-X-KEY` | none | Key fetched directly from a URI or `data:` URL. No CDM, no challenge. | in-process AES-CBC |
|
||||
| **MonaLisa** (proprietary, WASM) | `.mld` | Ticket from the service API; keys extracted locally via WASM. No license server. Over `--remote` the server extracts the content key and sends it to the client, only when the remote session uses the server CDM. | The tool that the service names, else `bbtsdecrypt` per segment, else the built-in decrypter per segment, which needs no tool. Over `--remote` the client decrypts with its own tool or the built-in decrypter. An export holds the KID and the content key, and an import decrypts like a `--remote` client. After the merge FFmpeg decode-checks the video track; a content key that does not decode stops the track. |
|
||||
| **Blowfish stripe** | none | The service gives the per-track key. No CDM, no license server. | in-process Blowfish-CBC on every third 2048-byte chunk |
|
||||
| **ClearKey (CTR)**, AES-128-CTR | none | The service gives the per-track key and IV. No CDM, no license server. | in-process AES-CTR over the whole file |
|
||||
|
||||
!!! warning "Three different ClearKeys"
|
||||
@@ -602,6 +601,39 @@ unshackle dl --skip-dl --all-drm --export EXAMPLE 81234567
|
||||
shows a warning and ignores the flag.
|
||||
- A remote CDM that stores content keys can answer without a challenge to the service.
|
||||
|
||||
## DRM plugins
|
||||
|
||||
A DRM system that is not built in comes from a plugin. A plugin is a zip file or a folder that holds
|
||||
one Python package. Put it in [`directories.plugins`](../reference/configuration/directories.md).
|
||||
unshackle loads the plugins once per process, at the first DRM lookup, and never from a peer or a URL.
|
||||
Restart `unshackle serve` after you add or replace a plugin. A plugin that
|
||||
does not load gives one warning that names its file. A track that needs a plugin that is not loaded
|
||||
stops with `No DRM plugin '<id>' is installed`.
|
||||
|
||||
A plugin sets the facts of its system: its id, its label, how it gets the content key, and how it
|
||||
decrypts. The service gives the content key of a plugin that holds its key. A plugin device licenses
|
||||
a plugin that licenses locally. A plugin decrypts each segment and then the merged file, or the
|
||||
merged file once. The README of each plugin gives its device files, its tools and its limits.
|
||||
|
||||
- **Devices:** a plugin device file is `<name><suffix>`, with the suffix that the plugin sets. A plugin
|
||||
can carry its own device files and name a default device. unshackle looks for a device in
|
||||
`directories.wvds`, then in `directories.prds`, then in the device files of the plugin, so your own
|
||||
file comes first. A service that needs a plugin device gets the default device of the plugin when
|
||||
its [`cdm`](#selecting-which-device-to-use-the-cdm-config) entry names no device of that system.
|
||||
To use another device, name it under the plugin id in the `cdm` mapping, as you name a device
|
||||
under `widevine`.
|
||||
- **`--remote`:** the server and each client must load the same plugin. The server sends the plugin
|
||||
id, the KIDs, the label and the data that the plugin lets a peer carry; never a content key or a
|
||||
path. A client without the plugin stops the title with `Unknown DRM type '<id>' from the server`.
|
||||
The server sends the content key of a plugin DRM that licenses locally
|
||||
only in a remote session that uses the server CDM. The server loads the plugin device, so a client
|
||||
needs no device.
|
||||
- **Export:** an export writes a plugin DRM under the plugin id, with the same fields as `--remote`.
|
||||
An import without the plugin stops with `Unknown DRM system '<id>' in the export`.
|
||||
- **Decode check:** FFmpeg checks the content key of a plugin DRM that licenses locally after the
|
||||
merge, as for a vault key. A content key that does not decode stops the track (see
|
||||
[Vaults](vaults.md#wrong-keys-from-a-poisoned-vault)).
|
||||
|
||||
## Keys, vaults, and caching
|
||||
|
||||
Fetching a license is comparatively slow and, for some services, rate-limited.
|
||||
|
||||
Reference in New Issue
Block a user