FACE SWAP v1 · SAM3 + BiRefNet multiview
Give MiniMax H3 two views of a face and it holds the identity
- cine_linx
- source_video
- reference_face
- source_audio
- source_mask
- reference_face_2
- cine_linx
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:
- Mask. If you didn't connect
source_mask, SAM3 video-tracks the subject using the prompt from Face Swap settings, whose default ishead- 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 throwsFace Swap mask is emptyrather than silently rendering nothing. - Clean up the mask. The
MVEx_nodes from MaskVidExperiments cleanup/shrink/grow the tracked mask before it's pushed into latent space. - 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 containingsam3), and a ComfyUI new enough to have the SAM3 extras. Required only when you don't supplysource_mask. birefnet.safetensorsinmodels/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_MaskCleanupandMVEx_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_maskit must have one mask per source frame; a single mask for a whole clip is rejected.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| cine_linx | IAMCCS_SUPERNODE_LINX | — | |
| source_fps | FLOAT | 24.001–240 | — |
| source_videoopt | IMAGE | — | |
| reference_faceopt | IMAGE | — | |
| source_audioopt | AUDIO | — | |
| source_maskopt | MASK | — | |
| reference_face_2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cine_linx | IAMCCS_SUPERNODE_LINX | — |