Preprocessor Library Guide

PallyCon Watermark Preprocessor Library is a C ++ library that can be ported to an encoding solution. By preprocessing watermark directly in the video encoding process, you can omit the re-encoding process required for CLI Preprocessor.

graph LR;
    subgraph Encoder
    A[Source video] -->|Frame image| B(Preprocessor library)
    B -->|Two set of frame<br>with 0, 1 marked| C["Encoded result<br>(two MP4 videos)"]
    end
    C --> D(DASH or<br>HLS packaging)
    subgraph Packager
    D --> E["Packaging result<br>(two set of streaming content)"]
    end

By default, porting to FFMPEG-based encoder/transcoder is supported. To apply Preprocessor library to other commercial solutions, it is required to port the library by the solution vendor. Please contact us if you need more information or want to apply the library.

Contact Us

Prerequisites

  • Ubuntu 16.04, 18.04 or CentOS 7
  • FFMPEG 3.4.2 or later
  • Set ‘YOUR_FFMPEG_PATH’ in Makefile
  • Install dependencies as below (for Ubuntu 18.04. refer to README file for other versions)
sudo apt-get update
$ sudo apt install -y \
        build-essential \
        libva-drm2 \
        libvdpau1 \
        libmediainfo0v5 \
        libpng16-16

API List

- IWatermark* CreatePreprocessor(WatermarkSymbol sym)
  : @return watermark pre-processor instance

- void DestroyWatermark(IWatermark* watermark)
  : destroy watermark instance

- IWatermark::init(const char* fmkeyfile, const char* accesskey)
  : initialize watermark with Keyfile and Access-Key [1]
  : @return FMError

- IWatermark::apply(FrameData* frame)
  : apply watermark
  : @return bool

API Usage

   wm_0 = CreatePreprocessor(WatermarkSymbol_0) [1]
   wm_1 = CreatePreprocessor(WatermarkSymbol_1)
    |
    v
   wm_0->init("./fmkeyDemo.dat", "FOR_INKA_FORENSIC_WATERMARK_TEST") [2]
   wm_1->init("./fmkeyDemo.dat", "FOR_INKA_FORENSIC_WATERMARK_TEST")
    |
    v
 +------------------------------------+
 | FrameData frame0 [3]               |
 | FrameData frame1                   |
 |  |                                 |
 |  v                                 |
 | wm_0->apply(&frame0) [4]           |loop
 | wm_1->apply(&frame1)               |
 |  |                                 |
 |  v                                 |
 | adjust_packet_size(...) [5]        |
 +------------------------------------+
    |
    v
   DestroyWatermark(wm_0)
   DestroyWatermark(wm_1)
    |
    v
   XXXX_0.mp4, XXXX_1.mp4


   [1] Server Side 0/1 Variant Watermark method combins 0/1 files to represent user information.
       Create 2 instances to create a 0/1 file.
       - FwmPreprocessSample.cpp::fm_init_watermark()

   [2] Keyfile and Access-Key
       - To use the library, you must enter the Keyfile path and Access-Key.
       - The sample project includes a demo keyfile(and Access-Key) for demonstration. If you use the demo key,
         the 'Pallycon Demo' character appears at the top left of the result video, 
         and there are on other functional restrictions. This character does not appear when using a commercial key.
       - Please contact us to get the commercial key.
       - FwmPreprocessSample.cpp::fm_init_watermark()

   [3] Set the 'FrameData' field as in the sample code.
       - FwmPreprocessSample.cpp::fm_apply(), IWatermark.h

   [4] Calling IWatermark::apply() inserts a watermark.
       - FwmPreprocessSample.cpp::fm_apply()

   [5] (Optional) Match the size of the embedded 0/1 'AVPacket' if necessary.
       - FwmPreprocessSample.cpp::fm_adjust_packet_size(), fm_check_filler_data_rbsp()

Restrictions

The encoder should follow the below rules to integrate PallyCon Forensic Watermarking. Configure your encoder by referring to the below example about libx264.

  1. GOP must be 60.

    • FwmPreprocessSample.cpp::openOutputFile()::enc_ctx->gop_size
    • FwmPreprocessSample.cpp::checkAndUpdateParam()::pCtx->x264_param
  2. In special cases where the 0/1 embedded file size must be matched, the size of the all embedded ‘AVPacket’ must be the same.

    • FwmPreprocessSample.cpp::fm_adjust_packet_size(), fm_check_filler_data_rbsp()
Previous
Next