Nodes/Facefusion_comfyui/FF: Advanced Swap Face (Video)
ComfyUI Node

FF: Advanced Swap Face (Video)

Full-control face swapping for video, frame by frame

By huygiatrng·Created 9 months ago·Updated 25 days ago· 89
FF: Advanced Swap Face (Video)
  • source_images
  • target_video
  • reference_image
  • VIDEO
api_token-1
face_swapper_modelhyperswap_1a_256
face_detector_modelscrfd
pixel_boost512x512
face_occluder_modelxseg_1
face_parser_modelbisenet_resnet_34
face_mask_blur0.30
face_selector_modeone
face_position0
sort_orderlarge-small
score_threshold0.30
use_box_masktrue
use_occlusion_maskfalse
use_area_maskfalse
use_region_maskfalse
face_mask_areasupper-face,lower-face,mouth
face_mask_regionsskin,nose,mouth,upper-lip,lower-lip
face_mask_padding0,0,0,0
max_workers16
reference_face_distance0.60

This is AdvancedSwapFaceImage for video - same selection modes, same layered mask system, same full model roster - plus max_workers for parallel frame processing. If you've hit the basic SwapFaceVideo node's biggest limitation (no way to say which face gets swapped when a clip has more than one person), this is where you fix it.

How it works

Every frame goes through the same pipeline as the image node: detect, select, embed, swap, mask, blend. The difference on video isn't the per-frame mechanics, it's that selection now has to stay consistent across frames, and that's where this node earns its keep over the basic one. face_selector_mode: reference - feeding a clear photo of the person you want via reference_image, with reference_face_distance controlling match strictness - locks onto a specific identity across the whole clip. Positional sorting (face_selector_mode: one with sort_order) is fine for a single-person video, but the moment two people are roughly the same size in frame, positional selection can flip between them from one frame to the next, which is the classic "the swap keeps jumping between faces" complaint on any face-swap-video setup.

Inputs a beginner actually sets

  • face_swapper_model (default hyperswap_1a_256) and pixel_boost (default 512x512) - quality/speed. The pack's own guidance for video specifically: hyperswap_1c_256 at 512x512 is the sweet spot, favoring a model you'd trust for stills over the absolute fastest option, since you're already paying the per-frame cost either way.
  • face_selector_mode - reference (with reference_image + reference_face_distance) for multi-person clips where identity has to stay locked across frames; one (with face_position + sort_order) is fine for single-subject footage.
  • max_workers (1–32, default 16) - parallel frame processing. The pack's own recommendation for video is 4–8, noticeably below the schema's ceiling of 32.
  • The same four mask toggles as the image node - use_box_mask (on by default), use_occlusion_mask, use_area_mask, use_region_mask - for handling hands, hair, and other things that shouldn't get swapped over.

Everything else (face_mask_blur, the mask-region strings, face_occluder_model, face_parser_model, score_threshold) ships with the same defaults as the image node and is worth leaving alone until the basics are solid. Output is a single VIDEO.

Installing it

ComfyUI Manager: search Facefusion_comfyui, install, restart. Manually:

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

Full restart needed - new nodes don't appear from a browser refresh. First run downloads whichever swapper, occluder, and parser models you've picked into custom_nodes/Facefusion_comfyui/models/; nothing extra for video beyond what the image node already needs.

Common issues

The swapped face flickers between two people across the clip. Switch to face_selector_mode: reference with a clean reference photo, instead of relying on sort_order. This is the single most common problem on multi-person face-swap video, reported and confirmed on the pack's own launch thread.

Out of memory partway through a longer video. Lower max_workers first (fewer frames in flight at once), then pixel_boost, then consider inswapper_128_fp16 if you're still tight.

Hands or hair intruding on the swap. Same fix as the image node: use_occlusion_mask with face_occluder_model: xseg_1 for objects/hands, use_region_mask with bisenet_resnet_34 for hairline blending.

Render is painfully slow. GPU matters far more here than max_workers - the pack's own figures put CPU at 10–50x slower than GPU for this workload, and cranking worker count on a CPU-bound run mostly just contends for the same limited resource.

CategoryFaceFusion

Inputs (23)

NameTypeDefaultDescription
source_imagesIMAGE
target_videoVIDEO
api_tokenSTRING-1
face_swapper_modelCOMBOhyperswap_1a_25613 options: hyperswap_1a_256, hyperswap_1b_256, hyperswap_1c_256, ghost_1_256, ghost_2_256, ghost_3_256, +7
face_detector_modelCOMBOscrfd5 options: scrfd, retinaface, yolo_face, yunet, many
pixel_boostCOMBO512x5124 options: 256x256, 512x512, 768x768, 1024x1024
face_occluder_modelCOMBOxseg_14 options: none, xseg_1, xseg_2, xseg_3
face_parser_modelCOMBObisenet_resnet_343 options: none, bisenet_resnet_18, bisenet_resnet_34
face_mask_blurFLOAT0.300–1
face_selector_modeCOMBOone3 options: one, many, reference
face_positionINT00–100
sort_orderCOMBOlarge-small8 options: large-small, small-large, left-right, right-left, top-bottom, bottom-top, +2
score_thresholdFLOAT0.300–1
use_box_maskBOOLEANtrue
use_occlusion_maskBOOLEANfalse
use_area_maskBOOLEANfalse
use_region_maskBOOLEANfalse
face_mask_areasSTRINGupper-face,lower-face,mouth
face_mask_regionsSTRINGskin,nose,mouth,upper-lip,lower-lip
face_mask_paddingSTRING0,0,0,0
max_workersINT161–32
reference_imageoptIMAGE
reference_face_distanceoptFLOAT0.600–1

Outputs (1)

NameTypeDescription
VIDEOVIDEO