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
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
Log on to the Workspace Security console.
In the left-side navigation pane, choose .
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.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
Add the JAR package dependency (Maven).
Add the
watermark-purevideo-long-v1.0.0.jardependency.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=jarAdd the following dependency to the
pom.xmlfile.<dependency> <groupId>com.aliyun.security.sase</groupId> <artifactId>watermark-purevideo-long</artifactId> <version>v1.0.0</version> <scope>compile</scope> </dependency>
Call the long video watermark API.
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);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
Log on to the Workspace Security console.
In the left-side navigation pane, choose .
On the Extraction Service page, click Create Extraction Task.
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.
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.
On the Extraction Service page, click Show in the Extracted Information column.
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
For information about the use cases, features, architecture, and purchase channels of the Digital Watermark product, see What is Digital Watermark.
To learn about other types of watermarking services, see the following topics: