Nodes/Nodes for use with real-time applications of ComfyUI/Fast Webcam Capture πŸ•’πŸ…‘πŸ…£πŸ…
ComfyUI Node

Fast Webcam Capture πŸ•’πŸ…‘πŸ…£πŸ…

Get a Webcam Frame Straight Into the Graph

By ryanontheinsideΒ·Created 2 years agoΒ·Updated about a year agoΒ· 82
Fast Webcam Capture πŸ•’πŸ…‘πŸ…£πŸ…
  • image
  • IMAGE
β—„width640β–Ί
β—„height480β–Ί
β—„capture_on_queuetrueβ–Ί

Most "real-time" ComfyUI setups involve hauling a camera feed into the machine with ffmpeg, gstreamer, or a custom Python script before it ever touches a node. Fast Webcam Capture skips all of that. It grabs a frame from your webcam in the browser and hands it to the graph as a normal IMAGE tensor, which means a completely vanilla ComfyUI install can be seeing your face within a minute.

The trick is the WEBCAM input type. The pack ships a small JavaScript extension (web/js/webcam.js) that calls navigator.mediaDevices.getUserMedia the first time the node runs, plays a hidden <video> element, and on every queue draws the current frame to a canvas and sends it to Python as a base64 data URL. The Python side decodes that back into a BHWC tensor and out it goes. No IPC, no shared memory, no camera drivers to fight on your server - just the browser you already have open.

The inputs

  • image - the WEBCAM widget. You'll see a live preview in the node; it's what the browser captures, not something you wire from another node.
  • width / height - output resolution. Capture can come in at your camera's native size (often 1280Γ—720 or worse, a portrait phone feed), so set these to what your model actually wants - 512Β² or whatever the rest of your graph is built around.
  • capture_on_queue - when on (default), every execution grabs a fresh frame. Turn it off and the node reuses its last capture, which is handy if you want to lock a frame and iterate on the pipeline.

Output is a single IMAGE. Feed it into hand tracking, motion detection, or an img2img pass - that's the whole loop.

The gotchas that'll bite you

First, the camera lives in the browser, so this only works when the workflow is executed from a browser frontend. A headless API-only execution has no camera to give you. Second, your browser will ask for camera permission - accept it, and note that getUserMedia only works in a secure context, so localhost is fine but a remote HTTP-only box will refuse. Third, there's one webcam stream shared by all FastWebcamCapture nodes, so you can't point two of them at different cameras. That's a real limitation if you wanted a "me" cam and a "scene" cam - you'll need to capture one and mirror it another way.

Install

Part of ryanontheinside/ComfyUI_RealtimeNodes. ComfyUI Manager (search "Control Nodes" or "RealtimeNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RealtimeNodes
cd ComfyUI_RealtimeNodes
pip install -r requirements.txt

Restart ComfyUI, hard-refresh the browser tab (Ctrl/Cmd+Shift+R) so the new JS extension actually loads - a soft refresh sometimes leaves the WEBCAM widget missing. That stale-frontend issue is the most common "why is there no camera here" complaint with this pack.

Categoryimage

Inputs (4)

NameTypeDefaultDescription
imageWEBCAMβ€”
widthINT6400–16384β€”
heightINT4800–16384β€”
capture_on_queueBOOLEANtrueβ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”