https://github.com/doverunner/shaka-packager-integration-sample
Python sample script for DRM packaging integration using Shaka Packager and PallyCon CPIX client
https://github.com/doverunner/shaka-packager-integration-sample
Last synced: 4 months ago
JSON representation
Python sample script for DRM packaging integration using Shaka Packager and PallyCon CPIX client
- Host: GitHub
- URL: https://github.com/doverunner/shaka-packager-integration-sample
- Owner: doverunner
- License: apache-2.0
- Created: 2024-07-23T08:19:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-24T00:58:26.000Z (over 1 year ago)
- Last Synced: 2025-03-24T03:25:20.369Z (about 1 year ago)
- Language: Python
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Shaka Packager Integration Sample
Python sample script for DRM packaging integration using Shaka Packager and DoveRunner CPIX client
## Overview
This script facilitates the process of encrypting media content using various DRM systems (Widevine, PlayReady, FairPlay) by leveraging DoveRunner's key management service and Shaka Packager's encryption capabilities.
## Prerequisites
- Python 3.6+
- DoveRunner CPIX API client module (download project from [github](https://github.com/doverunner/cpix-api-client))
- Shaka Packager (download binary from [github](https://github.com/shaka-project/shaka-packager/releases/tag/v3.2.0))
## Installation
1. Clone this repository:
- `git clone https://github.com/doverunner/shaka-packager-integration-sample`
2. Navigate to the project directory:
3. Clone the DoveRunner CPIX API client project to the same path as the script.
- `git clone https://github.com/doverunner/cpix-api-client.git`
4. Download and place the Shaka Packager executable binary in the same directory as the script.
- The current sample script uses 'packager-win-x64.exe' as an example for Windows versions.
## Usage
Run the script with the following command-line arguments:
`python3 doverunner-integration-script.py --enc_token --content_id --drm_type [options] [shaka_packager_args]`
### Required Arguments:
- `--enc_token`: KMS token for CPIX API communication with DoveRunner KMS
- `--content_id`: Content ID
- `--drm_type`: DRM Type(s) separated by comma (widevine, playready, fairplay)
### Optional Arguments:
- `--encryption_scheme`: Encryption scheme (cenc, cbc1, cens, cbcs; default: cenc)
- `--track_type`: Track Type(s) separated by comma (all_tracks, audio, sd, hd, uhd1, uhd2; default: all_tracks)
### Shaka Packager Arguments:
All arguments except the ones above will be passed directly to Shaka Packager.
## Example
`python3 doverunner-integration-script.py --enc_token your-enc-token --content_id movie123 --drm_type widevine,playready 'in=h264_720p.mp4,stream=video,init_segment=output/video/init.mp4,segment_template=output/video/$Number$.m4s' 'in=h264_720p.mp4,stream=audio,init_segment=output/audio/init.mp4,segment_template=output/audio/$Number$.m4s' --generate_static_live_mpd --mpd_output output/stream.mpd --clear_lead 0 `
## Notes
- The script will retrieve key information from DoveRunner's KMS using the provided token and content ID.
- It will then use these keys to construct a Shaka Packager command for content encryption.
- The encrypted content will be output according to the Shaka Packager arguments provided.
## References
- https://docs.doverunner.com/content-security/multi-drm/packaging/cpix-api/
- https://github.com/doverunner/cpix-api-client
- https://github.com/shaka-project/shaka-packager