Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 2.79 KB

README.md

File metadata and controls

65 lines (40 loc) · 2.79 KB

Twilio Video Processors

Twilio Video Processors is a collection of video processing tools which can be used with Twilio Video JavaScript SDK to apply transformations and filters to a VideoTrack.

Features

  • Virtual Background
  • Background Blur

Prerequisites

Installation

NPM

Install from a local directory.

# package-folder contains the package.json
npm install /local-path-to-package/package-folder

Using this method, you can import video-processors like so:

import * as VideoProcessors from '@twilio/video-processors';

Script tag

You can also copy video-processors.js from the dist folder and include it directly in your web app using a <script> tag.

<script src="https://my-server-path/video-processors.js"></script>

Using this method, video-processors.js will set a browser global:

const VideoProcessors = Twilio.VideoProcessors;

Assets

In order to achieve the best performance, the VideoProcessors use WebAssembly to run TensorFlow Lite for person segmentation. You need to serve the tflite model and binaries so the SDK can load them properly. These files can be downloaded from the dist/build folder. Check the API docs for details and the examples folder for reference.

Usage

Please check out the following pages for example usage. These processors are only supported on the Chrome browser at this moment and will not work on other browsers. For best performance and accuracy, we recommend that, when calling Video.createLocalVideoTrack, the video capture constraints be set to 24 fps frame rate with 640x480 capture dimensions. Higher resolutions can still be used for increased accuracy, but may degrade performance, resulting in a lower output frame rate.

Known Issues

  • Video Processor execution will result in a significant increase in CPU usage.
  • Precision on segmentation mask can be poor on certain conditions such as uneven lighting and increased body movements.