Long video watermark

更新时间:
复制 MD 格式

Long video watermark is a technology designed to protect high-value video content, such as films and TV series, from piracy. It enables source tracing of unauthorized distributions. The watermarks provide exceptional visual quality (PSNR > 48 dB) and are highly resistant to various geometric attacks (such as scaling, rotation, and cropping) and signal-processing attacks (such as adding noise, denoising, and compression).

You can embed both visible and invisible watermarks in long videos.

  • If you embed a visible watermark, the watermark information is directly visible on the video, allowing you to identify the leaker.

  • If you embed an invisible watermark, the information is not visible. You must extract the invisible watermark content in the SASE console to identify the leaker. The video used for embedding and extraction must be longer than 6 minutes (20 minutes or more provides the best results).

Invisible watermarks are typically used in cases involving information leaks or copyright disputes.

Procedure

image

Prerequisites

You have purchased the video watermark service. For more information, see Digital Watermark billing overview.

Embed the watermark SDK

You need an x86-based Linux server to deploy the video watermark SDK.

This topic uses an Ubuntu 24.04 (64-bit) server as an example.

Step 1: Download the video watermark SDK

  1. Log on to the Workspace Security console.

  2. In the left-side navigation pane, choose Digital Watermarking > Embedding Service.

  3. On the Embedding Service page, in the Actions column for Video Watermark, click Download SDK.

    Download the long video watermark package. Only the Java language is currently supported.

    The downloaded SDK package contains the following files:

    watermark-purevideo-long-v1.0.0.jar: The SDK for watermarking integration. Add this file to your Maven repository.

    watermark-purevideo_long_demo: A demo for testing the watermarking feature.

  4. Click the icon in the AK/SK information column to copy the AK and SK information, and then save it locally.

Step 2: Integrate the SDK

  1. Add the JAR package dependency (Maven).

    1. Add the watermark-purevideo-long-v1.0.0.jar dependency.

      mvn install:install-file  -Dfile=watermark-purevideo-long-v1.0.0.jar  -DgroupId=com.aliyun.security.sase -DartifactId=watermark-purevideo-long -Dversion=v1.0.0  -Dpackaging=jar
    2. Add the following dependency to the pom.xml file.

      <dependency>
        <groupId>com.aliyun.security.sase</groupId>
        <artifactId>watermark-purevideo-long</artifactId>
        <version>v1.0.0</version>
        <scope>compile</scope>
      </dependency>
  2. Call the long video watermark API.

    1. Initialize the AK and SK.

      /**
       * Initializes the AK and SK.
       * @param appKey The application's AccessKey ID.
       * @param secret The application's AccessKey secret.
       * @param useLocalConfig Specifies whether to use local configuration. 0: remote configuration (requires an internet connection), 1: local configuration.
       */
      WaterMarkLongVideoUtils.init(appKey, secret, useLocalConfig);
    2. Add a digital watermark to a long video.

      ParamsFile paramsFile = new ParamsFile();
      // Supported video formats: mp4, mov, avi , ts, f4v, mkv
      paramsFile.setSrcFilePath("123.mp4");
      paramsFile.setDestFilePath("234.mp4");
      // Visible watermark configuration
      paramsFile.setText("Hello123abcOK");
      // x and y are the pixel offsets from the top-left corner of the video.
      paramsFile.setText_x("100");
      paramsFile.setText_y("100");
      // Font file path. The SDK creates /tmp/AlibabaPuHuiTi-2-45-Light.ttf by default.
      paramsFile.setFontfile("/tmp/AlibabaPuHuiTi-2-45-Light.ttf");
      // Font size
      paramsFile.setFontsize("48");
      // RGB color value
      paramsFile.setFontcolor("0xFF0000");
      // Opacity, from 0 to 1.
      paramsFile.setAlpha("0.5");
      // Invisible watermark configuration. A decimal string with a value from 0 to 4294967295.
      paramsFile.setWatermarkbitsStr("0123456789");
      // Segment length (seconds)
      paramsFile.setChiplen("3");
      WaterMarkLongVideoUtils.waterMarkIntoVideoLong(paramsFile);

Extract invisible watermark

You have a leaked video that contains an invisible watermark.

Step 1: Create an extraction task

  1. Log on to the Workspace Security console.

  2. In the left-side navigation pane, choose Digital Watermarking > Extraction Service.

  3. On the Extraction Service page, click Create Extraction Task.

  4. In the Create Extraction Service panel, configure the extraction file.

    Parameter

    Description

    Watermark version

    Select the watermark version that you purchased.

    Watermark type

    Select Video Watermark.

    Watermark bit width

    Set the bit width for the watermark information. This must be consistent with the watermark bit width set in the SDK (default is 32 bits).

    Video type

    Select Long video.

    Upload file for extraction

    Follow the on-screen instructions to upload the leaked file.

  5. Click OK.

    After the task is created, its information appears on the Extraction Service page.

Step 2: View the extraction result

After the extraction task is created, wait for it to complete successfully. Then, view the result to get the invisible watermark content.

  1. On the Extraction Service page, click Show in the Extracted Information column.

  2. In the expanded information, you can find the invisible watermark content (a decimal number).

    The details also include the Watermark content type field (for example, Embedded 64-bit uint information).

Source tracing

Map the extracted invisible watermark content to the mapping service used in your application or to a custom mapping table.

For example, if the extracted invisible watermark content is 123456 and 123456 maps to Alice in your mapping table, then the leaker is employee Alice.

Related documents