Socket
Socket
Sign inDemoInstall

virtual-bg

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    virtual-bg

Easily add virtual background effects to your video/camera input inside any web browser


Version published
Maintainers
1
Created

Readme

Source

Easily add virtual background effects to your video/camera input inside any web browser

Try a working background blur demo here
npm install virtual-bg

A simple example to blur background camera stream:

index.html
<div  id="app">
    <video autoplay="true" id="inputVideoElement"></video>
    <canvas id="output_canvas" width="1280px" height="720px"></canvas>
</div>
index.js
import { segmentBackground, applyBlur } from 'virtual-bg';

const inputVideoElement = document.querySelector('#inputVideoElement');
const outputCanvasElement = document.querySelector('#output_canvas');

let myStream = await navigator.mediaDevices.getUserMedia({
      video: true
});

inputVideoElement.srcObject = myStream;

// segments foreground & background
segmentBackground(inputVideoElement, outputCanvasElement);  

// applies a blur intensity of 7px to the background 
applyBlur(7); 



Note: This library is using mediapipe's selfie segmentation model and and library as a base.

I'll be adding more features like image, video backgrounds and more in the future. Stay updated.

For any doubts, please contact me at contact@akhilrana.com or start a issue/discussion at https://github.com/akhil-rana/virtual-BG-demo

FAQs

Last updated on 27 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc