DEV Community

AI-KSK
AI-KSK

Posted on

H3 Character Swap 1.5 in ComfyUI: Check the Mask Before the Render

Replacing a character in a crowded video is not just a prompt-writing problem. The workflow also needs to identify the right person, carry that selection through the frames, and place the generated region back into the scene. A detailed replacement prompt cannot rescue a mask that follows the wrong subject.

This H3 Character Swap 1.5 workflow separates those responsibilities: SAM tracking selects the source subject, a dynamic crop defines the editing region, and H3 generates the replacement with image and video references. A final uncrop node places the decoded region onto the preprocessed video frames.

The supplied export contains 47 nodes and 68 links, including two documentation notes. This walkthrough is based on that graph and the author's transcript, not a new GPU run. The notes explicitly say that the modified VDN8 combination has not completed GPU compatibility validation. Treat the configuration as a starting point to inspect, not a guarantee of successful execution or improved quality.

Two descriptions, two different jobs

The main replacement prompt is stored in node 2 and connected to MiniMaxH3ReferenceToVideo at node 11. It describes the replacement character, the source action, and what should remain unchanged.

The SAM target description is a separate text input at node 50. In the saved example, it identifies the dancer on the right through position, hair, headband, and clothing. Its job is to select the person already present in the source video—not to describe the new character.

Keep these instructions consistent. If the replacement prompt says “change the person on the right” while the tracker selects the foreground person on the left, improving the replacement description will not fix the selection error. Inspect the tracking preview before proceeding with generation.

Prepare the actual dependencies

The active loaders reference these files:

Role Node Referenced filename
H3 model 30 MiniMax-H3-Ref2VA-int8-convrot.safetensors
Character Swap LoRA 121 h3_character_swap_v1.5.safetensors
H3 text encoder 15 qwen3vl_32b_minimax_h3_int8_convrot.safetensors
Video VAE 3 minimax_h3_lynnreal_light_vae_int8_convrot.safetensors
Audio VAE 4 minimax_h3_audio_vae_fp32.safetensors
SAM checkpoint 48 sam3.1_multiplex_fp16.safetensors

The preview configuration also references taeh3.safetensors. Confirm the requirements of the installed preview node rather than assuming every referenced asset is included.

The VDN composer stores OpenVDN/vdn-minimax-h3 and the stage stage_dmd_8nfe. The notes name T8mars/comfyui-minimax-h3-audio-T8, SAM, MaskVidExperiments, and VideoHelperSuite as relevant dependencies. These are source-provided identifiers, not a verified installation recipe. Check the appropriate upstream instructions and compatible versions; the workflow does not supply a tested dependency lockfile or a complete license grant.

There is also a model-name discrepancy: note 28 mentions a different Ref2VA filename ending in Raw2, while loader 30 selects the filename shown above. Do not silently treat those names as interchangeable.

Inspect the current controls, not just the labels

Several values deserve attention before loading personal footage:

  • LoRA strength: node 121 stores strength_model=1.
  • Tracking: node 53 stores detection_threshold=0.5, max_objects=1, and detect_interval=1.
  • Sigma shift: node 38 stores video/audio values of 12 and 3.
  • VDN options: node 124 stores verify_hashes=false and allow_structural_base=true. Neither setting certifies the installed weights or the combination's compatibility.
  • Uncrop feather: node 95 stores feather=16 and resize_method=auto.

The two resolution selectors share an aspect-ratio connection from node 44, whose saved value is 16:9. They do not share the same megapixel setting: preprocessing node 45 stores 1, while generation node 20 stores 0.6000000000000001, approximately 0.6. That differs from the note's advice to keep the resolution selections consistent. Inspect this distinction rather than claiming that both stages already use identical dimensions.

Connected inputs also override the usefulness of reading isolated widget defaults. Node 11 receives width, height, and length through links. Its saved 1344, 768, and 124 widget values should not be reported as the effective settings without considering those connections.

Duration is a frame-count calculation

The saved duration is 10 seconds at node 17. Node 19 calculates the frame count with:

max(5, round(a * 24)) + (5 - (max(5, round(a * 24)) % 17)) % 17
Enter fullscreen mode Exit fullscreen mode

For the saved input a=10, this expression evaluates to 243, not 240. The integer output feeds the video loader's frame cap and the H3 reference node's length. The loader's stored frame_load_cap=0 therefore cannot be read in isolation as the current effective cap.

Both the loader and the video-combine node store a frame rate of 24. The 243-frame calculation is a configuration calculation—not evidence that an actual 243-frame video has been produced. A preview cached inside an export is not a new execution record.

The author recommends beginning with a continuous 3–5-second shot. That is a practical recommendation from the transcript, not the saved 10-second default. Change the duration deliberately and inspect the resulting frame count.

Follow the mask, crop, and reference paths

The source video enters node 43, then passes through resize node 46. Those preprocessed frames feed both SAM tracking and the H3 video-reference input.

The tracking path is:

SAM3_VideoTrack → SAM3_TrackToMask → MVEx_MaskCleanup
                 → MVEx_SubjectCrop
Enter fullscreen mode Exit fullscreen mode

The crop node sends cropped frames to the video VAE encoder and cropped masks to MVEx_MaskToLatentSpace. Those branches meet at a latent noise-mask node. The crop also produces bounding boxes used later by MVEx_SubjectUncrop.

Reference image node 9 connects to the H3 reference input. A second image loader, node 126, is connected too, but it is saved with mode=4; check its bypass state in the installed interface before treating it as a second enabled reference. Stored image filenames do not prove that either reference file is bundled.

The model path connects the selected H3 model, Character Swap LoRA, sigma shift, VDN composer, and VDN execution plan. The plan supplies the sampler and sigmas to SamplerCustomAdvanced. This is the graph's selected VDN8 configuration; it is not a measured speedup, and the notes distinguish it from a separate 8+4 two-stage upscale workflow. Do not add an old Turbo LoRA simply because another example used one.

A practical first-run checklist

  1. Import the graph and resolve missing node types and compatible assets before queueing. Do not substitute an arbitrary encoder or VAE just because its dropdown entry loads.
  2. Select a real source video at node 43 and a replacement reference at node 9. Use footage and likenesses you have permission to process.
  3. Update the replacement prompt and the separate SAM target description. Remove example-specific descriptions that do not match your footage.
  4. Start with a short continuous shot, then check the duration formula, both resolution selectors, and the loader's frame-rate setting.
  5. Inspect the tracking, crop, and mask previews. If the wrong person is selected or the crop loses the subject, correct that before evaluating identity transfer.
  6. Only after those checks, run the full graph and review the saved result for target selection, boundary artifacts, identity continuity, timing, and audio alignment.

What the final output does not prove

The uncrop node uses node 46's preprocessed frames as its background canvas, not a direct connection to untouched source frames. The workflow's preservation intent should not become a promise that every background pixel remains identical to the original file.

Audio is not wired as a simple original-track copy either. The source audio enters an audio VAE encoder, a latent mask, the joint audio/video latent path, sampling, and an audio decoder before reaching the video-combine node. The zero-valued audio mask expresses a configuration choice; it does not establish bit-exact preservation. The transcript also warns that footage without an audio track may need additional handling.

The output node is configured for H.264 MP4, yuv420p, CRF 19, 24 fps, and prefix minimaxh3. Those settings are not proof of successful export. No new runtime, VRAM, timing, fidelity, or compatibility results are supplied here.

Watch the author-provided full tutorial for the narrated context. Use the graph's previews to answer the most important question before the render: is the workflow editing the person you actually intended to replace?

Episode resources

Top comments (0)