Overview
Basic Concepts
Quick Start
Domain Management
Origin Settings
Media Processing
Before You Start
How to Use
Transcoding
Transmuxing
Video Encryption
Intelligent Transcoding
Editing
Video/Audio Splicing
Video/Audio Trimming
Video Cropping
Screenshot
Add Subtitles
Add Watermarks
Appendix
Cache Settings
Cache Purge and Prefetch
HTTP/HTTPS Settings
Access Control
Advanced Settings
Logs and Reports
Tutorials
Content Protection

Add Watermarks

Last update:2025-03-21 15:32:57

Watermarks serve as an effective form of copyright protection for your video content. CDNetworks supports the addition of visible watermarks to videos, helping protect against unauthorized use. Our platform supports four distinct types of watermarks:

  1. Image Watermarks: Insert static images with adaptive scaling that adjusts proportionally with video resolution changes
  2. Video Watermarks: Embed video clips as overlays, ideal for inserting animated logos or advertisements
  3. Text Watermarks: Add text captions or copyright notices
  4. Dynamic Watermarks: Create watermarks that change position at specified intervals or timestamps

CDNetworks supports watermarking for numerous video formats and codecs, including MP4, FLV, M3U8, TS, MKV, MOV, WMV, AVI, VP8, VP9, RealVideo, Windows Media Video, H.265, H.264, H.263, MPEG, and more.

How to Use

Structure your fops command in the request body as follows:

<op>/<Format>
    /wmImage2/<value>
    /wmGravity/<value>
    /wmauto/<value>
    /wmWidth/<value>
    /wmHeight/<value>
    /wmDissolve/<value>
    /wmdx/<value>
    /wmdy/<value>
    /wmInterval/<value>
    /multiConvertTime/<value>
    /wmText/<value>
    /wmFont/<value>
    /wmFontColor/<value>
    /wmFontSize/<value>
    /wmFontDissolve/<value>
    /wmFontBorderWidth/<value>
    /wmFontBorderColor/<value>
    /wmTextGravity/<value>
    /wmtextdx/<value>
    /wmtextdy/<value>
    /wmTextInterval/<value>
    /wmFontBold/<value>
    |saveas/<Urlsafe_Base64_Encode(bucket:filekey)>

Common Parameters

Parameter Required Description
op Yes Operation type. Use avthumb for watermarking operations.
format Yes Target output format (flv, mp4, m3u8, etc.)
saveas No Output location as URL-safe Base64-encoded string: Urlsafe_Base64_Encode(bucket:savedfilename)

Image and Video Watermark Parameters

Parameter Required Description
wmImage2 No The image or video to use as watermark.

Format: URL-safe Base64 encoded <bucket>:<path>
Example: test:1.jpgdGVzdDoxLmpwZw==

Multiple Watermarks: Use comma separation
Example: Url-Safe-Base64-Encode(test:1.jpg),Url-Safe-Base64-Encode(test:2.jpg)

Tip: For video watermarks, shorter clips work best to maintain synchronization with the main video.
wmGravity No Watermark placement position (see wmGravity Parameters table).

Tip: For branding, BOTTOM_RIGHT is commonly used as it’s less intrusive to viewing experience.
wmauto No Adaptive scaling of watermarks:
1 - Scale watermarks proportionally with video resolution changes
0 (default) - Maintain original watermark size

Example: If original video is 1200×600 with 40×40 watermark, when transcoded to 300×200, the watermark will scale to 10×10 with wmauto/1.

Tip: Enable adaptive scaling with wmauto/1 when videos may be viewed across different device sizes.
wmWidth No Watermark width as pixels or percentage:
• Specific value: wmWidth/40 for 40 pixels width
• Percentage: wmWidth/50% for half of video width
• Value ≤ 0: Width adapts based on aspect ratio

Tip: Using percentages rather than fixed pixel values ensures proper scaling across different video resolutions.
wmHeight No Watermark height as pixels or percentage:
• Specific value: wmHeight/60 for 60 pixels height
• Percentage: wmHeight/20% for one-fifth of video height
• Value ≤ 0: Height adapts based on aspect ratio

When both wmWidth and wmHeight are ≤ 0, original watermark size is used.

Tip: For logo watermarks, typically 10-15% of video height provides good visibility without being obtrusive.
wmDissolve No Watermark transparency (1-100):
100 - Fully opaque (default)
1 - Nearly transparent
• Values outside range are adjusted automatically

