How to create virtual background with the new feature of Amazon Chime SDK “video background replacement”

Introduction

Premise

How to use

const processors = [];
if (await BackgroundReplacementVideoFrameProcessor.isSupported()) {
const image = await fetch("https://pathtoimage.jpeg"); // (1) fetch image for virtual background.
const imageBlob = await image.blob();
const options = { imageBlob };
const replacementProcessor =
await BackgroundReplacementVideoFrameProcessor.create(null, options); // (2) create processor for background replacement.
processors.push(replacementProcessor);
}
let transformDevice = new DefaultVideoTransformDevice(
logger,
device,
processors
); // (3) create virtual device.
meetingSession.audioVideo.chooseVideoInputDevice(transformDevice);
replacementProcessor.setImageBlob(imageBlob);

Demo

$ git clone https://github.com/w-okada/amazon-chime-bg-blur-demo.git -b aws-demo02

CPU Usage

And more

Finally

I am very thirsty!!

Acknowledgements

Disclaimer

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store