Extensions/ComfyUI-H3-Edit
ComfyUI Extension

ComfyUI-H3-Edit

All-in-one MiniMax-H3 video editing custom node for ComfyUI with filmstrip trimming, real-time native SAM 3.1 masking, built-in Edit LoRA, native Context Windows, Pass 2 Latent Upscale, VideoDeflicker, and full-video splice-back.

By javawock7618·Created about 18 hours ago·Updated about 18 hours ago· 0
javawock7618/ComfyUI-H3-Edit
Nodes—
On cloudLocal install
Stars0
Updatedabout 18 hours ago
Readme

ComfyUI-H3-Edit

日本語版 README はこちら

An all-in-one MiniMax-H3 video editing custom node for ComfyUI. Load and trim videos on a filmstrip timeline, preview and track native SAM 3.1 masks in real time, apply the built-in vfx_edit LoRA with MiniMaxH3AddGuide, run native Context Windows (STATIC_STANDARD), upscale drafts back to original resolution via MiniMaxH3LatentUpscaleWithModel, deflicker with VideoDeflicker, and splice the edited range seamlessly back into the full source video — all inside a single compact 2-column UI compatible with both Nodes 1.0 and Nodes 2.0.

This custom node was created with Gemini.


Features

  • Interactive Video Loader & Filmstrip Trim Bar
    • Load videos via Load Video or drag-and-drop directly onto the preview stage.
    • Dedicated filmstrip timeline with zoom (- / 1.0x / +), thumbnail toggle (ON / OFF), All reset, Shift+Click edge snap, playback controls (▶ / ⏸), seek bar, mute, and volume slider.
    • Automatic alignment to MiniMax-H3's 17k + 5 frame grid during generation (Snap 17k+5), trimmed cleanly back to the exact selected range after decode.
  • Real-Time Native SAM 3.1 Masking
    • Uses ComfyUI's native SAM 3.1 pipeline (CheckpointLoaderSimple → CLIPTextEncode → SAM3_VideoTrack → SAM3_TrackToMask).
    • 🎯 Preview segments the current frame instantly; 🎬 Track tracks across the trimmed range and caches masks for zero-recompute execution; ✕ clears both the mask and SAM prompt.
    • SAM Threshold (0.05–0.99, default 0.50), plus real-time preview for Mask Grow, Mask Blur, Mask Invert, and overlay opacity.
    • Mask application modes: post_composite (recommended for natural lighting/shadows), latent_mask, both, or off.
  • 3 Editing Pipelines & Built-In Edit LoRA
    • addguide_edit (default): Injects source video via MiniMaxH3AddGuide (frame_idx=0) with built-in Edit LoRA selection (e.g., Alissonerdx/Minimax-H3-ComfyUI vfx_edit LoRA) and automatic vfx_edit: prefixing. Also supports optional ref_image for First-Frame-Propagate (FFP) workflows.
    • refvideo_no_lora: Reference-video editing via MiniMaxH3ReferenceToVideo without LoRA.
    • latent_inpaint: Mask-guided latent inpainting without LoRA.
    • External prompt_input socket automatically overrides and grays out the in-node Edit Prompt box when connected.
  • Native Context Windows + Draft-to-Full Latent Upscale + Deflicker
    • Applies ComfyUI's native IndexListContextHandler (STATIC_STANDARD, pyramid / overlap-linear / flat, FreeNoise) with MiniMax-H3 native defaults (length = 124, overlap = 39) — not CCW.
    • Draft generation (auto_960, 0.5, 0.67, 0.75, 1.0) followed by Pass 2 MiniMaxH3LatentUpscaleWithModel back to original video resolution using clean pre-AddGuide conditioning (default upscale_denoise = 0.30).
    • Built-in VideoDeflicker (default 1.00, auto-skipped when optical_flow_model is unconnected).
    • splice_full_video seamlessly splices the edited range back into the original full-length video and audio, or select edited_segment_only.
  • Compact 2-Column Smart UI
    • Collapsible I/O slots (▾ I/O / ▸ I/O) with live connection counts.
    • Folder-style settings tabs (Edit / Mask, Sampler / Ctx, Up / Out), horizontal drag numeric inputs, native-style 32-bit seed shuffle toggle, and full English tooltips.

Installation

Via ComfyUI Registry / ComfyUI-Manager

Search for ComfyUI-H3-Edit in ComfyUI-Manager or install via comfy-cli:

comfy node registry-install comfyui-h3-edit

Manual Installation

cd ComfyUI/custom_nodes
git clone https://github.com/javawock7618/ComfyUI-H3-Edit.git
cd ComfyUI-H3-Edit
pip install -r requirements.txt

Restart ComfyUI and hard-reload your browser (Ctrl + F5).


Quick Usage

  1. Add ComfyUI-H3-Edit (ComfyUI-H3-Edit category) and connect your MiniMax-H3 model, clip, vae_video, and vae_audio (plus optional latent_upscale_model, optical_flow_model, ref_image, or prompt_input).
  2. Drop a video onto the preview stage (or click Load Video) and drag the blue trim handles on the filmstrip to select the range to edit.
  3. In the Edit / Mask tab:
    • Select your vfx_edit LoRA under Edit LoRA (in addguide_edit mode).
    • (Optional) Select a native SAM 3.1 Ckpt, enter a target in the SAM prompt box (e.g. person, jacket), click 🎯 Preview to check a frame or 🎬 Track to track the trimmed range, and fine-tune SAM Threshold, Mask Grow, and Mask Blur.
  4. Enter your edit instruction in Edit Prompt (or connect prompt_input), then queue the prompt.

Inputs & Outputs

  • Required Inputs: model, clip, vae_video, vae_audio
  • Optional Inputs: prompt_input, ref_image, latent_upscale_model, optical_flow_model
  • Outputs:
    • images (IMAGE): Full spliced video (or edited segment only, depending on Output Scope)
    • audio (AUDIO): Original audio (keep_original), H3 generated audio (generated_h3), or None (mute)
    • mask (MASK): Processed SAM 3.1 mask aligned to images
    • edited_segment (IMAGE): Edited range frames only
    • fps (FLOAT): Source video frame rate

Included Workflow

  • workflows/ComfyUI-H3-Edit.json: Example workflow wired with MiniMax-H3 loaders (Model / CLIP / Video & Audio VAE / Latent Upscale Model / Optical Flow), optional llama.cpp prompt enhancer (prompt_input), ComfyUI-H3-Edit, and jvX_PreviewVideo.

License

GNU General Public License v3.0 — see LICENSE.