Many of our customers ask for guidance on how to place a watermark image into a video. This feature is provided in the Encoding.com API and here we will show how to quickly and easily create a watermark. Please note that the source and output frame sizes need to match. If they do not match, the logo will be distorted.
More -->
Many of our customers ask for guidance on how to place a watermark image into a video. This feature is provided in the Encoding.com API and here we will show how to quickly and easily create a watermark. Please note that the source and output frame sizes need to match. If they do not match, the logo will be distorted.
Creating a source image
Here are two sample images, both created in Photoshop as RGB, then saved in PNG format using an 8-bit color palette. We will show the "best case" design using a gray logo with a black background, and a "worst case" design using a bright red logo. Bright color edges are generally harder to blend into most encoded video, and particularly with red you will see more visual artifacts. (aka "jaggies")
 |
 |
|
"Best case" image with a gray logo and black background, defined in web hex color code as #000000. |
"Worst case" image with a bright red logo and gray background, defined in web hex color code as #808080. |
Sample API tags for black background in blend mode
Code used for the "best case" image, setting a background threshold of #000000 to make the black a transparent mask. <logo_mode> chosen for this demonstration is "0" for blend mode, but you also could use "1" to have an opaque logo.
<format>
<output>mp4</output>
<size>864x360</size> –– output resolution, important for logo placement
<bitrate>1600k</bitrate> –– higher bitrates get better results
<profile>high</profile> –– high profile better than main profile, but longer encode time
<two_pass>yes</two_pass> –– much better quality than single pass
<logo>
<logo_source>http://www.encoding.com/images/KB/prolab200pix.png</logo_source>
<logo_x>630</logo_x> –– horizontal logo offset from top left
<logo_y>230</logo_y> –– vertical logo offset from top left
<logo_mode>0</logo_mode> –– zero value for "blend" translucent mode, one for opaque
<logo_threshold>000000</logo_threshold> –– sets color black to transparent mask
</logo>
</format>

Sample API tags for gray background in blend mode
Code used for the "worst case" image, setting a background threshold of #808080 to make the gray a transparent mask. Note the much rougher edges of the red logo.
<format>
<output>mp4</output>
<size>864x360</size> –– output resolution, important for logo placement
<bitrate>1600k</bitrate> –– higher bitrates get better results
<profile>high</profile> –– high profile better than main profile, but longer encode time
<two_pass>yes</two_pass> –– much better quality than single pass
<logo>
<logo_source>http://www.encoding.com/images/KB/pleasebuy120pix.png</logo_source>
<logo_x>620</logo_x> –– horizontal logo offset from top left
<logo_y>210</logo_y> –– vertical logo offset from top left
<logo_mode>0</logo_mode> –– zero value for "blend" translucent mode, one for opaque
<logo_threshold>808080</logo_threshold> –– sets color gray to transparent mask
</logo>
</format>

<-- Hide