2018-12-20 01:48:11 +00:00
|
|
|
pssh-box - Utility to parse and generate PSSH boxes
|
2016-03-24 22:03:18 +00:00
|
|
|
===================================================
|
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
## Prerequisite
|
2016-03-24 22:03:18 +00:00
|
|
|
|
2023-10-17 19:52:40 +00:00
|
|
|
- Python 3.
|
2016-03-24 22:03:18 +00:00
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
## Build the utility using Shaka Packager build setup
|
2016-03-24 22:03:18 +00:00
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
The utility needs to be built before being used, i.e. do not use the script in
|
|
|
|
`packager/tools/pssh/pssh_box.py` directly.
|
2016-03-24 22:03:18 +00:00
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
If you have not set up the build environment for Shaka Packager, see
|
2022-03-07 19:56:34 +00:00
|
|
|
https://github.com/shaka-project/shaka-packager/blob/master/docs/source/build_instructions.md.
|
2018-12-20 01:48:11 +00:00
|
|
|
|
|
|
|
With the build environment set up, use `ninja` to build the utility:
|
|
|
|
|
|
|
|
```bash
|
2023-10-17 19:52:40 +00:00
|
|
|
$ ninja -C build/ pssh-box.py
|
2016-03-24 22:03:18 +00:00
|
|
|
```
|
2018-12-20 01:48:11 +00:00
|
|
|
|
2023-10-17 19:52:40 +00:00
|
|
|
Then you can use the built utility in `build/pssh-box.py`.
|
2018-12-20 01:48:11 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
All examples below assume that that `pssh-box.py` is in the `PATH` variable of
|
|
|
|
the executing shell.
|
|
|
|
|
|
|
|
### PSSH box generation
|
|
|
|
|
|
|
|
The utility can be used to generate one or more PSSH boxes.
|
|
|
|
|
|
|
|
An example to generate a Widevine PSSH with content-id 1234:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py --widevine-system-id --content-id 1234
|
|
|
|
```
|
|
|
|
|
|
|
|
It can be also be used to generate PSSH box from PSSH data (base64), e.g.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py --widevine-system-id --pssh-data AAAABCICEjQ=
|
|
|
|
```
|
|
|
|
|
|
|
|
The output can be in base64 form (`--base64`), in hex form (`--hex`) or in human
|
|
|
|
readable form (`--human`). Human readable form is the default.
|
|
|
|
|
|
|
|
An example to generate a Widevine PSSH with content-id 1234 in hex:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py --widevine-system-id --content-id 1234 --hex
|
|
|
|
```
|
|
|
|
|
|
|
|
Multiple boxes can be generated by separating boxes with `--`.
|
|
|
|
|
|
|
|
An example to generate concatenated PSSHs with a Widevine PSSH with content-id
|
|
|
|
1234 and a common PSSH with key-id 31323334353637383930313233343536 (hex form).
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py \
|
|
|
|
--widevine-system-id --content-id 1234 -- \
|
|
|
|
--common-system-id --key-id 31323334353637383930313233343536
|
|
|
|
```
|
|
|
|
|
|
|
|
### PSSH box parsing
|
|
|
|
|
|
|
|
The utility can be used to parse a single PSSH box or multiple concatenated PSSH
|
|
|
|
boxes. The input can be in hex or in base64.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py --from-hex \
|
|
|
|
000000247073736800000000EDEF8BA979D64ACEA3C827DCD51D21ED0000000422021234
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ pssh-box.py --from-base64 AAAAJHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAAQiAhI0
|
2016-03-24 22:03:18 +00:00
|
|
|
```
|
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
### More options
|
2016-03-24 22:03:18 +00:00
|
|
|
|
2018-12-20 01:48:11 +00:00
|
|
|
Run the utility with no arguments to see the full list of options.
|
2016-03-24 22:03:18 +00:00
|
|
|
|
|
|
|
```bash
|
2018-12-20 01:48:11 +00:00
|
|
|
$ pssh-box.py
|
2016-03-24 22:03:18 +00:00
|
|
|
```
|