How to create a test stream (how to create a CPIX)

Overview

A CPIX (Content Protection Information eXchange) file contains the DRM keys and metadata required to encrypt and package video for DRMtoday. This demo provides a guided CPIX Packager screen that walks through authentication, ticket retrieval, CPIX generation, and mp4split packaging.

Before you start, prepare:

  • DRMtoday API username and password (CAS credentials)
  • Merchant ID (Organization ID)
  • Key Ingest Config ID (created in the CastLab GUI)
  • Asset ID (identifier for the content you want to protect, e.g. CPIX-test)
  • One or more source video files or URLs
  • mp4split (Unified Streaming) installed on the packaging server

CPIX Packager workflow

The packager is a four-step wizard. Each step unlocks the next only after a successful API response. Progress and API results are logged in the Process History panel on the right.

Step Screen section API endpoint Output
1 API Authentication Configuration apis/cpix-packager/drmtoday-auth-api.php CAS ticket-granting endpoint for Step 2
2 Get Service Ticket apis/cpix-packager/drmtoday-ticket-api.php Service ticket + CPIX ingest URL
3 Calling CPIX Generator API apis/cpix-packager/cpix-generator-api.php drm.cpix file on the server
4 Package Videos With mp4split apis/cpix-packager/video-packaging-api.php HLS/DASH manifest (ISM) and playback URL

High-level flow:

[Step 1] Login to DRMtoday CAS
    ↓
[Step 2] Request service ticket for CPIX ingest URL
    ↓
[Step 3] GET CPIX ingest endpoint → save drm.cpix
    ↓
[Step 4] Run mp4split with --hls.cpix / --mpd.cpix → packaged .ism

Step 1 — API Authentication

UI: Enter API Username and API Password, then click Authenticate Credentials.

What happens:

  • The backend posts credentials to DRMtoday CAS (/cas/v1/tickets).
  • On success, the response Location header is saved as the next API endpoint.
  • Step 2 becomes visible; the form is disabled to prevent duplicate authentication.

On failure: Check username/password format and that the API user is active in the CastLab GUI.


Step 2 — Get Service Ticket

UI: Fill in:

  • Merchant ID — your organization UUID
  • Key Ingest Config ID — CPIX ingest configuration from DRMtoday
  • Asset ID — unique content identifier (e.g. CPIX-test)

Click Get Authenticated Ticket.

What happens:

  • The backend requests a service ticket for the CPIX ingest URL:
    https://fe.staging.drmtoday.com/frontend/cpix/v1/{merchantId}/ingest/{keyIngestConfigId}/{assetId}
  • The full CPIX endpoint (with ticket) is displayed:
    ...?ticket={ticket}&x-signaling-alg=cbcs
  • Step 3 is unlocked.

Step 3 — Generate CPIX

UI: Two buttons are available:

  • Generate CPIX File — creates the CPIX if it does not already exist
  • Force Generate New CPIX — deletes any existing file and generates a fresh CPIX (new keys)

What happens:

  • The backend calls the CPIX ingest endpoint and saves drm.cpix on the server.
  • File path pattern: generated_cpix/{merchantId}-{keyIngestConfigId}-{assetId}/drm.cpix
  • An mp4split command preview appears in Step 4.

Step 4 — Package videos

UI:

  • Output Name — base name for the output ISM (e.g. packaged-video)
  • Video Sources — one or more local paths or URLs. Use Add Video Source for multiple inputs.

Click Package Videos.

What happens:

  • The backend runs mp4split with the generated CPIX file attached to HLS, DASH, and Smooth Streaming outputs:
    mp4split -o "/packaged/{outputName}.ism" \
      --hls.fmp4 \
      --hls.cpix="{cpixPath}" \
      --mpd.cpix="{cpixPath}" \
      --iss.cpix="{cpixPath}" \
      --cpix="{cpixPath}" \
      {videoSource1} {videoSource2} ...
  • On success, the HLS playback URL is shown in the feedback message.

Use Reset All at any time to clear all steps and start a new packaging run from Step 1.


Use the packaged stream in the player

  1. Copy the HLS URL from Step 4 feedback (or Process History).
  2. Open the VideoJS Demo and paste the URL into Video/Audio Source URL.
  3. Enable Enable DRM and set Asset ID to the same value used in Step 2.
  4. Click Load Video.

Alternative: command-line script

The same workflow can be automated with the drmtoday-cpix-command.sh shell script in the backend project. Example:

./drmtoday-cpix-command.sh \
  --asset-id CPIX-test \
  --output packaged-video \
  https://example.com/source-video.mp4

Options:

  • -a, --asset-id — Asset ID (required)
  • -o, --output — Output ISM filename without extension (required)
  • -k, --key-ingest-config — Override default Key Ingest Config ID
  • -f, --force — Force regenerate CPIX even if it already exists