The Shaka packager allows you to securely package your content. Learn how it integrates with the Axinom Key Service and set it up properly.

Shaka Packager Integration

Overview

This document serves as a quick start guide to use Shaka Packager with Axinom Key Service. The usage is demonstrated by a PowerShell script that has been provided together with this guide. The demo script, Use-ShakaPackagerWithAxinomKeyServer.ps1, demonstrates how to use Shaka Packager with Axinom Key Service to encrypt and package DASH or HLS content. Encrypted DASH is played back using Widevine or PlayReady. Encrypted HLS is played back using Widevine or FairPlay.

The demo script contains comments with extra information. The script itself should only be used as an example and not as a production solution. For any questions about the steps of the demo script, it’s possible to open the script with a text editor and refer to the inline comments.

There are also references to documents at the end of this guide that may provide useful information about Axinom Key Service, Shaka Packager, or any other resources involved.

Prerequisites

Shaka Packager

The latest Shaka Packager can be acquired from the Google Shaka Packager’s page: https://github.com/google/shaka-packager/releases

For Windows, use packager-win.exe.

For Linux, use packager-linux.

PowerShell

PowerShell or PowerShell Core is required to run the demo script.

Windows

Windows comes with PowerShell already pre-installed.

Linux

PowerShell must be installed on Linux. Instructions can be found at: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux

Video File

Any video in the mp4 format can be used as an input file.

Getting the Axinom Key Service Quick Start Script

You can download the demo script, Use-ShakaPackagerWithAxinomKeyServer.ps1 from the Code Samples section. It should be copied to the same location as the Shaka Packager executable.

Running the Packaging Script

To run the demo script, open PowerShell. Linux PowerShell can be opened by typing pwsh to the Terminal. Change the directory to the folder which consists the demo script.

Running the demo script in PowerShell.
./Use-ShakaPackagerWithAxinomKeyServer.ps1 -InputVideo input_video.mp4 -SigningKeyAsHex 0000000000000000000000000000000000000000000000000000000000000000 -SigningIvAsHex 00000000000000000000000000000000 -Signer Signer_Name

By default, the demo script generates a random key ID. A specific key ID can be provided using the -KeyID parameter. For example: -KeyID 00000000-0000-0000-00000000000000000.

Usage of Shaka Packager

The demo script also shows the exact parameters passed to Shaka Packager in the output. This can be used as an example of how to invoke the packager directly.

Example of output from the demo script that can be used with Shaka Packager directly.
in=input.mp4,stream=audio,output=output/cenc/audio.mp4
in=input.mp4,stream=video,output=output/cenc/video.mp4
--enable_raw_key_encryption
--keys=key_id=78c5e406cdf343a8a0e86c210002984a:key=5ce85e92271fff56fabba555f77381d7
--pssh=0000006d7073736800000000edef8ba979d64acea3c827dcd51d21ed0000004d121078c5e406cdf343a8a0e86c210002984a1a0d7769646576696e655f74657374222437386335653430362d636466332d343361382d613065382d36633231303030323938346148e3dc959b06000001e470737368000000009a04f07998404286ab92e65be0885f95000001c4c401000001000100ba013c00570052004d00480045004100440045005200200078006d006c006e0073003d00220068007400740070003a002f002f0073006300680065006d00610073002e006d006900630072006f0073006f00660074002e0063006f006d002f00440052004d002f0032003000300037002f00300033002f0050006c00610079005200650061006400790048006500610064006500720022002000760065007200730069006f006e003d00220034002e0030002e0030002e00300022003e003c0044004100540041003e003c00500052004f00540045004300540049004e0046004f003e003c004b00450059004c0045004e003e00310036003c002f004b00450059004c0045004e003e003c0041004c004700490044003e004100450053004300540052003c002f0041004c004700490044003e003c002f00500052004f00540045004300540049004e0046004f003e003c004b00490044003e0042007500540046006500500050004e00710045004f0067003600470077006800410041004b005900530067003d003d003c002f004b00490044003e003c002f0044004100540041003e003c002f00570052004d004800450041004400450052003e00
--protection_scheme=cenc
--mpd_output=output/cenc/manifest.mpd
--hls_master_playlist_output=output/cenc/manifest.m3u8
--clear_lead=0

Verifying Packager Results

To test and verify if the packaged media works, it’s possible to use the players on the Axinom VTB website.

  1. Upload your content to a web server. In most cases, HTTPS is required for a successful playback.

  2. Open Axinom’s VTB player located at https://vtb.axinom.com and select the latest Shaka Player from the list on the left.

  3. Insert the URL to the output file (for example: https://example.com/manifest.mpd) to the Stream URL field.

  4. The Token field can be left empty if this guide is used or you can get your token created using our tool.

  5. Click Load Stream. If the video starts playing, then the packaging was successful.

Additional Resources

For more information, please refer to the documentation and examples listed below.

Using Axinom Key Service’s Widevine CENC API

Other

Revision History

Version Date Description

1.0

June 11, 2019

  • Initial version.