The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →To create a virtual background with BodyPix, capture webcam video in an HTML <video> element, run person segmentation on each frame, then draw the segmented person over a replacement scene in a <canvas>. BodyPix identifies foreground pixels; your JavaScript still has to composite them with the new background. The result can be used as a browser preview, but these sources do not establish a universal browser-support matrix or guarantee a particular frame rate.
How the virtual-background pipeline works
The effect has four parts: camera capture, model inference, mask creation, and compositing. The camera supplies frames; BodyPix estimates which pixels belong to people; rendering code uses that estimate to show the person while hiding or replacing the original scene.
- Capture: Request camera access and display the stream in a video element.
- Segment: Load TensorFlow.js, register a backend, create the BodyPix segmenter, and pass it the current video frame.
- Make a mask: Convert the segmentation result into a mask that keeps the person and makes the original background transparent.
- Composite: Draw a replacement image or other background onto a canvas, then draw the masked camera frame over it.
- Repeat: Process frames at a controlled pace, keeping inference and rendering aligned with the video dimensions.
BodyPix can also return body-part segmentation, but a basic virtual background normally needs only person segmentation. The BodyPix API documentation describes segmentPeople, video-element input, and webcam flip configuration. It does not provide a finished video-call background feature by itself.
Set up the camera and model
Get video into an HTML element
Use the browser’s media APIs to request a camera stream and assign it to a video element. Wait until the video has usable dimensions before calling the model; otherwise, the input may be empty or have a zero-sized frame. Handle camera denial and the absence of a camera in the interface rather than leaving the preview blank.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
The BodyPix documentation establishes that an HTML video element can be passed to the segmentation API, but it is not a full camera-permissions guide. Browser camera access can also depend on the page’s security context and user permission.
Load TensorFlow.js and BodyPix
The documented installation path includes TensorFlow.js core, the converter where required, and a backend such as WebGL, along with the BodyPix package. Load and register the backend before creating the model. Package versions and installation details can change; consult the current BodyPix repository documentation rather than treating older tutorial commands as current.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Call segmentation on video frames
With the current body-segmentation API, the relevant call is segmentPeople(videoElement). If you are following a legacy BodyPix example, use the method and configuration documented for that version; API names and package generations should not be mixed casually. The official BodyPix documentation covers the current wrapper’s supported input types and options.
Run inference in a paced loop and ensure only one asynchronous segmentation call is in flight at a time. If a new call begins before the previous one finishes, work can queue up and increase latency. Schedule the next frame after the current inference and draw step completes, or otherwise explicitly skip frames when the model is busy.
Recommended Free Tools
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Turn the segmentation result into a replacement background
Segmentation produces a description of which pixels belong to a person; it does not automatically erase the scene behind them. The rendering stage must use that result as transparency or as a mask while composing the output.
- Draw the replacement background image into the output canvas at the canvas dimensions.
- Convert the person segmentation into a mask. The newer TensorFlow body-segmentation API includes
toBinaryMaskand drawing utilities such asdrawMask; these accept options including threshold, blur, and opacity. - Apply the mask to the camera frame so background pixels are transparent, then draw the resulting foreground over the replacement image.
- Keep the input frame, mask, and output canvas dimensions consistent. If you scale one independently, edges can misalign or look soft.
For a blurred-background effect, render a blurred copy of the camera frame as the background layer and composite the masked person over it. For a replacement, use an image or another canvas-rendered scene as that layer. TensorFlow’s 2022 body-segmentation overview describes mask conversion and drawing utilities; the page’s compositing code remains responsible for arranging the layers.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Keep selfie mirroring consistent
If the preview is mirrored with CSS, account for that choice when configuring segmentation. BodyPix exposes a flipHorizontal option for webcam use. Applying both a CSS mirror and model-side flipping without coordinating them can make the output orientation wrong; check the preview and mask together.
Choose settings for the device and framing
There is no universal best configuration. The official BodyPix demo identifies internal resolution, output stride, and model as major accuracy-versus-speed controls. In general, higher internal resolution and a larger model favor more accurate masks at a speed cost. Tune on the device and camera framing you expect people to use.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
| Choice | Likely benefit | Trade-off or qualification |
|---|---|---|
| Higher internal resolution | Can improve segmentation accuracy. | Reduces speed; the effect depends on the device and workload. |
| Larger model | Tends toward higher accuracy. | Tends toward lower speed. |
| Higher mask threshold | Can make the mask more selective. | May omit true person pixels; threshold behavior is described in the archived BodyPix API documentation. |
| Separate multiple people | Provides individual person segmentation. | Can be slower than treating people as one foreground, according to the archived BodyPix documentation. |
Measure the whole pipeline—inference, mask generation, and canvas drawing—not just model inference. A fast inference result does not establish the frame rate of the finished page.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When to consider a newer segmentation model
BodyPix is appropriate when the goal is specifically to build with BodyPix or to learn the segmentation-and-compositing pipeline. For a new webcam effect, TensorFlow’s January 31, 2022 comparison also described Selfie Segmentation for close video-call framing, with the person less than two metres from the camera, and BlazePose GHUM for full-body views at greater distances. The authors reported that the newer models offered higher frame rate and fidelity across devices than BodyPix at the time of that release; this is a dated comparison, not a current benchmark guarantee. See the TensorFlow body-segmentation article for its context and model details.
The article reported benchmark figures for a listed 2019 MacBook Pro: MediaPipe Selfie Segmentation at 125 FPS for the landscape variant and 130 FPS for the general variant; TensorFlow.js WebGL at 74 FPS and 45 FPS, respectively. Those are measurements from TensorFlow’s 2022 article, not expected rates for a BodyPix page today. The article notes that its timing waits for GPU or CPU synchronization and that a production pipeline that remains on the GPU may achieve higher figures. They are not end-to-end browser compositing rates.
TensorFlow’s older platform and environment guide lists historical BodyPix measurements of 77 ms, 188.4 ms, and 2683 ms, alongside a 4.6 MB figure. The guide identifies the measurements as TensorFlow.js 1.5.2 on a 2018 MacBook Pro and associates the timings with WebGL, WASM, and CPU. These old figures illustrate how strongly runtime can depend on backend; they should not be used as current performance expectations.
Troubleshoot a slow or inaccurate preview
- The page feels laggy: Reduce internal resolution or try a smaller model, then compare the complete render loop on the target device. Backend and hardware affect results, so one machine’s timing does not predict another’s.
- The person appears incorrectly mirrored: Check the CSS transform and
flipHorizontalsetting together. - The replacement image does not line up with the person: Confirm the video, mask, and canvas use compatible dimensions and that resizing is applied consistently.
- Edges look incomplete or unstable: Test the intended lighting, movement, and occlusion conditions, then adjust resolution and threshold. The cited documentation describes parameter trade-offs, not guaranteed cutout quality for every scene.
- No camera picture appears: Check that a camera exists, the user granted permission, and the browser permits camera access for the page’s security context. The BodyPix references do not establish a cross-browser support matrix.
What BodyPix does not guarantee
The cited documentation establishes the model’s video input and segmentation capabilities, but does not establish a current formal browser/device support matrix, a production privacy guarantee, or a guaranteed real-time frame rate. It also does not promise flawless boundaries in every lighting, motion, hair, or occlusion condition. Treat those as conditions to test in the intended deployment rather than assume a perfect cutout.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

