Wowza Community

Overlay Image not scaling

https://www.wowza.com/docs/how-to-add-graphic-overlays-to-live-streams-with-wowza-transcoder

Developed wowza module to add overlay in live streaming using above link. Overlay images added into live stream but id didn’t scaled properly.

if (!encoderInfo.destinationVideo.isPassThrough())

{

int destinationHeight = encoderInfo.destinationVideo.getFrameSizeHeight();

scalingFactor = (double)destinationHeight/(double)sourceHeight;

System.out.println(“desination height”+destinationHeight);

System.out.println(“source height”+sourceHeight);

System.out.println(“scaling factor”+scalingFactor);

TranscoderVideoOverlayFrame overlay = new TranscoderVideoOverlayFrame(mainImage.GetWidth(scalingFactor),

mainImage.GetHeight(scalingFactor), mainImage.GetBuffer(scalingFactor));

overlay.setDstX(mainImage.GetxPos(scalingFactor));

overlay.setDstY(mainImage.GetyPos(scalingFactor));

encoderInfo.destinationVideo.addOverlay(overlayIndex, overlay);

//Add padding to the destination video i.e. pinch

encoderInfo.videoPadding[0] = 0; // left

encoderInfo.videoPadding[1] = 0; // top

encoderInfo.videoPadding[2] = 0; // right

encoderInfo.videoPadding[3] = (int)(((double)videoBottomPadding.getStepValue())*scalingFactor); // bottom

encoderInfo.destinationVideo.setPadding(encoderInfo.videoPadding);

}

For scaling above code is used. I tried to print out destination and source height and scaling factor. Scalling factor changes with respect to stream.

But overlay image size remaing same for all streams. But if i add overlay via wowza manager and then view in different stream. Overlay image scaled correctly.

Hi,

For details on overlays and the effects of adding them to the Encode or Decode sections of the transcoding template, please see Transcoder overlay image requirements

Jason

Hello,

If you want to have the overlay image displayed and scaled on all your transcoded outputs, you should add it when decoding the incoming stream.

The overlay can be added during the decode or during the encode.

I assume that using the Wowza Streaming Engine Manager UI you have added the overlay image in the decoding preset tab.

Zoran