I don't get speech avatar with a custom background

Ayyoub ESSADEQ 20 Reputation points
2024-01-22T15:16:39.9066667+00:00

I'm attempting to obtain the speech avatar with a black background; however, the one I receive consistently comes with a white background. I've already configured the background color of the avatar to be black in the avatarConfig.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,070 questions
{count} votes

Accepted answer
  1. navba-MSFT 27,550 Reputation points Microsoft Employee Moderator
    2024-01-24T05:38:04.92+00:00

    @Ayyoub ESSADEQ Thanks for getting back. To answer to your question:

    Could you please clarify whether real-time synthesis supports customization for the background, allowing either a solid color or a transparent one?

    The avatar real-time synthesis API currently supports setting a solid-color background, without transparent background support. However, there's an alternative way to implement background customization on the client side, following these guidelines:

    • Set the background color to green (for ease of matting), which the avatar real-time synthesis API supports.
    • Create a canvas element with the same size as the avatar video.
    • Capture each frame of the avatar video and apply a pixel-by-pixel calculation to set the green pixel to transparent, and draw the recalculated frame to the canvas.
    • Hide the original video.

    With this approach, you can get an animated canvas that plays like a video, which has a transparent background. Here's the sample code to demonstrate such an approach. After you have a transparent-background avatar, you can set the background to any image or video by placing the image or video behind the canvas. More info ***here.



    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.*

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.