Skip to content

One-click character swap for videos: an open-source, local Higgsfield Genjutsu alternative built on ComfyUI and MiniMax H3, with FLUX.3 Klein relighting.

22.0 KB
Raw Blame
{
  "2": {
    "inputs": {
      "image": ""
    },
    "class_type": "LoadImage",
    "_meta": {
      "title": "Picture 1"
    }
  },
  "3": {
    "inputs": {
      "upscale_method": "area",
      "largest_size": 768,
      "image": [
        "2",
        0
      ]
    },
    "class_type": "ImageScaleToMaxDimension",
    "_meta": {
      "title": "Shrink for the describer"
    }
  },
  "4": {
    "inputs": {
      "prompt": "Describe the person in this picture for a casting sheet, in one sentence of about 40 words: apparent age and gender, hair, facial hair, skin tone, build, and their complete outfit including footwear. No preamble, no background.",
      "max_length": 120,
      "sampling_mode": "off",
      "thinking": false,
      "use_default_template": true,
      "mtp": "auto",
      "clip": [
        "13",
        0
      ],
      "image": [
        "3",
        0
      ]
    },
    "class_type": "TextGenerate",
    "_meta": {
      "title": "Describe picture 1"
    }
  },
  "5": {
    "inputs": {
      "video": "",
      "force_rate": 24,
      "custom_width": 0,
      "custom_height": 0,
      "frame_load_cap": 0,
      "skip_first_frames": 0,
      "select_every_nth": 1,
      "format": "None"
    },
    "class_type": "VHS_LoadVideo",
    "_meta": {
      "title": "Source video (people get replaced)"
    }
  },
  "6": {
    "inputs": {
      "start_index": 0,
      "duration": 2048,
      "audio": [
        "5",
        2
      ]
    },
    "class_type": "TrimAudioDuration",
    "_meta": {
      "title": "Soundtrack (whole video)"
    }
  },
  "7": {
    "inputs": {
      "select_every_nth": 48,
      "skip_first_images": 24,
      "images": [
        "5",
        0
      ]
    },
    "class_type": "VHS_SelectEveryNthImage",
    "_meta": {
      "title": "One frame every 2 s"
    }
  },
  "8": {
    "inputs": {
      "batch_index": 0,
      "length": 20,
      "image": [
        "7",
        0
      ]
    },
    "class_type": "ImageFromBatch",
    "_meta": {
      "title": "At most 20 frames"
    }
  },
  "9": {
    "inputs": {
      "upscale_method": "area",
      "largest_size": 640,
      "image": [
        "8",
        0
      ]
    },
    "class_type": "ImageScaleToMaxDimension",
    "_meta": {
      "title": "Shrink for the describer"
    }
  },
  "10": {
    "inputs": {
      "prompt": "These are frames from one video, in time order. List the people who appear most, up to four, the person with the most screen time first. Write one numbered line per person: first their role in the video in two to four words, without gender, that stays true in every shot, then \" - \" and how they look, like \"1. the guitarist - tall man with a grey beard in a denim jacket\". Each person appears once. Output only the list.",
      "max_length": 160,
      "sampling_mode": "off",
      "thinking": false,
      "use_default_template": true,
      "mtp": "auto",
      "clip": [
        "13",
        0
      ],
      "image": [
        "9",
        0
      ]
    },
    "class_type": "TextGenerate",
    "_meta": {
      "title": "Who is in the video"
    }
  },
  "11": {
    "inputs": {
      "clip_seconds": 6,
      "overlap_frames": 39,
      "resolution": "736p",
      "steps": 6,
      "seed": 0,
      "roles": "",
      "no_lip_sync": [
        "68",
        0
      ],
      "source_frames": [
        "5",
        0
      ],
      "picture_1": [
        "2",
        0
      ],
      "picture_1_text": [
        "4",
        0
      ],
      "video_people": [
        "10",
        0
      ]
    },
    "class_type": "H3OneClickSwapPlan",
    "_meta": {
      "title": "Swap Plan (roles, seed, size)"
    }
  },
  "13": {
    "inputs": {
      "clip_name": "qwen3vl_8b_int8_convrot.safetensors",
      "type": "stable_diffusion",
      "device": "default"
    },
    "class_type": "CLIPLoader",
    "_meta": {
      "title": "Describer: Qwen3-VL 8B"
    }
  },
  "15": {
    "inputs": {
      "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
      "weight_dtype": "default"
    },
    "class_type": "UNETLoader",
    "_meta": {
      "title": "H3 Diffusion Model"
    }
  },
  "16": {
    "inputs": {
      "lora_name": "minimax_h3_DMAD_4step_full_lora_avg_rank_39_bf16.safetensors",
      "strength_model": 1,
      "model": [
        "15",
        0
      ]
    },
    "class_type": "LoraLoaderModelOnly",
    "_meta": {
      "title": "DMAD LoRA"
    }
  },
  "17": {
    "inputs": {
      "attention": "comfy kitchen attention",
      "model": [
        "16",
        0
      ]
    },
    "class_type": "ModelAttentionBackend",
    "_meta": {
      "title": "Comfy Kitchen Attention"
    }
  },
  "18": {
    "inputs": {
      "shift_video": 12,
      "shift_audio": 2,
      "model": [
        "17",
        0
      ]
    },
    "class_type": "MiniMaxH3SigmaShift",
    "_meta": {
      "title": "Sigma Shift"
    }
  },
  "19": {
    "inputs": {
      "clip_name": "qwen3vl_32b_minimax_h3_int4_convrot.safetensors",
      "type": "minimax",
      "device": "default"
    },
    "class_type": "CLIPLoader",
    "_meta": {
      "title": "H3 Text Encoder"
    }
  },
  "20": {
    "inputs": {
      "vae_name": "minimax_h3_video_vae_int8_convrot.safetensors"
    },
    "class_type": "VAELoader",
    "_meta": {
      "title": "Video VAE"
    }
  },
  "21": {
    "inputs": {
      "vae_name": "minimax_h3_audio_vae_fp32.safetensors"
    },
    "class_type": "VAELoader",
    "_meta": {
      "title": "Audio VAE"
    }
  },
  "22": {
    "inputs": {
      "sampler_name": "euler"
    },
    "class_type": "KSamplerSelect",
    "_meta": {
      "title": "Sampler"
    }
  },
  "23": {
    "inputs": {
      "ckpt_name": "sam3.1_multiplex_fp16.safetensors"
    },
    "class_type": "CheckpointLoaderSimple",
    "_meta": {
      "title": "SAM 3.1"
    }
  },
  "24": {
    "inputs": {
      "text": "person",
      "clip": [
        "23",
        1
      ]
    },
    "class_type": "CLIPTextEncode",
    "_meta": {
      "title": "SAM: what to replace"
    }
  },
  "25": {
    "inputs": {
      "scene_continuity": "Hard picture + protected audio",
      "audio_profile": "Generate audio"
    },
    "class_type": "MiniMaxH3GenerationProfile",
    "_meta": {
      "title": "Generation Profile"
    }
  },
  "26": {
    "inputs": {
      "plan_json": "{\n  \"shots\": [\n    {\n      \"id\": \"intro\",\n      \"prompt\": \"Describe the opening shot.\"\n    },\n    {\n      \"id\": \"continuation\",\n      \"prompt\": \"Continue the same take.\"\n    }\n  ]\n}",
      "run_name": [
        "11",
        3
      ],
      "generation_fingerprint": "",
      "width": [
        "11",
        1
      ],
      "height": [
        "11",
        2
      ],
      "encode_mode": "video",
      "crop": "center",
      "default_duration_seconds": 15,
      "default_steps": 6,
      "base_seed": 0,
      "segment_crf": 16,
      "video_blend_frames": 0,
      "chain_policy": [
        "25",
        0
      ],
      "plan_json_input": [
        "11",
        0
      ]
    },
    "class_type": "MiniMaxH3ChainPlanModern",
    "_meta": {
      "title": "Production Plan (filled by Swap Plan)"
    }
  },
  "27": {
    "inputs": {
      "video_path": "",
      "audio_path": "",
      "embedded_audio": "auto",
      "skip_first_frames": 0,
      "source_audio": [
        "6",
        0
      ]
    },
    "class_type": "MiniMaxH3SourceTimeline",
    "_meta": {
      "title": "Source soundtrack"
    }
  },
  "28": {
    "inputs": {
      "start_clip": 1,
      "scene_range": "",
      "verify_resume_history": true,
      "plan": [
        "26",
        0
      ],
      "source_timeline": [
        "27",
        0
      ]
    },
    "class_type": "MiniMaxH3ChainLoopStart",
    "_meta": {
      "title": "Loop Start"
    }
  },
  "29": {
    "inputs": {
      "align_audio_reference": false,
      "state": [
        "28",
        1
      ]
    },
    "class_type": "MiniMaxH3ChainCurrent",
    "_meta": {
      "title": "Current Clip"
    }
  },
  "30": {
    "inputs": {
      "prompt": [
        "45",
        0
      ],
      "width": [
        "29",
        8
      ],
      "height": [
        "29",
        9
      ],
      "length": [
        "29",
        6
      ],
      "ref_image_size": "match",
      "clip": [
        "19",
        0
      ],
      "vae": [
        "20",
        0
      ],
      "audio_vae": [
        "21",
        0
      ],
      "ref_images.ref_image_0": [
        "2",
        0
      ],
      "ref_videos.ref_video_0": [
        "41",
        0
      ],
      "ref_video_audios.ref_video_audio_0": [
        "73",
        0
      ]
    },
    "class_type": "MiniMaxH3ReferenceToVideo",
    "_meta": {
      "title": "Reference Conditioning"
    }
  },
  "31": {
    "inputs": {
      "source_fps": 24,
      "crop": "center",
      "state": [
        "29",
        0
      ],
      "latent": [
        "30",
        1
      ],
      "audio_vae": [
        "21",
        0
      ],
      "source_frames": [
        "5",
        0
      ],
      "source_audio": [
        "72",
        0
      ]
    },
    "class_type": "H3SourceSlice",
    "_meta": {
      "title": "Source clip (frames + audio)"
    }
  },
  "32": {
    "inputs": {
      "upscale_method": "area",
      "largest_size": 512,
      "image": [
        "5",
        0
      ]
    },
    "class_type": "ImageScaleToMaxDimension",
    "_meta": {
      "title": "Motion reference video (~512 px)"
    }
  },
  "33": {
    "inputs": {
      "expression": "round(a * 24)",
      "values.a": [
        "29",
        10
      ]
    },
    "class_type": "ComfyMathExpression",
    "_meta": {
      "title": "Clip start frame"
    }
  },
  "34": {
    "inputs": {
      "batch_index": [
        "33",
        1
      ],
      "length": [
        "29",
        6
      ],
      "image": [
        "32",
        0
      ]
    },
    "class_type": "ImageFromBatch",
    "_meta": {
      "title": "Motion reference for this clip"
    }
  },
  "35": {
    "inputs": {
      "upscale_method": "area",
      "largest_size": 1008,
      "image": [
        "5",
        0
      ]
    },
    "class_type": "ImageScaleToMaxDimension",
    "_meta": {
      "title": "SAM video (1008 px, SAM's own size)"
    }
  },
  "36": {
    "inputs": {
      "batch_index": [
        "33",
        1
      ],
      "length": [
        "29",
        6
      ],
      "image": [
        "35",
        0
      ]
    },
    "class_type": "ImageFromBatch",
    "_meta": {
      "title": "SAM frames for this clip"
    }
  },
  "37": {
    "inputs": {
      "noise_seed": [
        "29",
        5
      ]
    },
    "class_type": "RandomNoise",
    "_meta": {
      "title": "Clip Seed"
    }
  },
  "38": {
    "inputs": {
      "detection_threshold": 0.35,
      "max_objects": 0,
      "detect_interval": 1,
      "images": [
        "36",
        0
      ],
      "model": [
        "23",
        0
      ],
      "conditioning": [
        "24",
        0
      ]
    },
    "class_type": "SAM3_VideoTrack",
    "_meta": {
      "title": "SAM 3.1 track every person"
    }
  },
  "39": {
    "inputs": {
      "headroom": 0.1,
      "hold_frames": 2,
      "max_people": 1,
      "track_data": [
        "38",
        0
      ]
    },
    "class_type": "H3PeopleMask",
    "_meta": {
      "title": "Main person (+ headroom)"
    }
  },
  "40": {
    "inputs": {
      "headroom": 0,
      "hold_frames": 1,
      "max_people": 1,
      "track_data": [
        "38",
        0
      ]
    },
    "class_type": "H3PeopleMask",
    "_meta": {
      "title": "Main person, no headroom (for the mannequin)"
    }
  },
  "41": {
    "inputs": {
      "blur": 0.04,
      "face_blur": 0.05,
      "images": [
        "34",
        0
      ],
      "mask": [
        "40",
        0
      ],
      "size": [
        "40",
        1
      ],
      "faces": [
        "71",
        0
      ],
      "face_size": [
        "71",
        1
      ]
    },
    "class_type": "H3GreyMannequins",
    "_meta": {
      "title": "Hide the main person (grey mannequin)"
    }
  },
  "42": {
    "inputs": {
      "expand": 40,
      "incremental_expandrate": 0,
      "tapered_corners": true,
      "flip_input": false,
      "blur_radius": 0,
      "lerp_alpha": 1,
      "decay_factor": 1,
      "fill_holes": true,
      "mask": [
        "52",
        0
      ]
    },
    "class_type": "GrowMaskWithBlur",
    "_meta": {
      "title": "Grow mask (~4% of the frame)"
    }
  },
  "43": {
    "inputs": {
      "cut_threshold": 40,
      "images": [
        "34",
        0
      ],
      "shot_prompt": [
        "11",
        4
      ]
    },
    "class_type": "H3ClipShots",
    "_meta": {
      "title": "Find this clip's cuts"
    }
  },
  "44": {
    "inputs": {
      "prompt": [
        "43",
        1
      ],
      "max_length": 500,
      "sampling_mode": "off",
      "thinking": false,
      "use_default_template": true,
      "mtp": "auto",
      "clip": [
        "13",
        0
      ],
      "image": [
        "43",
        0
      ]
    },
    "class_type": "TextGenerate",
    "_meta": {
      "title": "Write this clip's shot list (Qwen3-VL)"
    }
  },
  "45": {
    "inputs": {
      "prompt": [
        "29",
        4
      ],
      "shots": [
        "44",
        0
      ]
    },
    "class_type": "H3FillShots",
    "_meta": {
      "title": "Insert shot list into prompt"
    }
  },
  "46": {
    "inputs": {
      "source": [
        "45",
        0
      ]
    },
    "class_type": "PreviewAny",
    "_meta": {
      "title": "Clip prompt (what H3 gets)"
    }
  },
  "47": {
    "inputs": {
      "text": "hat",
      "clip": [
        "23",
        1
      ]
    },
    "class_type": "CLIPTextEncode",
    "_meta": {
      "title": "SAM: hats"
    }
  },
  "48": {
    "inputs": {
      "detection_threshold": 0.35,
      "max_objects": 0,
      "detect_interval": 1,
      "images": [
        "36",
        0
      ],
      "model": [
        "23",
        0
      ],
      "conditioning": [
        "47",
        0
      ]
    },
    "class_type": "SAM3_VideoTrack",
    "_meta": {
      "title": "SAM 3.1 track hats"
    }
  },
  "49": {
    "inputs": {
      "object_indices": "",
      "track_data": [
        "48",
        0
      ]
    },
    "class_type": "SAM3_TrackToMask",
    "_meta": {
      "title": "All hats"
    }
  },
  "50": {
    "inputs": {
      "expand": 60,
      "incremental_expandrate": 0,
      "tapered_corners": true,
      "flip_input": false,
      "blur_radius": 0,
      "lerp_alpha": 1,
      "decay_factor": 1,
      "fill_holes": true,
      "mask": [
        "39",
        0
      ]
    },
    "class_type": "GrowMaskWithBlur",
    "_meta": {
      "title": "Hat search area (person + 60 px)"
    }
  },
  "51": {
    "inputs": {
      "x": 0,
      "y": 0,
      "operation": "multiply",
      "destination": [
        "49",
        0
      ],
      "source": [
        "50",
        0
      ]
    },
    "class_type": "MaskComposite",
    "_meta": {
      "title": "Only the main person's hat"
    }
  },
  "52": {
    "inputs": {
      "x": 0,
      "y": 0,
      "operation": "add",
      "destination": [
        "39",
        0
      ],
      "source": [
        "51",
        0
      ]
    },
    "class_type": "MaskComposite",
    "_meta": {
      "title": "People + hats"
    }
  },
  "53": {
    "inputs": {
      "cell_selection": "runtime exact (latent max)",
      "cell_adjust": 0,
      "preview_frame": 0,
      "overlay_opacity": 0.38,
      "show_grid": true,
      "show_source_outline": true,
      "mask_meaning": "white = generate",
      "image": [
        "31",
        0
      ],
      "mask": [
        "42",
        0
      ]
    },
    "class_type": "MiniMaxH3ContexMaskGridPreview",
    "_meta": {
      "title": "Mask preview"
    }
  },
  "54": {
    "inputs": {
      "images": [
        "53",
        1
      ]
    },
    "class_type": "PreviewImage",
    "_meta": {
      "title": "Mask preview (white = regenerated)"
    }
  },
  "55": {
    "inputs": {
      "grow": 0,
      "keep_audio": true,
      "megapixels": 0,
      "vae": [
        "20",
        0
      ],
      "images": [
        "31",
        0
      ],
      "mask": [
        "42",
        0
      ],
      "audio_vae": [
        "21",
        0
      ],
      "audio": [
        "31",
        1
      ]
    },
    "class_type": "MiniMaxH3FantasticVideoEditLatent",
    "_meta": {
      "title": "Edit latent (source + mask + audio)"
    }
  },
  "56": {
    "inputs": {
      "mask_meaning": "white = generate",
      "audio_mode": "preserve source audio",
      "mask_conversion": "H3 exact (causal/token max)",
      "target_latent": [
        "55",
        0
      ],
      "mask": [
        "42",
        0
      ]
    },
    "class_type": "MiniMaxH3ContexMaskedTarget",
    "_meta": {
      "title": "Masked target"
    }
  },
  "57": {
    "inputs": {
      "state": [
        "29",
        0
      ],
      "conditioning": [
        "30",
        0
      ],
      "vae": [
        "20",
        0
      ],
      "latent": [
        "56",
        0
      ],
      "audio_vae": [
        "21",
        0
      ]
    },
    "class_type": "MiniMaxH3ChainContext",
    "_meta": {
      "title": "Apply Clip Context"
    }
  },
  "58": {
    "inputs": {
      "model": [
        "18",
        0
      ],
      "conditioning": [
        "57",
        0
      ]
    },
    "class_type": "BasicGuider",
    "_meta": {
      "title": "Guider"
    }
  },
  "59": {
    "inputs": {
      "scheduler": "simple",
      "steps": [
        "29",
        7
      ],
      "denoise": 1,
      "model": [
        "18",
        0
      ]
    },
    "class_type": "BasicScheduler",
    "_meta": {
      "title": "Schedule"
    }
  },
  "60": {
    "inputs": {
      "noise": [
        "37",
        0
      ],
      "guider": [
        "58",
        0
      ],
      "sampler": [
        "22",
        0
      ],
      "sigmas": [
        "59",
        0
      ],
      "latent_image": [
        "57",
        3
      ]
    },
    "class_type": "SamplerCustomAdvanced",
    "_meta": {
      "title": "Sample Video + Audio"
    }
  },
  "61": {
    "inputs": {
      "samples": [
        "60",
        0
      ],
      "vae": [
        "20",
        0
      ]
    },
    "class_type": "VAEDecode",
    "_meta": {
      "title": "Decode Video"
    }
  },
  "62": {
    "inputs": {
      "samples": [
        "60",
        0
      ],
      "vae": [
        "21",
        0
      ]
    },
    "class_type": "VAEDecodeAudio",
    "_meta": {
      "title": "Decode Audio"
    }
  },
  "63": {
    "inputs": {
      "trim_frames": [
        "57",
        1
      ],
      "fps": 24,
      "match_tail": true,
      "audio_trim_mode": "sync_with_video",
      "images": [
        "61",
        0
      ],
      "audio": [
        "62",
        0
      ],
      "state": [
        "29",
        0
      ]
    },
    "class_type": "MiniMaxH3LoopTrim",
    "_meta": {
      "title": "Trim Overlap"
    }
  },
  "64": {
    "inputs": {
      "state": [
        "29",
        0
      ],
      "images": [
        "63",
        0
      ],
      "sampled_latent": [
        "60",
        0
      ],
      "audio": [
        "63",
        1
      ],
      "images_with_overlap": [
        "63",
        2
      ]
    },
    "class_type": "MiniMaxH3ChainSegmentSave",
    "_meta": {
      "title": "Save Clip + Checkpoint"
    }
  },
  "65": {
    "inputs": {
      "enabled": false,
      "play_notification_sound": false,
      "auto_continue_timeout_minutes": 0,
      "unload_models_while_waiting": false,
      "assemble_partial_on_stop": true,
      "partial_audio_source": "checkpointed",
      "candidate_count": 1,
      "review_each_candidate": false,
      "state": [
        "29",
        0
      ],
      "segment": [
        "64",
        0
      ],
      "audio": [
        "63",
        1
      ]
    },
    "class_type": "MiniMaxH3ChainReview",
    "_meta": {
      "title": "Review (off = no pause)"
    }
  },
  "66": {
    "inputs": {
      "between_scene_cleanup": "off",
      "execution_mode": "recursive",
      "flow": [
        "28",
        0
      ],
      "state": [
        "29",
        0
      ],
      "images": [
        "63",
        0
      ],
      "sampled_latent": [
        "60",
        0
      ],
      "segment": [
        "65",
        0
      ]
    },
    "class_type": "MiniMaxH3ChainLoopEnd",
    "_meta": {
      "title": "Loop End"
    }
  },
  "67": {
    "inputs": {
      "audio_source": "source",
      "filename": "swap_%date:yyyy-MM-dd%",
      "audio_bitrate": 256,
      "copy_to_output": true,
      "output_subfolder": "h3_oneclick_swap",
      "blend_schedule": "plan",
      "boundary_tone_match": "off",
      "color_stabilization": "off",
      "delete_checkpoints_after_assembly": false,
      "generated_audio_join": "av_overlap",
      "manifest": [
        "66",
        0
      ]
    },
    "class_type": "MiniMaxH3ChainAssemble",
    "_meta": {
      "title": "Final Video"
    }
  },
  "68": {
    "inputs": {
      "value": true
    },
    "class_type": "PrimitiveBoolean",
    "_meta": {
      "title": "No lip-sync in the prompt"
    }
  },
  "69": {
    "inputs": {
      "text": "face",
      "clip": [
        "23",
        1
      ]
    },
    "class_type": "CLIPTextEncode",
    "_meta": {
      "title": "SAM: faces"
    }
  },
  "70": {
    "inputs": {
      "detection_threshold": 0.2,
      "max_objects": 0,
      "detect_interval": 1,
      "images": [
        "36",
        0
      ],
      "model": [
        "23",
        0
      ],
      "conditioning": [
        "69",
        0
      ]
    },
    "class_type": "SAM3_VideoTrack",
    "_meta": {
      "title": "SAM 3.1 track faces"
    }
  },
  "71": {
    "inputs": {
      "headroom": 0,
      "hold_frames": 0,
      "max_people": 0,
      "track_data": [
        "70",
        0
      ]
    },
    "class_type": "H3PeopleMask",
    "_meta": {
      "title": "Faces (shown on the mannequin)"
    }
  },
  "72": {
    "inputs": {
      "volume": -100,
      "audio": [
        "6",
        0
      ]
    },
    "class_type": "AudioAdjustVolume",
    "_meta": {
      "title": "Mute the clip audio H3 hears"
    }
  },
  "73": {
    "inputs": {
      "volume": -100,
      "audio": [
        "29",
        12
      ]
    },
    "class_type": "AudioAdjustVolume",
    "_meta": {
      "title": "Mute the reference audio H3 hears"
    }
  }
}