Skip to content

Niel Hu  /  Real-Time Inpainting

Real-Time Inpainting

Say a word; the webcam repaints itself before you finish moving.

Workflow on Civitai Demo


Two words, one live feed

The graph above is running on a webcam, not a file. GroundingDinoSAM2Segment takes the word face and produces a mask. CLIPTextEncode takes the word tiger. The inpainting pass fills the first with the second, frame after frame, while the head keeps moving.

Neither word is a preset. They are text boxes with Auto-Update on — type cup in one and steel helmet in the other and the pipeline re-targets without a reload. What is being demonstrated is not a face filter. It is a diffusion graph accepting instructions at the same speed as the video it is altering.

What makes it run

The workflow is ordinary ComfyUI. What makes it live is comfystream — Livepeer's fork of yondonfu's project for running img2img Comfy workflows on video streams.

It works by treating video as a sequence of frames and routing each one through the graph. A workflow exported from ComfyUI needs a single primary input node and a single output node; at runtime comfystream swaps those for tensor-compatible components and drives them over WebRTC. Custom nodes come from the existing ComfyUI install, so the graph does not get rebuilt for streaming — it gets re-hosted.

The two Control Panels in the video are comfystream's UI, exposing chosen node inputs as live fields.