Video watermark

更新时间:
复制 MD 格式

A video watermark adds identifying information, such as a company logo, TV station icon, user nickname, or user ID, to a video to promote your brand, protect copyrights, and improve brand recognition. ApsaraVideo VOD supports three types of watermarks: static image, animated image, and text. You can choose the type that best suits your needs.

How it works

The video watermark feature in ApsaraVideo VOD works through transcoding. During this process, images or text are burned into the video stream to create a new, watermarked video file.

Use cases

  • Short videos

    Short videos that are downloaded or shared typically include an image watermark (product logo) and a text watermark (user ID) for copyright protection.

  • Audio and video websites

    Audio and video websites often add brand logos to videos to claim copyright ownership. In variety shows, stickers are also used to add fun or increase ad exposure.

Watermark types

Type

Supported formats

Description

Image

  • Static image: PNG

  • Animated image: GIF, APNG, MOV

  • In the ApsaraVideo VOD console, you can create watermark templates for watermarks in PNG and GIF formats. By using the API, you can create watermark templates for watermarks in PNG, GIF, APNG, and MOV formats.

  • For animated image watermarks, the file extensions gif, apng, and mov must be in lowercase. This limitation does not apply to static images.

  • The watermark image must be stored in the same storage bucket as the video you want to watermark. For example, if a video is stored in an ApsaraVideo VOD storage bucket in the China (Shanghai) region, the watermark file must also be stored in the same bucket. Watermarks cannot be used across regions or storage buckets. For more information, see Storage management.

  • You can set the display duration of an image watermark to show it throughout the video or only for a specific period.

Text

-

You can configure text properties such as font, font size, color, transparency, and stroke effects.

Billing

Video watermarking uses transcoding, which incurs transcoding fees. For more information, see Media transcoding billing.

How to use

Step 1: Create a watermark template

To simplify watermarking, ApsaraVideo VOD provides watermark templates. A watermark template lets you configure parameters such as watermark position, size, and text font and color. Each watermark template is identified by a unique ID.

Console

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Watermarks.

  3. Click Create Watermark. You can configure an image or text watermark as needed.

    Image watermark

    Parameter

    Description

    Watermark Type

    Select Image.

    Image

    Upload a watermark image.

    Note

    The console supports only PNG and GIF formats. The image size cannot exceed 20 MB.

    Watermark Name

    Enter a name for the watermark template.

    Note

    The name can contain Chinese and English characters, numbers, #, and -.

    Size (Width × Height)

    The size of the watermark image. For more information, see Details about watermark position and size parameters.

    • A positive integer in pixels. Valid values: [8, 4096].

    • A percentage of the video dimensions. Unit: %. Valid values: (0, 100). The value can be accurate to two decimal places.

    Note

    If you specify only the width or height of the watermark image, the other dimension is scaled proportionally based on the original aspect ratio of the image.

    Position

    The position of the watermark's reference point relative to the output video. Default value: Upper-right. For more information, see Details about watermark position and size parameters. Valid values:

    • Upper-left

    • Lower-left

    • Upper-right

    • Lower-right

    Horizontal Shift

    The horizontal offset of the watermark on the output video. For more information, see Details about watermark position and size parameters.

    • A positive integer in pixels. Valid values: [8, 4096].

    • A percentage of the video dimensions. Unit: %. Valid values: (0, 100). The value can be accurate to two decimal places.

    Vertical Shift

    The vertical offset of the watermark on the output video. For more information, see Details about watermark position and size parameters.

    • A positive integer in pixels. Valid values: [8, 4096].

    • A percentage of the video dimensions. Unit: %. Valid values: (0, 100). The value can be accurate to two decimal places.

    Timeline

    The timeline settings control the start time and duration of the image watermark. You can use multiple watermark configurations to create dynamic effects.

    Note

    This parameter is not supported for text watermarks.

    Preview Screen Size (Width × Height)

    Enter the dimensions of your actual video to preview the position and effect of the watermark. Unit: pixels.

    Text watermark

    Parameter

    Description

    Watermark Type

    Select Text.

    Watermark Content

    Enter the text that you want to use as the watermark.

    Watermark Name

    Enter a name for the watermark template.

    Note

    The name can contain letters, digits, #, and -.

    Font

    The font of the watermark text. Valid values:

    • SimSun

    • WenQuanYi Zen Hei

    • WenQuanYi Zen Hei Mono

    • WenQuanYi Zen Hei Sharp

    • Yuanti SC

    Font Size

    The font size of the watermark text, in pixels.

    Transparency

    The transparency of the watermark text. A smaller value indicates greater transparency. The value can be accurate to two decimal places. Valid values: (0, 1].

    Font Color

    Set the color of the watermark text.

    Stroke Width

    The stroke width of the font, in pixels. Valid values: (0, 4096].

    Stroke Color

    Set the stroke color of the font.

    Vertical Shift

    The vertical offset of the watermark text on the output video. For more information, see Details about watermark position and size parameters.

    A positive integer in pixels. Valid values: [8, 4096].

    Horizontal Shift

    The horizontal offset of the watermark text on the output video. For more information, see Details about watermark position and size parameters.

    A positive integer in pixels. Valid values: [8, 4096].

    Preview Screen Size

    Enter the dimensions of your actual video to preview the position and effect of the watermark text. Unit: pixels.

  4. Click Save.

    Once created, the watermark template and its ID are visible on the Watermarks page.

