PallyCon Distributor Watermarking Guide

Overview

PallyCon Distributor Watermarking is a watermarking solution to track the illegally leaked content when a video content is distributed through multiple channels.

PallyCon Distributor Watermarking inserts the channel information to the original video in the form of an invisible watermark, and can detect the watermark information from the leaked video. It also provides an option to insert an additional visible watermark.

There are two versions of the CLI (Command Line Interface) tool used for the watermark embedding in PallyCon DWM as follows.

  1. DWM PreEmbedder: Used to embed the watermark for the distribution channel into Mezzanine or MP4 format files.
  2. DWM DRM Embedder: Used when you need to embed watermark data in your MP4 video files and encrypt them with multi-DRM for streaming in DASH/HLS format to a limited audience for review purposes.

Both versions of the CLI can be easily integrated for secure content distribution in pre-release workflows.

This document is based on DWM PreEmbedder version 2.2.0.

DWM Workflow

PallyCon DWM application workflow is as shown below.

PallyCon DWM Workflow
PallyCon DWM Workflow
  1. Input the original video along with the information of the distribution channels into DWM PreEmbedder.
  2. PallyCon DWM server issues a unique DWM ID for each channel through API integration with the DWM PreEmbedder.
  3. DWM PreEmbedder creates videos with unique watermarks as many as the number of channels to be distributed.
  4. Deliver the corresponding DWM video to each distribution channel.
  5. In the event of a content leak, the leaked copy is sent to PallyCon service to request watermark detection.
  6. PallyCon service detects the watermark in the leaked copy and delivers the channel information (Distributor ID) to the customer.

PallyCon DWM + DRM application workflow is as shown below.

PallyCon DWM DRM Workflow
PallyCon DWM DRM Workflow
  1. Input the original video along with the information of the distribution channels, set the DRM encryption parameters and packaging to be applied to the DWM DRM Embedder.
  2. PallyCon DWM cloud based server issues a unique DWM ID for each channel through API integration with the DWM DRM Embedder.
  3. DWM DRM Embedder creates videos with unique watermarks, encrypts it with DRM using the –access_key –site_id, packages it with DASH/HLS as per the distribution/recipients list
  4. Deliver the corresponding DWM video to each distribution channel and can be played by only authorised user making the content delivery more secure
  5. In the event of a content leak, the leaked copy is sent to PallyCon service to request watermark detection.
  6. PallyCon service detects the watermark in the leaked copy and delivers the channel information (Distributor ID) to the customer.

Note: This DWM DRM Embedder supports only delivery format MP4 type files.

Supported Specifications

PallyCon DWM supports the below specifications.

Item Specification Remarks
Content Type Supports video contents only
Format and codec MP4(H.264, H.265, XDCAM), MOV(ProRes), MXF(XDCAM) DWM DRM Embedder supports MP4 format only
Supported Resolution Up to 4K/UHD resolution
Dynamic Range SDR (Standard Dynamic Range), HDR (High Dynamic Range) supported
Number of DWM ID Up to 4095 unique IDs of recipients per PallyCon DWM account
Minimum Video Length Need at least 30 seconds of recorded video to detect watermark Cannot support source video shorter than 30 seconds
Video Quality for Detection Need 480p 1Mbps or higher video quality for detection. 720p video is recommended.
Number of recipients Max 4096 recipients per site ID of DWM account

Registering DWM recipients

For DWM embedding and detection, you firstly need to register recipients who will receive watermarked content. Up to 4096 recipients can be registered, and a serial number for each recipient is given as a DWM ID in the order of registration.

To register DWM recipients, select the DWM recipient item in the Distributor Watermarking menu of PallyCon Console. You can register a recipient by entering the name and description on the screen after clicking the Register button. (Click the + button when registering multiple items)

When inserting a watermark through DWM PreEmbedder in the next step, you may enter the name of the recipient in the job information, then the recipient’s ID (serial number) is inserted as watermark data in the output video.

DWM Embedding

PallyCon DWM PreEmbedder is a Linux CLI (Command Line Interface) based DWM embedding tool. It receives the original video and DWM ID information and outputs the DWM video with the corresponding ID.

When using the DWM PreEmbedder executable file alone, the customer must directly manage the DWM ID and distribution channel information without the use of PallyCon server. For server integration, DWM embedding should be performed through a Python script distributed along with the core executable file.

DWM PreEmbedder Modules

You can request PallyCon DWM PreEmbedder after subscribing to PallyCon Distributor Watermarking service, and is composed as follows:

  • DwmEmbedder: It is an executable file which is a core module executed by the Python script below. It inserts a unique watermark (DWM ID) in the original video for each distribution target channel.

  • DwmPreEmbedder.py: This is a Python script in charge of communication between DwmEmbedder and the PallyCon server. DWM embedding should be done through this script instead of directly executing the above core module.

  • DwmDrmEmbedder.py: This is a Python script similar to DwmPreEmbedder.py but with additional features to encrypt the content using DRM technology and package it in DASH/HLS format.

  • dwm_info.json: This is a file to input embedding job information such as the original video and output file to insert the DWM ID, and information of recipients.

  • Library files: In the lib folder, there are various libraries used by the DWM Embedder.

  • demokey.dat: This is a demo version key file used for DWM embedding in a trial account. In addition to the invisible watermark (DWM ID), a visible watermark (‘PALLYCON DEMO’) will be added in the video preprocessed with the demo key.

After subscribing a DWM plan including the use of DWM PreEmbedder, you may use a commercial version key file(dwmkey.dat) which can be requested via Helpdesk.

Required Environments

You need the following environment to run the DWM PreEmbedder.

Hardware

Software

  • Ubuntu server 18.04, 20.04 or CentOS 7
  • Intel IPP (Integrated Performance Primitives) 2018: Included in the distribution.
  • NVIDIA CUDA Toolkit 9.1 or later (NVIDIA hardware acceleration)
  • Dependency libraries

Installation Guide

NVIDIA CUDA Toolkit 10.0

Pallycon CLI Preprocessor supports NVIDIA H/W encoding/decoding. You can check supported GPUs and codecs here.

It supports CUDA Toolkit 9.1, but 10.0 or higher is recommended. You can also install the latest version if there are no compatibility issues with your other programs. If you need to install other CUDA Toolkit version, please refer latest downlaod or archive.

  • Installing on Ubuntu 18.04

    $ distribution=$(. /etc/os-release;echo $ID$VERSION_ID|tr -d '.')
    $ wget https://developer.download.nvidia.com/compute/cuda/repos/${distribution}/x86_64/cuda-repo-${distribution}_10.0.130-1_amd64.deb
    $ sudo dpkg -i cuda-repo-${distribution}_10.0.130-1_amd64.deb
    $ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/${distribution}/x86_64/7fa2af80.pub
    $ sudo apt-get update
    $ sudo apt-get install -y linux-headers-$(uname -r)
    $ sudo apt-get install -y cuda-10-0
    $ rm cuda-repo-${distribution}_10.0.130-1_amd64.deb
    $ sudo reboot
    
  • Installing on Ubuntu 20.04

    $ distribution=$(. /etc/os-release;echo $ID$VERSION_ID|tr -d '.')
    $ wget https://developer.download.nvidia.com/compute/cuda/11.6.1/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.1-510.47.03-1_amd64.deb
    $ sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.1-510.47.03-1_amd64.deb
    $ sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub
    $ sudo apt-get update
    $ sudo apt-get install -y linux-headers-$(uname -r)
    $ sudo apt-get -y install cuda
    $ rm cuda-repo-ubuntu2004-11-6-local_11.6.1-510.47.03-1_amd64.deb
    sudo reboot
    
  • Installing on CentOS 7

    $ sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    $ wget https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-10.0.130-1.x86_64.rpm
    $ sudo rpm -i cuda-repo-rhel7-10.0.130-1.x86_64.rpm
    $ sudo yum clean all
    $ sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
    $ sudo yum install cuda-10-0
    $ rm cuda-repo-rhel7-10.0.130-1.x86_64.rpm
    $ sudo reboot
    
  • Installing on AWS Linux2

    • Please refer to this link
  • Verification

    $ nvidia-smi
    
  • References

Install Dependencies

  • Ubuntu 18.04 version

    $ sudo apt update
    $ sudo apt install -y \
            libva-drm2 \
            libvdpau1 \
            libmediainfo0v5 \
            libpng16-16
    
  • Ubuntu 20.04 version

    $ sudo apt update
    $ sudo apt install -y \
            libnuma1 \
            libva-drm2 \
            libvdpau1 \
            libmediainfo0v5 \
            libpng16-16
    
  • CentOS 7 version

    $ sudo yum update
    $ sudo yum install -y \
            openssl-devel \
            libpng-devel \
            libmediainfo-devel
    

If an error occurs when running the DwmPreEmbedder Python script, install the cryptography package as shown below. pip3 install pycryptodome –user

DWM PreEmbedder Guide

