Nodes/ComfyUI-BFSNodes/BFS H3 Select Cast → Picture (Click Video)
ComfyUI Node

BFS H3 Select Cast → Picture (Click Video)

Click the actor in the video, bind them to Picture 3

By alisson-anjos·Created 7 months ago·Updated 2 days ago· 133
BFS H3 Select Cast → Picture (Click Video)
  • images
  • ref_image_1
  • ref_image_2
  • ref_image_3
  • ref_image_4
  • ref_image_5
  • ref_image_6
  • ref_image_7
  • ref_image_8
  • ref_image_9
  • images
  • cast_selection
  • request
  • references
  • selection_status
◄request—►
◄selection_json{}►
◄setup_onlytrue►
◄enabledtrue►

The idea: point at the actual person

Reference-driven video generation has a translation problem. Your prompt says "the woman in <Picture 1>"; the model sees a guide video with three people in it and has to work out which body Picture 1 is supposed to inhabit. When it guesses wrong you get a face swap with the wrong face, or a smear of two identities blended.

BFS H3 Select Cast → Picture (Click Video) solves it with a gesture: it loads the guide into a player, you pick which Picture you're binding, scrub to a frame where the performer is clear, and click them. One key frame per Picture, positive points where the subject is, negative points where they definitely aren't. Those marks become the input for SAM 3.1 tracking, which becomes masks, which become regional attention.

It's the most human-shaped node in this corner of the pack - no JSON to hand-write, no mask editor. But it is a two-pass node, and the first pass is designed to stop the graph.

setup_only, the two-pass pattern

setup_only defaults to true. Queue with it on and the node renders your guide to a temp mp4 at 24 fps, generates a thumbnail per reference Picture, and pushes both into a browser panel. Then it blocks every output - the graph doesn't sample, and you get a log line telling you so. That's the pause. You interact, place your points, then set setup_only false and queue again.

The same blocking happens if anything is wrong: no bindings yet, or the video changed. The node compares a content hash of the current images against the hash stored with your selections, and if they differ you get "Video changed: reset the marks and select the subjects again." Marks live inside the workflow JSON, so they survive a save and reload - but they do not silently survive a new clip. Deliberate. Half-valid marks applied to a different video would be worse than an error.

enabled off passes the video and references straight through, with a status string saying SAM is skipped. Handy while you're building the rest of the graph.

Inputs and outputs

In: images (the 24 fps guide), request (your prompt/instruction text, which the node appends to), selection_json (populated by the panel; leave it at {}), setup_only. Optionally ref_image_1 through ref_image_9 - however many Pictures you have.

Out: images passes through. cast_selection is the bundle SAM tracking consumes. request comes back with explicit source-binding sentences appended, e.g. that Picture N supplies the appearance of the source subject selected at frame 241 (10.04 s) at normalized position x=…, y=… - the pin in that text is worth having, because it takes the ambiguity out of what the click meant. references is the same BFS_H3_REFERENCE_SET bundle the describe-references node wants, so you don't wire all nine images twice. selection_status is a plain string for a preview node.

Selection rules, enforced with real error messages: a Picture can appear only once, the key frame has to exist in the clip, every entry needs at least one positive point, and all coordinates must be normalized 0–1. Ctrl/Cmd-click adds positives; shift-click excludes.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/alisson-anjos/ComfyUI-BFSNodes.git
cd ComfyUI-BFSNodes
pip install -r requirements.txt

Restart ComfyUI, then hard-refresh the browser tab. This node is useless without its web/js panel - the player is frontend code, not a Python widget. If the panel doesn't appear, you've got a stale cached frontend, not a broken install. The workflow also needs VideoHelperSuite set to force_rate=24, select_every_nth=1 upstream, and a ComfyUI with native SAM 3 nodes downstream.

opencv-python in the requirements is what writes the preview mp4; if the panel loads but the video never appears, check that install actually completed in the same Python env ComfyUI runs in.

Common issues

It keeps stopping before sampling. That's setup_only still true, or the node printed a reason: "Choose Picture X and click its subject in the video" means you have no bindings. Read selection_status instead of staring at the graph.

Your clicks don't register. Native video controls occupy the bottom strip of the player. Click above them. Also check you're on a Picture thumbnail with a reference image actually wired - a Picture with no image can't be bound.

The marks moved. Marks are one key frame per Picture; marking the same Picture on a different frame replaces the earlier key frame rather than adding to it. If you want two people in a shot, that's two Pictures, not two marks in one.

Not everything needs a point. Only mark the Pictures that carry a performer identity. Background, style or continuity Pictures don't need a person clicked on them, and adding points to those just gives the tracker a chance to produce a bad mask. The pack's docs say this directly, and it's the difference between two clean masks and five noisy ones.

CategoryBFS/MiniMax H3/Cast Bindings

Inputs (14)

NameTypeDefaultDescription
imagesIMAGE—
requestSTRING—
selection_jsonSTRING{}—
setup_onlyBOOLEANtrueQueue to load video, pause and click subjects. Turn off and queue again to track and generate.
ref_image_1optIMAGE—
ref_image_2optIMAGE—
ref_image_3optIMAGE—
ref_image_4optIMAGE—
ref_image_5optIMAGE—
ref_image_6optIMAGE—
ref_image_7optIMAGE—
ref_image_8optIMAGE—
ref_image_9optIMAGE—
enabledoptBOOLEANtrue—

Outputs (5)

NameTypeDescription
imagesIMAGE—
cast_selectionBFS_H3_CAST_SELECTION—
requestSTRING—
referencesBFS_H3_REFERENCE_SET—
selection_statusSTRING—