{
 "92": {
  "class_type": "SaveVideo",
  "inputs": {
   "video": [
    "130",
    0
   ],
   "filename_prefix": "h3/ref2va-swap",
   "format": "mp4",
   "format.codec": "h264"
  }
 },
 "119": {
  "class_type": "VAELoader",
  "inputs": {
   "vae_name": "minimax_h3_video_vae_fp16.safetensors"
  }
 },
 "120": {
  "class_type": "VAELoader",
  "inputs": {
   "vae_name": "minimax_h3_audio_vae_fp32.safetensors"
  }
 },
 "122": {
  "class_type": "VAEDecode",
  "inputs": {
   "samples": [
    "125",
    0
   ],
   "vae": [
    "119",
    0
   ]
  }
 },
 "123": {
  "class_type": "KSamplerSelect",
  "inputs": {
   "sampler_name": "res_multistep"
  }
 },
 "124": {
  "class_type": "BasicScheduler",
  "inputs": {
   "model": [
    "160",
    0
   ],
   "scheduler": "simple",
   "steps": 4,
   "denoise": 1
  }
 },
 "125": {
  "class_type": "SamplerCustomAdvanced",
  "inputs": {
   "noise": [
    "129",
    0
   ],
   "guider": [
    "126",
    0
   ],
   "sampler": [
    "123",
    0
   ],
   "sigmas": [
    "124",
    0
   ],
   "latent_image": [
    "136",
    1
   ]
  }
 },
 "126": {
  "class_type": "BasicGuider",
  "inputs": {
   "model": [
    "160",
    0
   ],
   "conditioning": [
    "161",
    0
   ]
  }
 },
 "127": {
  "class_type": "UNETLoader",
  "inputs": {
   "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
   "weight_dtype": "default"
  }
 },
 "128": {
  "class_type": "CLIPLoader",
  "inputs": {
   "clip_name": "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
   "type": "minimax",
   "device": "default"
  }
 },
 "129": {
  "class_type": "RandomNoise",
  "inputs": {
   "noise_seed": 926301
  }
 },
 "130": {
  "class_type": "CreateVideo",
  "inputs": {
   "images": [
    "122",
    0
   ],
   "audio": [
    "151",
    1
   ],
   "fps": [
    "151",
    2
   ],
   "bit_depth": 8,
   "color_space": "sRGB"
  }
 },
 "136": {
  "class_type": "MiniMaxH3ReferenceToVideo",
  "inputs": {
   "clip": [
    "128",
    0
   ],
   "vae": [
    "119",
    0
   ],
   "audio_vae": [
    "120",
    0
   ],
   "prompt": "subject_definitions:\n<Subject 1> is the {CHARACTER NOUN} shown in <Picture 1> and <Picture 2>: {DESIGN: skin/material, head, eyes, mouth or mouth-substitute, distinctive marks, costume}. Picture 1 shows it in this same {LOCATION} and lighting; Picture 2 is a studio view of the same design.\n<Subject 2> is the {LOCATION} from <Video 1>: {3–5 concrete set details and practical lights}.\n<Video 1> is the source shot to edit: {camera: fixed / handheld / slow push-in}. Recast only {WHO, e.g. \"the man speaking to the camera\"} as <Subject 1>. {If others are visible: \"Keep {OTHER PEOPLE} exactly as they are.\"}\n<Audio 1> is the synchronized original soundtrack of <Video 1>, including the exact spoken words, pauses, breaths and room tone.\n\nsummary:\n[video editing + reference generation + audio reuse] The target video is an edited version of <Video 1>. Replace only {WHO}'s visible identity with <Subject 1>, retaining the original framing, lighting, camera movement, performance and the precise timing of every word.\n\nretention_analysis:\n<Subject 1>: fully_preserved {CHARACTER NOUN} design from the pictures - no human skin, hair or human face anywhere - adapted to the source's {LIGHTING}.\n<Subject 2>: fully_preserved scene geometry, practical lights, exposure and camera.\n<Video 1>: partially_preserved; retain the {head and shoulder movement, glances, gestures} and timing; replace only {WHO}'s appearance. {MOUTH RULE: \"Its lips and jaw follow the original waveform.\" or \"Its {grille/visor/light} glows in time with the words instead of lip movement.\"}\n<Audio 1>: fully_copy the complete original soundtrack one-to-one with identical word timing, pauses and ambience.\n\ndetailed_description:\nRealistic {YEAR} live-action television footage, with {grain level} and {lighting}, matching the source exposure throughout.\n[Shot 1] <Subject 1> {framing, pose, mood}; {SPEAKING OR SILENT; EXPRESSION; WHAT COVERS THE FACE, IF ANYTHING}. From {T1} to {T2} seconds <Subject 1> (S1), in the source speaker's {voice description}, says <d>[English]{EXACT LINE 1}</d> {mouth rule}. At about {T3} seconds it says <d>[English]{EXACT LINE 2}</d>\nThe source has {N} frames. After them, hold the last pose until the end of the clip; those frames are discarded.\n\noverall_soundscape:\nCopy the original room tone, breathing and words exactly from <Audio 1>.\n\nnon_diegetic_music:\n{N/A if the shot has no music; otherwise: Copy the music already in <Audio 1>.}\n",
   "width": 1536,
   "height": 864,
   "length": [
    "206",
    1
   ],
   "ref_image_size": "match",
   "ref_images.ref_image_0": [
    "137",
    0
   ],
   "ref_images.ref_image_1": [
    "139",
    0
   ],
   "ref_videos.ref_video_0": [
    "209",
    0
   ],
   "ref_video_audios.ref_video_audio_0": [
    "151",
    1
   ]
  }
 },
 "137": {
  "class_type": "LoadImage",
  "inputs": {
   "image": "character_reference_1.png"
  }
 },
 "139": {
  "class_type": "LoadImage",
  "inputs": {
   "image": "character_reference_2.png"
  }
 },
 "150": {
  "class_type": "LoadVideo",
  "inputs": {
   "file": "source_shot.mp4"
  }
 },
 "151": {
  "class_type": "GetVideoComponents",
  "inputs": {
   "video": [
    "150",
    0
   ]
  }
 },
 "160": {
  "class_type": "LoraLoaderModelOnly",
  "inputs": {
   "model": [
    "127",
    0
   ],
   "lora_name": "minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors",
   "strength_model": 1
  }
 },
 "161": {
  "class_type": "MiniMaxH3AddGuide",
  "inputs": {
   "positive": [
    "136",
    0
   ],
   "latent": [
    "136",
    1
   ],
   "audio_vae": [
    "120",
    0
   ],
   "audio": [
    "151",
    1
   ],
   "frame_idx": 0
  }
 },
 "200": {
  "class_type": "GetImageSize",
  "inputs": {
   "image": [
    "151",
    0
   ]
  },
  "_meta": {
   "title": "Source shot frame count"
  }
 },
 "201": {
  "class_type": "ComfyMathExpression",
  "inputs": {
   "expression": "a - 1",
   "values.a": [
    "200",
    2
   ]
  },
  "_meta": {
   "title": "Last actual frame index"
  }
 },
 "202": {
  "class_type": "ImageFromBatch",
  "inputs": {
   "image": [
    "151",
    0
   ],
   "batch_index": [
    "201",
    1
   ],
   "length": 1
  },
  "_meta": {
   "title": "Extract the last actual reference frame"
  }
 },
 "203": {
  "class_type": "ComfyMathExpression",
  "inputs": {
   "expression": "(17 - ((a - 5) % 17)) % 17",
   "values.a": [
    "200",
    2
   ]
  },
  "_meta": {
   "title": "Padding needed for 5 + 17k"
  }
 },
 "204": {
  "class_type": "RepeatImageBatch",
  "inputs": {
   "image": [
    "202",
    0
   ],
   "amount": [
    "207",
    1
   ]
  },
  "_meta": {
   "title": "Repeat last frame"
  }
 },
 "205": {
  "class_type": "BatchImagesNode",
  "inputs": {
   "images.image0": [
    "151",
    0
   ],
   "images.image1": [
    "204",
    0
   ]
  },
  "_meta": {
   "title": "Append repeated tail"
  }
 },
 "206": {
  "class_type": "ComfyMathExpression",
  "inputs": {
   "expression": "max(192,a)",
   "values.a": [
    "208",
    1
   ]
  },
  "_meta": {
   "title": "Generation length, at least 192"
  }
 },
 "207": {
  "class_type": "ComfyMathExpression",
  "inputs": {
   "expression": "max(1,a)",
   "values.a": [
    "203",
    1
   ]
  },
  "_meta": {
   "title": "Repeat node requires at least one image"
  }
 },
 "208": {
  "class_type": "ComfyMathExpression",
  "inputs": {
   "expression": "a + b",
   "values.a": [
    "200",
    2
   ],
   "values.b": [
    "203",
    1
   ]
  },
  "_meta": {
   "title": "Padded reference length"
  }
 },
 "209": {
  "class_type": "ImageFromBatch",
  "inputs": {
   "image": [
    "205",
    0
   ],
   "batch_index": 0,
   "length": [
    "208",
    1
   ]
  },
  "_meta": {
   "title": "Trim extra repeat on already aligned clips"
  }
 }
}
