When using graphic overlay images with Wowza Transcoder, certain requirements must be met so that the overlays are to the highest possible standard. This article outlines these requirements.
- The file format of the overlay images must be GIF, JPEG, PNG, or BMP and must be an RGB type image.
- The overlay image dimensions must measure at least 4 x 4 pixels (width x height).
- The overlay image width and height should be an even number of pixels.
- The overlay image should be positioned at even x and y coordinates on the video.
Overlay image size and positioning
Each frame in the source video is decoded to a YUV-12 format, which is a 2 x 2 pixel format. Because RGB is a 1 x 1 pixel format, the overlay images must also be converted to YUV-12 before the overlay image can be applied. If an overlay image is an odd number of pixels (width and/or height), it's blended on the edges after conversion. If an overlay image is positioned at odd-numbered coordinates on the original video image, then further edge blending will occur on two edges of the overlay image.
An overlay image with an odd number of pixels or that is positioned at odd-numbered coordinates on the original video image may be displayed with a drop shadow to the bottom and right of the image. If it is evenly sized and positioned at even-numbered coordinates, the edges of the image are displayed as they were in the original image.
Overlay image decoding and encoding
Overlay images can be applied to the decoded frames, to the frames that are being encoded, or to both the decoded and encoded frames. Different results are obtained by applying the overlay image at either step in the transcoding process.
If an overlay image is applied to the decoded frames, either by configuring the Overlay section of the Decode block in the transcoder template or by using the Overlay API, it's sized and positioned on the decoded frames before the frames are scaled for encoding. The transcoder does less work using this method as it only has to decode and apply the overlay image once for all decoded renditions. However, the quality of the overlay image may deteriorate when the frames are scaled for encoding. An overlay image that's applied at the decode stage appears on all transcoded renditions.
If an overlay image is applied to the frames before they are encoded, either by configuring the Overlay section in the Encode blocks in the transcoder template or using the Overlay API, each video frame is scaled before the full-sized overlay image is applied. This method normally results in a higher quality overlay image but is also more work for the transcoder to perform as it must decode and apply the images separately for each Encode block. When applying overlay images at the encode stage,different images can be used and they can be positioned at different coordinates on the video for each transcoded rendition.
Using either the transcoder templates or the Overlay API, you can also apply multiple overlay images at both the decode and encode steps and each successive overlay is stacked on top of the previous one. Transparent or semi-transparent sections are blended with the previous layer.