CLI Embedder Guide

PallyCon CLI Watermark Embedder is a command line interface (CLI) based watermark embeder that inserts a watermark on an encoded video file. It runs on a packaging server built by the service site itself, and produces the mp4 original video as two streaming contents with watermark (0 or 1) through watermark embedding and packaging process.

sequenceDiagram participant A as Encoder participant B as Packaging server participant C as CDN A ->> B: Encoded MP4 Note right of B: CLI Embedder B -->> B: Watermark embedding opt Multi DRM Note right of B: CLI Packager B -->> B: Content encryption end B ->> C: Packaged streams Note right of C: DASH / HLS contents
(0 and 1 marked)

Modules

PallyCon CLI Watermark Embedder can be downloaded from the console site after joining PallyCon watermarking service. It consists of the following two modules.

  • FMembedder: Creates two content files, each marked ‘0’ or ‘1’. For example, when the input content is ‘A.mp4’, it creates ‘A_0.mp4’ and ‘A_1.mp4’. Each of the two generated content can be packaged as DASH / HLS streaming content using PallyCon CLI Packager.

  • Sample Mixer: A test mixer that combines two mp4 files created by FMembedder into a single mp4 file. If you enter a payload string of up to 7 bytes, it will produce a combined result based on that payload. For actual service scenario, the watermark mixer module running on CDN is used to perform the combination of session information at playback time.

Required environments

You need the following environment to run the CLI Embedder.

Hardware

AWS GPU instance performance

  • Geforce GTX1050 (Desktop, Pascal) << P2 (Tesla K80) << P3 (Tesla V100), G3 (Tesla M60)
  • When using an AWS EC2 instance as a watermark embedding server, we recommend an instance of type P3 or G3 for GPU acceleration.

Software

  • Ubuntu server 16.04 LTS
  • Intel IPP (Integrated Performance Primitives) 2018
  • NVIDIA CUDA Toolkit 9.1 (NVIDIA hardware acceleration)
  • Dependency libraries

Installation guide

Intel IPP 2018 installation

Follow these steps to install the Intel IPP 2018 library:

If you have existing Intel IPP library installed, it is recommended to re-install it.

  1. Install the GPG key for the repository

    sudo apt update
    sudo apt install apt-transport-https
    wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
    sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
    
  2. Add the Intel® IPP repository

    sudo sh -c 'echo deb https://apt.repos.intel.com/ipp all main > /etc/apt/sources.list.d/intel-ipp.list'
    
  3. Update the list of the packages

    sudo apt update
    
  4. Install IPP library

    sudo apt install intel-ipp-64bit-2018.3-051
    
  5. Uninstall IPP library (if needed)

    sudo apt autoremove intel-ipp-64bit-2018.3-051
    

NVIDIA CUDA Toolkit 9.1 installation

Run the following script to install the NVIDIA CUDA toolkit.

  wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
  
  sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
  
  sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
  
  sudo apt-get update
  
  sudo apt-get install -y \
      linux-headers-$(uname -r) \
      cuda

Dependency libraries installation

Install the dependency libraries required for CLI embedder to run as follows:

  sudo apt update
  sudo apt install -y \
    libbz2-dev \
    zlib1g-dev \
    libass-dev \
    libva-dev \
    libvdpau-dev \
    libssl-dev

CLI Embedder guide

FMembedder

Execute the FMembedder executable file in the ‘bin’ folder in the downloaded archive with the following command.

  • Required parameters
Parameter Description Example Remarks
-i Input media filename -i ~/demo/input.mp4
-o Output media filename -o ~/demo/output.mp4 The resulting output will be two files with ‘0’ and ‘1’ marked. (~/demo/output_0.mp4 and ~/demo/output_1.mp4)
--access_key Access Key for service authorization --access_key QSTO2zE7 After joining the PallyCon service, you can check the access key in the integration setting of the console site.
  • Descriptions of all parameters can be checked with ‘-h’ option. FMembedder -h

If an error occurs that is related to the common library path, you must set LD_LIBRARY_PATH in the PATH environment variable. For details, refer to the FMembedder.sh file included in the CLI embedder archive file.

Example of FMembedder usage

  • Example 1: to apply NVIDIA HW acceleration encoder(nvenc), use ‘-n’ option

    FMembedder -i ~/demo/input.mp4 -o ~/demo/output.mp4 -n --access_key ACCESSKEY_BLAHBLAH
    
  • Example 2: to apply NVIDIA HW acceleration encoder(nvenc) and decoder(cuvid), use both ‘-n’ and ‘-c’ options

    FMembedder -i ~/demo/input.mp4 -o ~/demo/output.mp4 -n -c --access_key ACCESSKEY_BLAHBLAH
    

DRM packaging (optional)

For content that applies both forensic watermarking and DRM, you can package the ‘0’ and ‘1’ version mp4 files generated by FMembedder using PallyCon Packager. Depending on the service’s target platform, the two versions of watermark content are packaged in DASH or HLS format, and delivered to the user in real time through the mixer module of the CDN.

For details on DRM packaging and watermark mixing, please refer to the following guide documents.

Sample mixer

Execute the sampleMixer executable file in the ‘bin’ folder of the CLI embedder archive with the following command.

  • Required parameters: (input in the following order)
  1. Filename of output video with ‘0’ marked (e.g. ~/demo/output_0.mp4)
  2. Filename of output video with ‘1’ marked (e.g. ~/demo/output_1.mp4)
  3. Filename of mixed output (e.g. ~/demo/output_mix.mp4)
  4. Watermark payload for mixing (e.g. testmsg or 746573746d7367)
    • Up to 7 ASCII characters or 14 hexadecimal digits
    • On actual service scenario with session manager integration, watermark data can insert up to 255 bytes of character string with payload value as its key.
  • Explanation of all parameters can be confirmed by executing without parameter input as follows. sampleMixer

Example of sample mixer usage

You can create a sample mixed video(output_mix.mp4) with a payload data ‘testmsg’ from the FMembedder output by running the following script.

  sampleMixer ~/demo/output_0.mp4 ~/demo/output_1.mp4 ~/demo/output_mix.mp4 testmsg