Tip: Values between 70-85 often provide good visibility while minimizing distraction from main content.
wmdx No Horizontal offset relative to wmGravity position:
• Positive value: Shift right
• Negative value: Shift left

Must be used with wmGravity with matching parameter count.

Tip: Small offsets (10-20 pixels) from corners can improve aesthetics and prevent watermarks from being cropped on some displays.
wmdy No Vertical offset relative to wmGravity position:
• Positive value: Shift up
• Negative value: Shift down

Must be used with wmGravity with matching parameter count.

Tip: Similar to wmdx, small vertical offsets can improve watermark placement and visibility.
wmInterval No Time interval in seconds between watermark position changes.

Tip: For dynamic watermarks that are meant to prevent unauthorized screen recording, intervals of 15-30 seconds work well.
multiConvertTime No Specific timestamps for watermark changes, comma-separated.
Example: 5,10,20 changes watermark at 5, 10, and 20 seconds.

Cannot be used with wmInterval.

Tip: Align timestamp changes with scene transitions in your video for less disruptive watermark movements.

Text Watermark Parameters

Parameter Required Description
wmText No Text watermark content, URL-safe Base64 encoded.

Multiple Text: Use comma separation
Example: Url-Safe-Base64-Encode(text1),Url-Safe-Base64-Encode(text2)

Important: For Simplified Chinese, ensure UTF-8 encoding to prevent display errors.

Tip: Keep text watermarks brief and clear - company name, website, or copyright notice work well.
wmFont No Font for text watermark, URL-safe Base64 encoded.
Allowed characters: alphanumeric, spaces, and hyphens.

Multiple Fonts: Comma-separate before encoding
Format: <Urlsafe_Base64_Encode(<Font1>,<Font2>…)>

Tip: See the Supported Fonts table for complete list. Sans-serif fonts typically offer better readability for watermarks.
wmFontColor No Text color in RGB format, URL-safe Base64 encoded.
Format: 0xrrggbb or &Hrrggbb (prefixes optional)

Multiple Colors: Comma-separate before encoding
Format: <Urlsafe_Base64_Encode(<Color1>,<Color2>…)>

Tip: White (0xFFFFFF) or light yellow (0xFFFF00) offer good visibility against dark backgrounds. Adding a contrasting border improves legibility.
wmFontSize No Font size as pixels or percentage:
• Pixel value: Absolute height (range: 5-2160)
• Percentage: Relative to video height (range: >0%-100%)
• Default: 6%

Tip: For most videos, 5-8% of video height provides good readability without overwhelming the content.
wmFontDissolve No Text transparency (1-100):
100 - Fully opaque (default)
1 - Nearly transparent
• Values outside range are adjusted automatically

Tip: Same principles as image watermark transparency - 70-85 often works well.
wmFontBorderWidth No Text outline width:
• Value ≤ 0: No outline (default)
• Value > 0: Outline thickness in pixels

Tip: Adding a 1-2 pixel border dramatically improves text readability, especially on varied backgrounds.
wmFontBorderColor No Text outline color, URL-safe Base64 encoded.
Format: Same as wmFontColor
Default: 0x000000 (black)

Tip: For white text, a black border provides maximum readability across varied backgrounds.
wmTextGravity No Text placement position (same format as wmGravity).

For dynamic text watermarks, separate multiple positions with commas.

Tip: Text watermarks are often most effective at the bottom of the frame where they’re less likely to obscure important visual content.
wmtextdx No Horizontal offset for text relative to wmGravity position.
Same principles as wmdx.

Tip: Slightly offset text from the exact edge (10-20 pixels) to avoid being cut off on some displays.
wmtextdy No Vertical offset for text relative to wmGravity position.
Same principles as wmdy.

Tip: When placing at bottom of frame, a small positive offset ensures text doesn’t touch the very bottom edge.
wmTextInterval No Time interval in seconds between text watermark changes.
Must be ≥ 1.

Tip: For copyright notices that change position, intervals of 20-30 seconds are less distracting than frequent movement.
wmFontBold No Bold text formatting:
1 - Bold
0 - Normal (default)

Tip: Bold text improves readability at smaller sizes and on complex backgrounds.

Watermark Position Parameters (wmGravity)

Parameter Description
TOP_LEFT Upper left corner
TOP_CENTER Center of top edge
TOP_RIGHT Upper right corner
CENTER_LEFT Center of left edge
CENTER Exact center of frame
CENTER_RIGHT Center of right edge
BOTTOM_LEFT Bottom left corner
BOTTOM_CENTER Center of bottom edge
BOTTOM_RIGHT Bottom right corner