API

Call the AddWatermark operation to create a watermark template. The ID of the watermark template is returned after the template is created.

Note

When you use the API to create an image watermark template, you must first call the CreateUploadAttachedMedia operation to upload the watermark image to ApsaraVideo VOD. For more information about how to upload files, see Upload media files by using the ApsaraVideo VOD API.

Position and size

  • Image watermarks

    You can use the ReferPos, Dx, Dy, Width, and Height parameters to control the image's position and size on the output video.

    API parameter

    Console parameter

    Description

    ReferPos

    Position

    The reference point of the watermark relative to the output video.

    • Top-left corner: TopLeft

    • Bottom-left corner: BottomLeft

    • Top-right corner: TopRight

    • Bottom-right corner: BottomRight

    Dx

    Horizontal Shift

    The horizontal offset of the watermark on the output video. Valid values:

    • A positive integer in pixels. Valid values: [8, 4096].

    • A decimal that represents a percentage of the video width. Valid values: (0, 1).

    Dy

    Vertical Shift

    The vertical offset of the watermark on the output video. Valid values:

    • A positive integer in pixels. Valid values: [8, 4096].

    • A decimal that represents a percentage of the video height. Valid values: (0, 1).

    Width

    Size (Width)

    The width of the watermark on the output video. Valid values:

    • A positive integer in pixels. Valid values: [8, 4096].

    • A decimal that represents a percentage of the video width. Valid values: (0, 1).

    Height

    Size (Height)

    The height of the watermark on the output video. Valid values:

    • A positive integer in pixels. Valid values: [8, 4096].

    • A decimal that represents a percentage of the video height. Valid values: (0, 1).

    Timeline

    Timeline

    The timeline settings control the start time and duration of the image watermark. You can use multiple watermark configurations to create dynamic effects. For more information, see Watermark timeline.

    Important

    This parameter is not supported for text watermarks.

    Diagram

    To center a watermark, you can set the Dx and Dy parameters to 0.5. This sets the offset to 50% of the output video's width and height.图片水印位置

  • Text watermarks

    A text watermark's position is relative to the top-left corner of the output video. The offset is defined by the Top and Left parameters. These parameters only accept pixel values and do not support percentage-based values.

    API parameter

    Console parameter

    Description

    Top

    Vertical Shift

    The distance from the top edge of the output video to the text watermark. Unit: pixels. Valid values: [8, 4096].

    Left

    Horizontal Shift

    The distance from the left edge of the output video to the text watermark. Unit: pixels. Valid values: [8, 4096].

    Diagram文字水印

  • Calculation methods

    For image watermarks, the Dx, Dy, Width, and Height parameters can be specified as positive integers (pixels) or decimals (percentages). For text watermarks, the Top and Left parameters only accept positive integers.

    • Positive integers: Values are in pixels. Valid values: [8, 4096].

      Important

      If the specified parameter values exceed the dimensions of the output video, the watermark may be partially or completely hidden.

      For example, if the output video resolution is 640×360, the reference position is TopLeft, Dx is 4000, and Dy is 4000, the watermark is not visible on the output video. This also applies to text watermarks.

    • Percentage: A value relative to the width or height of the output video resolution. The value must be a decimal in the range of (0, 1) with up to four decimal places.

      Important

      If the aspect ratio of the output video is variable or unpredictable, we recommend that you set the watermark position and size parameters by using percentages.

      Example: 0.9999. Calculation example: Width / Video Width = 0.1, Height / Video Height = 0.06, Dx / Video Width = 0.02, and Dy / Video Height = 0.03.

  • Default values

    • If you omit the width and height, the watermark width defaults to 12% of the output video's width, and the height is scaled proportionally based on the aspect ratio of the original watermark image.

    • If you specify only the width or height: The specified dimension is used, and the other dimension is scaled proportionally based on the aspect ratio of the original watermark image. For example, if you set Width to 44 and the original aspect ratio is 2:1, Height will be 22.

    • If you specify both the width and height: The watermark dimensions are set to the specified values.

    • If you do not specify Dx and Dy, the default value is 0.