After unpacking the DWM PreEmbedder distribution in the execution environment prepared through the above installation process, check if there are related files (core executable, Python script, dwm_info.json, key file, etc.) in the bin folder. After that, you can insert the DWM ID into the original video by running DWM PreEmbedder with the steps below.

Create credentials file

In order to communicate with PallyCon DWM server, a credential file should be created with Site ID, Site Key, and Access Key information. Save these values as ~/.pallycon/credentials file in the following format.

site_id=YOUR_SITE_ID
access_key=YOUR_ACCESS_KEY
site_key=YOUR_SITE_KEY

The actual values to be entered in the credentials file can be checked on the ‘Distributor Watermarking’ > ‘DWM Settings’ screen after logging in to the PallyCon console.

Create job file

Update the dwm_info.json file, which is the DWM job information file, referring to the example and description below.

{
    "content_id":"contentid_test",
    "input": "~/input.mp4",
    "output": "~/output.mp4",
    "visible_watermark": {
      "type": "text",
      "text": {
        "message": "for test",
        "fontsize": 20
      },
      "image": {
        "filename": "~/watermark.png"
      },
      "alpha": 0.3,
      "position": [
        { "x": 200, "y": 100},
        { "x": 300, "y": 200}
      ],
      "timing": {
        "interval": "00:05:00",
        "disappear": "00:01:00"
      }
    },
    "recipients": [
        "recipient 1",
        "recipient 2",
        "recipient 3"
    ]
}
  • content_id: unique ID for the original content (enter arbitrarily)
  • input: Input the source file name and path to embed the DWM ID.
  • output: Enter the path and default file name to save the DWM-embedded result file.
    • Distribution information (distributor name, distribution purpose, DWM ID) is added after the basic file name to the actual generated file name.
  • visible_watermark: Adds a visible watermark to the resulting video. (optional)
    • In addition to the invisible DWM ID information, an image or text watermark can be displayed on the video.
    • You may omit this keyword and its subitems if you don’t want to add visible watermark.
    • For detailed options that can be entered, please refer to the separate description below.
  • recipients: list of receivers
    • Enter the name of recipient who will receive the DWM applied video.
    • Only recipient names registered in PallyCon Console in advance can be entered.

The above DWM job information is transmitted to the DWM server API through a Python script, and the DWM ID returned from the server is inserted into the resulting video in the form of an invisible watermark through the DWM Embedder core module.

Run DWM PreEmbedder Python script

During the DWM trial, the demo key file (demokey.dat) included with the distribution is used instead of the commercial version key file. In this case, run it by adding the --demo parameter along with the dwm_info.json file name as follows.

$ python3 DwmPreEmbedder.py dwm_info.json --demo

After subscribing to the DWM commercial plan, request the commercial key file (dwmkey.dat) via HelpDesk and copy it to the bin directory, that is, to the same location as DwmPreEmbedder.py. The commercial version runs without the --demo parameter as follows:

$ python3 DwmPreEmbedder.py dwm_info.json

DWM & DRM with DASH/HLS packaging

If the requirement is to share content securely for reviewing to a limited audience then this DWM-DRM embedder is the tool to be used. The uniqueness of this CLI is, it applies distributor forensic watermark, encrypts with Multi-DRM and packages it in DASH/HLS format streaming ready for different recipients.

Basic command format:

usage: DwmDrmEmbedder.py [-h] [-v] [-i input_filename] [-o output_filename] [-c content_id] [--demo] [--dash/-–hls] [--site_id] [--access_key] [-y] job_json_file

Example: ./DwmDrmEmbedder.py --demo --dash --site_id DEMO --access_key FVJDp2LT2Xr0f4Di18z6lzv3DKvNOP20 dwm_info.json
Options Required Description
-h, --help N Shows the command usage
-v, --version N Shows the program’s version
-i input_filename N Overrides the input filename written in dwm_info.json file
-o output_filename N Overrides the output filename written in dwm_info.json file
-c content_id, --content_id content_id N overrides the content id written in dwm_info.json file
--demo N sets the demo mode for trial
--dash, --hls Y Performs DASH-CENC(Widevine, PlayReady) or HLS-AES(FairPlay) packaging
--site_id Y PallyCon service site ID (4 bytes) shown on PallyCon Console (Multi-DRM > DRM Settings)
--access_key Y An authentication key issued to the service site. (shown on the same Console page as the site ID)
-y N Overwrites outputs without prompt
dwm_info.json Y This is a file to input embedding job information such as the original video and output file to insert the DWM ID, and information of recipients.

Sample usages:

  • Package as HLS
./DwmDrmEmbedder.py dwm_info.json --demo --hls --site_id DEMO --access_key FVJDp2LT2Xr0f4Di18z6lzv3DKvNOP20
  • Package as DASH & change output file as test
./DwmDrmEmbedder.py dwm_info.json --demo -o test --dash --site_id DEMO --access_key FVJDp2LT2Xr0f4Di18z6lzv3DKvNOP20 
  • Package as DASH & HLS
./DwmDrmEmbedder.py dwm_info.json --demo --hls -dash --site_id DEMO --access_key FVJDp2LT2Xr0f4Di18z6lzv3DKvNOP20

Visible Watermark configuration (optional)

By default, DWM PreEmbedder invisibly embeds a unique DWM ID for each distribution channel into the video. If you want to add a visible watermark to the video, you can set the following options in the visible_watermark item of the dwm_info.json file.

Keyword Type Required Description Example
type String Y Type of visible watermark (“text” or “image” or “none”). You can turn off visible watermark by setting none to this option. “type”: “image”
text Json Y (for text type) Options for text type watermark. Not used for image type watermark.
message String Y (for text type) Text message for visible watermark. Alphanumeric, blank, .(dot), and _(underscore) characters are allowed. “message”: “for_test”
fontsize Int N Size of text watermark. “font_size”: 20
image Json Y (for image type) Options for image type watermark. Not used for text type watermark.
filename String Y (for image type) File path of watermark image. “image_file”: “~/watermark.png”
alpha Float N Opacity of visible watermark (default 1) “alpha”: 0.5
position Json Array N Options for watermark positioning. When multiple position items are input, a new position can be specified every time it is displayed on the screen by the interval value below.
x and y Int N X/Y position of the watermark “x”: 200, “y”: 100
timing Json N Options for showing/hiding watermark periodically (watermark interval)
interval String N Set the period to display a watermark in the format of ‘HH:MM:SS’ When “interval”: “00:05:00” is input, it is displayed every 5 minutes and then disappears after the value of disappear. (repeated)
disappear String N Set how long the watermark will be displayed in the format of ‘HH:MM:SS’ When “disappear”: “00:01:00” is input, the watermark will be shown for 1 minute after every interval
Due to the restriction of Apple ProRes codec, the visible watermark cannot be applied to ProRes video files as of now. Please request via Helpdesk if you need the feature.

DWM Embedding Job History

You can review the DWM embedding information transmitted to the server in the PallyCon console.

In the Distributor Watermarking > DWM packaging history screen, you can inquire the recipient information entered in the dwm_info.json.

DWM PreEmbedder Error Code

Error Code Status
0 Success
1 Error
2 Out of memory
10 Stopped by user
30 Access key validation failed
31 Key file does not exist
40 Input file name error
41 Input file does not exist
42 Output file name error
43 Output directory does not exist
50 Failed to open video input stream
51 Failed to open video output stream
52 Failed to write output track
53 Failed to write video output track
54 Input file does not have any video track
100 Setting error
150 Failed to initialize DWM embedder
151 Invalid symbol in the input
200 Failed to find encoder
201 Failed to find decoder
210 Decoder device initialization failure
220 Codec is locked
253 Failed to set the visual watermark

DWM Detection

If a video with DWM applied is leaked and distributed illegally, you can request the PallyCon service to detect a watermark on the video that is suspected of being leaked. To request watermark detection, register the title and download link of the video on the DWM detection request page of the PallyCon Console.

DWM detection analyzes each frame of the video to detect the original watermark pattern and decrypts the data with the secret key used at the time of insertion. If a DWM ID is found through the detection process, we find the distribution channel(recipient) information in our database and report it as the detection result.

For DWM detection, a continuous recorded video of at least 30 seconds or longer is required. PallyCon DWM solution is robust against various attacks including resizing, but the actual detection rate of the watermark may vary depending on the video quality (resolution, bitrate, shake, etc.) used for detection. The minimum specification required for detection is 480p 1Mbps or higher, and most of the video over 720p can be detected.
sequenceDiagram
    participant A as Service site
    participant B as PallyCon service
    A ->> B: Suspicious content
    Note right of B: Detect watermark
    B -->> B: Analyze video frames
    opt DWM ID detected
    Note right of B: DWM recipients DB
    B -->> B: Find the recipient data
    end
    B ->> A: Report detection result

Please contact us for detailed information on watermark detection such as monitoring service.

Contact Us

Previous
Next