Examples

Example 1: Dynamic Image Watermark

This example adds an image watermark to test.mp4 with the following behavior:

  • Watermark image: watermark.jpg from the vod-wcs-test001 bucket
  • Positioned initially in the top left corner
  • After 5 seconds, moves to the top right corner, shifted 20 pixels to the left
  • After another 5 seconds, returns to the top left corner
  • Watermark size: 20% of video dimensions

Pseudocode:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mp4/wmImage2/Urlsafe_Base64_Encode(vod-wcs-test001:watermark.jpg) /wmGravity/TOP_LEFT,TOP_RIGHT/wmInterval/5/wmdx/0,-20/wmdy/0,0/wmWidth/20%/wmHeight/20%|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_watermark.mp4))&force=1&separate=1" 
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Actual Request:

curl -v -X POST 
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tcDQvd21JbWFnZTIvZG05a0xYZGpjeTEwWlhOME1EQXhPbmRoZEdWeWJXRnlheTVxY0djPS93bUdyYXZpdHkvVE9QX0xFRlQsVE9QX1JJR0hUL3dtSW50ZXJ2YWwvNS93bWR4LzAsLTIwL3dtZHkvMCwwL3dtV2lkdGgvMjAlL3dtSGVpZ2h0LzIwJXxzYXZlYXMvZG05a0xYZGpjeTEwWlhOME1EQXhPblJsYzNSZmQyRjBaWEp0WVhKckxtMXdOQT09&force=1&separate=1"
-H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Example 2: Video Watermark

This example adds a video watermark to test.mp4:

  • Watermark video: watermark.mp4 from the vod-wcs-test001 bucket
  • Positioned in the top left corner
  • Size: 20% of main video dimensions

Pseudocode:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mp4/wmImage2/Urlsafe_Base64_Encode(vod-wcs-test001:watermark.mp4)/wmGravity/TOP_LEFT/wmWidth/20%/wmHeight/20%|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_video.mp4))&force=1&separate=1"
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Actual Request:

curl -v -X POST 
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tcDQvd21JbWFnZTIvZG05a0xYZGpjeTEwWlhOME1EQXhPbmRoZEdWeWJXRnlheTV0Y0RRPS93bUdyYXZpdHkvVE9QX0xFRlQvd21XaWR0aC8yMCUvd21IZWlnaHQvMjAlfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmZG1sa1pXOHViWEEw&force=1&separate=1"
-H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Example 3: Text Watermark

This example adds a text watermark to test.mp4:

  • Watermark text: “CDNetworks”
  • Font: “Arial Unicode MS”
  • Positioned in the top left corner

Pseudocode:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mp4/wmText/Urlsafe_Base64_Encode(CDNetworks)/wmFont/Urlsafe_Base64_Encode(Arial Unicode MS)/wmTextGravity/TOP_LEFT|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_file.mp4))&force=1&separate=1" 
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Actual Request:

curl -v -X POST 
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tcDQvd21UZXh0L0ppTjROMFkxTVRzbUkzZzFRa0pHT3lZamVEYzVSREU3SmlONE5qSTRNRHNnSmlONE56QkNPVHNtSTNnMk5FRkVPeVlqZURVeVFUQTdKaU40T1RBeFJqcz0vd21Gb250L1FYSnBZV3dnVlc1cFkyOWtaU0JOVXc9PS93bVRleHRHcmF2aXR5L1RPUF9MRUZUfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmWm1sc1pTNXRjRFE9&force=1&separate=1"
-H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Supported Watermark Fonts

Font Family Font Variations
Noto Sans CJK SC Noto Sans CJK SC Regular
Noto Sans CJK SC Black
Noto Sans CJK SC Bold
Noto Sans CJK SC DemiLight
Noto Sans CJK SC Light
Noto Sans CJK SC Medium
Noto Sans CJK SC Thin
Noto Sans Mono CJK SC Noto Sans Mono CJK SC Regular
Noto Sans Mono CJK SC Bold
Noto Serif CJK SC Noto Serif CJK SC
Noto Serif CJK SC Black
Noto Serif CJK SC ExtraLight
Noto Serif CJK SC Light
Noto Serif CJK SC Medium
Noto Serif CJK SC SemiBold
Roboto Roboto
Roboto Condensed
Roboto Condensed Light
Roboto Black
Roboto Light
Roboto Medium
Roboto Thin
WenQuanYi WenQuanYi Zen Hei Mono
WenQuanYi Zen Hei Sharp
WenQuanYi Zen Hei
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!