Nodes/IAMCCS-nodes/FACE SWAP v1 · SAM3 + BiRefNet multiview
ComfyUI Node

FACE SWAP v1 · SAM3 + BiRefNet multiview

Give MiniMax H3 two views of a face and it holds the identity

By IAMCCS·Created 11 months ago·Updated about 17 hours ago· 113
FACE SWAP v1 · SAM3 + BiRefNet multiview
  • cine_linx
  • source_video
  • reference_face
  • source_audio
  • source_mask
  • reference_face_2
  • cine_linx
source_fps24.00

Face swap in a video pipeline is usually where things go wrong quietly: you feed one reference photo, the subject turns their head, and the model invents a new person for the profile shots. This node is the pack's answer to that, and the answer is boringly practical - give it a second view.

IAMCCS_H3FaceSwapInput is the identity branch for the R42 / universal H3 backend. It is not a swap node in the "paste a face on a frame" sense; it builds an identity payload on the cine_linx bus, and the H3 backend downstream does the masked identity edit. reference_face and reference_face_2 are required for a reason: one view is not enough information for the model to hold a face as it turns.

What's on the node

Everything meaningful is required except the media:

  • cine_linx - the context wire from the Shotboard / SuperNode side of the graph. Required.
  • source_fps - the frame rate of your source footage, default 24. The H3 pipeline runs at 24fps, so mismatches here are how you get drifting lips.
  • source_video - the footage to be face-swapped.
  • reference_face, reference_face_2 - two coherent views of the same identity. Straight-on plus three-quarter or profile is the intended pairing.
  • source_audio - the audio track for the swapped take.
  • source_mask - optional. If you don't connect one, SAM3 tracks the head for you.

All five media sockets are lazy, which is the one clever bit here. check_lazy_status returns nothing unless the plan's task_mode is actually v2va_face_swap. So if you leave this node in a graph that is running the normal H3 pipeline, none of your source frames, models or masks get loaded at all. The output is the cine_linx it received, with the identity branch attached - that is the only output.

How it actually works

Three stages, and it's worth knowing them because each one is a failure point:

  1. Mask. If you didn't connect source_mask, SAM3 video-tracks the subject using the prompt from Face Swap settings, whose default is head - deliberately, because head tracking is what keeps hair, ears, jaw and profile stable. Threshold defaults to 0.5, and for multi-person footage you set the tracked-object index explicitly. Empty mask throws Face Swap mask is empty rather than silently rendering nothing.
  2. Clean up the mask. The MVEx_ nodes from MaskVidExperiments cleanup/shrink/grow the tracked mask before it's pushed into latent space.
  3. Build the identity card. Both reference views get cut out with BiRefNet and composited on white, stitched side by side - the "multiview" in the display name. That card is what the sampler gets as identity.

The knobs for stages 1–3 (crop scale, cleanup shrink, mask growth, feather, SAM3 threshold, object index) live in the pack's Face Swap settings panel, not as widgets on the node. The defaults are sane; crop_scale 1.75 and grow_spatial 36 are the two you'd touch for tight or loose framing.

Install and dependencies - read this part

The pack is the easy half:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

Restart. Then the real dependencies:

  • A SAM3 checkpoint visible in models/checkpoints (the node scans for filenames containing sam3), and a ComfyUI new enough to have the SAM3 extras. Required only when you don't supply source_mask.
  • birefnet.safetensors in models/background_removal. This one is not optional - the identity card is built with it, and missing it is an explicit error, not a fallback.
  • MaskVidExperiments, for MVEx_SubjectCrop, MVEx_SubjectUncrop, MVEx_MaskCleanup and MVEx_MaskToLatentSpace. The node resolves these at execution time and tells you which one is missing.

If you're on a 12–16GB card, note the pack's own comment: BiRefNet's 1024px pass can peak around 11GB of temporary attention memory, so the identity-card step drops to CPU and returns to the normal device afterwards when VRAM is tight. Expect a pause there on the first take; it's cached per take, so multi-shot runs don't redo it.

Traps

  • One reference face. The node refuses: FACE SWAP v1 requires reference_face_2. Don't fight it - a second view is the point.
  • Face detailer still on. The backend raises a validation error, because Face Swap already owns the masked identity edit and two masked identity passes on one take fight each other.
  • Latent upscaling selected. Face Swap restores a cropped latent into full frames, so H3/LTX latent refinement can't be combined with it. Use native output or the RTX final route.
  • Per-frame masks. If you supply source_mask it must have one mask per source frame; a single mask for a whole clip is rejected.
CategoryIAMCCS/MiniMax H3/Face Swap

Inputs (7)

NameTypeDefaultDescription
cine_linxIAMCCS_SUPERNODE_LINX
source_fpsFLOAT24.001–240
source_videooptIMAGE
reference_faceoptIMAGE
source_audiooptAUDIO
source_maskoptMASK
reference_face_2optIMAGE

Outputs (1)

NameTypeDescription
cine_linxIAMCCS_SUPERNODE_LINX