Step 2: Create and associate a transcoding template group

Video watermarking is implemented through transcoding. Transcoding tasks are initiated based on transcoding template groups. You can associate multiple watermark templates with a single transcoding template.

Console

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. Click Create Transcoding Template Group.

  4. Set a name for the transcoding template group.

  5. In the Regular Transcoding Template or Packaging Template section, click Add Template, configure the transcoding parameters, and enable watermarking.

    • Watermark Template: Select one or more watermark templates that you created in Step 1.

    • Leave other parameters at their default values or change them based on your business needs. For more information about the parameters and configuration suggestions, see Transcoding templates.

  6. Click Save to create the transcoding template group.

    After the transcoding template group is created, you can view the group and its ID on the Transcoding Template Groups page.

API

Call the CreateTranscodeTemplateGroup API to create a transcoding template group. In the TranscodeTemplateList parameter, pass the watermark template ID in the WatermarkIds parameter to associate the watermark template.

Step 3 (Optional): Create and associate a workflow

You can arrange various media processing tasks, such as transcoding, content review, and snapshotting, into a workflow. When you trigger the workflow during media upload or processing, the media files are automatically processed according to the defined tasks. You can create workflows only in the console. For more information, see Workflows.

Console

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Workflows.

  3. Click Add Workflow.

  4. Enter a name for the workflow.

  5. Add or edit nodes in the workflow topology.

    For example, to add a Transcode node, at the Start node, click + and select Transcode . Click the edit button of the Transcode node, customize the Node Name as needed, and set Transcoding Template Groups to the transcoding template group that you created in Step 2 and associated with a watermark template.

  6. Click OK to create the workflow.

    After the workflow is created, you can view the workflow and its ID on the Workflows page.

Step 4 (Optional): Configure event notifications

We recommend configuring event notifications for ApsaraVideo VOD before you start a transcoding task. This allows you to receive callback messages with the task's status and results. For information about how to configure event notifications, see Event notifications.

The following are the event notification types related to transcoding:

Step 5: Start a watermarking task

You can trigger transcoding in ApsaraVideo VOD during media upload or processing. You can start transcoding by using a transcoding template group or a workflow that contains a media transcoding node.

Console

Scenario 1: Automatically trigger a watermarking task during upload

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. Click Upload Audio/Video, click Add Audio/Video, select parameters such as the upload method and storage address, and then select Use Transcoding Template Group and specify the transcoding template group with watermarking enabled that you created in Step 2. Alternatively, select Use Workflow and specify the workflow with a watermarking-enabled transcoding node that you created in Step 3.

    For more information about supported formats and parameter descriptions for uploads, see Upload files by using the ApsaraVideo VOD console.

  4. Add the videos to be uploaded and click Upload.

    After the videos are uploaded, they are automatically transcoded based on the transcoding template group or workflow you specified.

Scenario 2: Manually trigger a watermarking task for an uploaded video

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. On the Audio/Video page, find the video for which you want to start transcoding and click Processing in the Actions column.

  4. Select Use Transcoding Template Group and specify the transcoding template group with watermarking enabled that you created in Step 2. Alternatively, select Use Workflow and specify the workflow with a watermarking-enabled transcoding node that you created in Step 3.

  5. Click OK.

API

Scenario 1: Automatically trigger a watermarking task during upload

Note

The CreateUploadVideo operation only obtains an upload URL, credentials, and basic media asset information. It does not upload the file itself; you must implement the upload logic. For a complete example of how to upload a file by using an API, see Upload media files by using the ApsaraVideo VOD API.

When you call the Get audio/video upload address and credentials or batch pull and upload from URL API to upload an audio/video file, set the TemplateGroupId parameter to the ID of the transcoding template group with image and text watermarks enabled that you created in Step 2, or set the WorkflowId parameter to the ID of the workflow that contains a media transcoding node with image and text watermarks enabled that you created in Step 3. After the audio/video file is uploaded, the VOD system automatically transcodes the file based on the specified transcoding template group or workflow.

Scenario 2: Manually trigger a watermarking task for an uploaded video

  • Initiate transcoding by using a transcoding template group: Call the Submit a media transcoding job API and set the TemplateGroupId parameter to the ID of the transcoding template group that was created in Step 2 and has image-text watermarking enabled.

  • To initiate a transcoding job by using a workflow, call the Submit a VOD workflow job API and set the WorkflowId parameter to the ID of the workflow from Step 3 that contains a media transcoding node with image and text watermarks enabled.

Step 6: View the results

Receive asynchronous notifications

If you have configured event notifications, you can obtain information about the watermarking and transcoding task by receiving callback messages for StreamTranscodeComplete or TranscodeComplete.

Perform synchronous queries

Use the console

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. On the Audio/Video page, view the Status of the target video.

    If the video Status is Normal, the watermarking and transcoding task is successfully completed.

  4. Click Manage in the row where the video is located to go to the basic information page.

  5. Click the Video URL tab. On this tab, you can view the transcoded streams of the video and obtain their playback URLs.

Use the API

You can check the execution status and results of a transcoding task by polling with the task ID. Use the following operations for this purpose:

Usage examples

This section describes how to configure watermarks for common use cases by using the capabilities of ApsaraVideo VOD to set multiple watermarks and dynamically replace watermark content by using the API.

Dynamic text watermarks

Scenario

In short video applications, when users download or share another user's video, it usually includes the logo of the short video platform and the ID or nickname of the original creator.

Expected result

An image watermark and a text watermark are added. The content of the text watermark is different for each user.

文字水印特效

Procedure

  1. Create two watermark templates: one image watermark template with the short video platform's logo as the watermark image, and one text watermark template with the original creator's ID or nickname as the watermark text. For more information, see Step 1: Create a watermark template.

  2. Create a transcoding template group and associate the two watermark templates created in the previous step. For more information, see Step 2: Create and associate a transcoding template group.

  3. You can override the text content of a specified watermark template by calling the Submit Media Transcoding Job API and passing the WatermarkId and Content in the OverrideParams parameter.

    • Example of passing parameters for OverrideParams: {"Watermarks":[{"WatermarkId":"The template ID of the image watermark"},{"WatermarkId":"The template ID of the text watermark","Content":"The text content of the watermark"}]}

    • You need to design the trigger logic for transcoding tasks based on your business requirements. For example, you can trigger transcoding when a user uploads a video and automatically replace the text watermark content with the original creator's ID or nickname.

Dynamic image watermarks

Scenario

A video website obtains the master copyright for a movie or TV show and then sub-licenses it to other video websites. In this scenario, videos distributed on each website must display that website's brand logo.

Expected result

An image watermark is used, and it is different for each video website.

水印

Procedure

  1. Call the CreateUploadAttachedMedia operation to upload the watermark images (the brand logos of each video website) to ApsaraVideo VOD. For more information about how to upload files, see Upload media files by using the ApsaraVideo VOD API.

  2. Create an image watermark template and set the brand logo of the video website as the watermark image. For more information, see Step 1: Create a watermark template.

  3. Create a transcoding template group and associate the image watermark template created in the previous step. For more information, see Step 2: Create and associate a transcoding template group.

  4. By calling the Submit Media Transcoding Jobs API and passing the WatermarkId and FileUrl in the OverrideParams parameter, you can override the watermark image of a specified watermark template.

    • OverrideParams parameter example: {"Watermarks":{"WatermarkId":"Replace with the ID of the image watermark template","FileUrl":"Replace with the URL of the replacement watermark image"}}

    • You need to design the trigger logic for transcoding tasks based on your business requirements. For example, you can trigger transcoding when a video is uploaded.

SDK examples

FAQ

"Invalid image URL" error when adding watermarks

If you have configured an accelerated domain name in ApsaraVideo VOD, you must configure an SSL certificate for the domain name. For more information, see Enable HTTPS secure acceleration.

Related documents

  • ApsaraVideo VOD also supports digital watermarks, which are invisible identifiers embedded into video content. Because they are imperceptible to the human eye and specially encoded to resist tampering, digital watermarks are a secure and reliable tool for copyright protection and piracy tracking. For more information, see Digital watermark.

  • To display a user's nickname or ID in real time during playback as a deterrent to infringement, use the marquee feature of the ApsaraVideo Player SDK. For more information, see Official components.