All Products
Search
Document Center

Video watermark

Last Updated: Jul 11, 2019

Overview

You can add images or text to video streams as watermarks during video encoding and decoding to generate new video files with watermarks. Generally, you can add identification information such as enterprise logos, brand logos, TV station logos, user IDs, and nicknames as watermarks for video copyright declaration or brand promotion.

Instructions

  1. Add and manage watermarks. For more information, see Watermark management.
  2. Set the default watermark. For more information, see Watermark management.
  3. Create a transcoding template and select the Watermark option. For more information, see Transcoding settings.
  4. Use the watermark-enabled transcoding template you just created to upload videos. For more information, see Upload videos.

Note:

  • For more information about how to associate a transcoding template with multiple watermarks, see AddTranscodeTemplateGroup.
  • If the definition is set to Original in a transcoding template, you cannot select the Watermark option. That is, you cannot add watermarks to video streams transcoded by this template.

Watermark management

Currently, ApsaraVideo for VOD allows you to manage watermarks by using the console or API.

Use the console

The ApsaraVideo for VOD console supports watermark management. For more information, see Watermark management.

Note:

  • Currently, the ApsaraVideo for VOD console does not support text watermarks. You can call the AddWatermark operation to add text watermarks.
  • Currently, the ApsaraVideo for VOD console does not allow you to upload animated image watermarks in MOV or APNG format. You can call the AddWatermark operation to add such watermarks.

Use the API

You can add a watermark in the following steps:

    1. Call the CreateUploadAttachedMedia operation to obtain the file upload URL and temporary authorization.
    1. Use OSS to upload the specified watermark file. For more information, see OSS file upload.
    1. Call the AddWatermark operation to add the watermark.

For more information, see watermark management operations.

Watermark types

Currently, ApsaraVideo for VOD supports static image watermarks, animated image watermarks, and text watermarks. All these watermarks are applicable to video copyright declaration or brand promotion. Text watermarks can also be used for dynamic text overriding in short videos. For more information, see SubmitTranscodeJobs.

Static image watermark

Currently, only PNG images can be used as static image watermarks. You can display a static image watermark in the specified position throughout a video or in the specified time period by specifying the start and end time.

Animated image watermark

Currently, only GIF and APNG images and MOV videos can be used as animated image watermarks. You can display an animated image watermark in the specified position throughout a video or in the specified time period by specifying the start and end time.

Note:

  • The file name extensions of animated image watermarks must be in lower case (.gif, .apng, and .mov). The file name extensions of static image watermarks are case-insensitive (.png or .PNG).
  • Watermarks and videos to which the watermarks are added must be stored in the same origin. For example, videos stored in China (Shanghai) can use only watermarks stored in China (Shanghai). Videos cannot use watermarks stored in another region or origin. For more information about the storage origin, see Storage management.

Text watermark

You can add one or more pieces of text as watermarks to videos. Currently, you can set font effects such as the font type, size, color, transparency, and border, and add different text content to different videos. For more information, see SubmitTranscodeJobs.

Note: Currently, you can manage animated image watermarks in MOV and APNG formats and text watermarks only by using watermark management operations. For more information, see watermark management operations.

Watermark position parameters

Watermark position parameters are used to set the position and size of a watermark on the output video image. You can set watermark position parameters by using the ApsaraVideo for VOD console or watermark management operations. This section describes only some of the watermark position parameters. For more information, see watermark management operations.

Image watermark

You can use ReferPos, Dx, Dy, Width, and Height to set the position and size of an image watermark on the output video image.

ReferPos

The approximate position of the watermark relative to the output video image.

  • TopLeft: the upper-left corner.
  • BottomLeft: the lower-left corner.
  • TopRight: the upper-right corner.
  • BottomRight: the lower-right corner.

Dx

The horizontal offset of the watermark on the output video image. For more information about the parameter value, see Calculation method.

Dy

The vertical offset of the watermark on the output video image. For more information about the parameter value, see Calculation method.

Width

The width of the watermark on the output video image. For more information about the parameter value, see Calculation method.

Height

The height of the watermark on the output video image. For more information about the parameter value, see Calculation method.

Schematic diagram

Note: To center a watermark on the output video image, you can set both Dx and Dy to 0.5. (A value of 0.5 indicates that the horizontal or vertical offset of the watermark is 50% of the video width or height.)

Image watermark position

Text watermark

Currently, you can set the position of a text watermark on the output video image only by setting Top and Left. The two parameters indicate the offset of the watermark relative to the upper-left corner of the output video image. Currently, the two parameters can be set only to positive integers that indicate the number of pixels. You cannot set them to decimal fractions that indicate a proportion to the video width or height.

Top

The distance between the upper-left corner of the watermark and the upper side of the output video image. For more information about the parameter value, see Positive integer value type in Calculation method.

Left

The distance between the upper-left corner of the watermark and the left side of the output video image. For more information about the parameter value, see Positive integer value type in Calculation method.

Schematic diagram

Image watermark position

Calculation method

The Dx, Dy, Width, and Height parameters of an image watermark support two value types. The Top and Left parameters of a text watermark support only one value type, that is, the positive integer value type. This section describes the value types.

  • Positive integer value type:Unit: pixels. Valid values: [8,4096].

    Note: If the parameter value exceeds the video width or height, the watermark may be displayed incompletely or even not displayed. For example, if the video resolution is 640 × 360, ReferPos is set to TopLeft, and Dx and Dy are set to 4000, the watermark is invisible in the video. This note applies to both image and text watermarks.

  • Image proportion value type:A value of this type indicates a proportion to the video width or height. Valid values: (0, 1). The value is precise to four decimal places, for example, 0.9999.For example, you can set Width, Height, Dx, and Dy to 0.1, 0.06, 0.02, and 0.03 respectively for an image watermark. The width of the watermark is 10% of the video width. The height of the watermark is 6% of the video height. The horizontal offset of the watermark is 2% of the video width. The vertical offset of the watermark is 3% of the video height.

    Note: If the aspect ratio of the output video image constantly changes, we recommend that you set the position and size parameters of the watermark to image proportion values.

  • Default values:

    • If neither Width nor Height is set, Width is the video width multiplied by 0.12, and Height is calculated according to the aspect ratio of the input video.
    • If only one of Width and Height is set, the parameter that is set uses the specified value, and the other parameter is calculated according to the aspect ratio of the input video. For example, if Width is set to 44 and the aspect ratio of the input video is 2:1, Height is 22.
    • If both Width and Height are set, they use the specified values.
    • If neither Dx nor Dy is set, they use the default value 0.

Common scenario

Dynamic text watermark overriding

Users often add image watermarks (usually product logos) and text watermarks (for example, video creators’ IDs or nicknames) to their short videos for copyright declaration. Different users have different IDs and nicknames. Therefore, ApsaraVideo for VOD needs to add different text content as watermarks when transcoding videos uploaded by different users. After a transcoding template is associated with multiple watermarks, ApsaraVideo for VOD allows you to submit a transcoding task by using the API and override the content of text watermarks. For more information, see SubmitTranscodeJobs.

Effect example

Each video contains an image watermark and a text watermark. The content of the text watermark varies according to the user.Text watermark effect

Implementation

For more information, see the Java SDK demo of SubmitTranscodeJobs.