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.

Add Advanced motion transfer

D3vozade3863f2367
diff --git a/README.md b/README.md
index 284edaa..6764353 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,8 @@ The app is a small Next.js front end over a ComfyUI workflow. It uses [`@comfyor
## Modes
- **Simple motion transfer**: available. One character replaces the main person (the one who fills the most of the frame). Runs `workflows/simple.api.json`, exported from `H3 One-Click Single Swap (DMAD 6 step).json`.
-- **Advanced motion transfer** (several people, pick who becomes who) and **Object swap**: coming soon, as separate workflow files.
+- **Advanced motion transfer**: available. 1–4 characters, each with an optional role; every tracked person is matched to a role per shot, and people without a character stay untouched. Runs `workflows/advanced.api.json`, exported from `H3 One-Click Advanced Swap (DMAD 6 step).json`; **One pass per person** (two characters) runs `workflows/advanced_maxq.api.json`.
+- **Object swap**: coming soon.
## Requirements
@@ -25,7 +26,7 @@ Install these into `ComfyUI/custom_nodes` (ComfyUI Manager finds the first three
| [ComfyUI-Fantastic-MiniMaxH3-PromptBuilder](https://github.com/Adudeguyman/ComfyUI-Fantastic-MiniMaxH3-PromptBuilder) | masked video-edit latent |
| [ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes) | Grow Mask With Blur |
| [ComfyUI-VideoHelperSuite](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite) | video loading |
-| `comfyui-h3-oneclick-swap` | swap plan, people mask, grey mannequins, cut finder, shot list (TODO: link the published pack) |
+| `comfyui-h3-oneclick-swap` | swap plan, people and role masks, grey mannequins, track labelling, cut finder, shot list (TODO: link the published pack) |
Restart ComfyUI after installing them.
@@ -75,6 +76,7 @@ A 6 s clip at 480p takes about 6–13 minutes on a 4060 Ti, most of it in H3 sam
- **Hat fix** also masks the hat, so it is replaced too (about 45 s more per clip).
- **Check mask** runs only SAM and the mask (about a minute per 3 s of video) and shows a preview you can scrub frame by frame: cyan is the area H3 regenerates, orange the tracked person, and on the right the grey mannequin H3 copies the motion from. Anything outside the cyan area stays as it is. If the character is cut off or too much background changes, set **Mask margin** (Tight, Normal, Loose) and check again; a re-check takes seconds.
- Change the **seed** (under Advanced) for a new take. Running the same inputs again resumes from the last finished clip.
+- **Advanced mode:** give roles as `the drummer`, optionally with how they look after ` - ` (`the drummer - man in a cap`); the look only helps match people and never reaches H3. **One pass per person** gives each of two characters their own H3 pass with only their photo (about twice the time). Check mask is Simple-only for now.
## How it works
@@ -89,6 +91,8 @@ Each clip, SAM 3.1 tracks everyone at 1008 px (its own working size), and H3 Peo
`workflows/mask.api.json` is the mask check: the same SAM, People Mask and grow settings over the whole video, with the mask tinted over the frames next to the mannequin, saved as an MP4.
+Advanced mode labels the people before it masks them. Per clip, H3 Track Crops shows each SAM track once per shot (the person alone, and the frame with them boxed) to Qwen3-VL 8B, which names the subject or "other"; H3 Track Roles reads that answer and settles a subject named twice in one shot by colour. H3 Role Mask builds the edit mask from the labelled tracks only, and the shot-list describer sees each labelled person outlined in their subject's colour, so the prompt names the same people the masks do. `lib/advanced.ts` finds nodes by title, drops unused picture branches and, without the hat fix, the hat nodes; the exports are made from `user/default/oneclick_advanced_build.js` with every optional group on.
+
To change the workflow, edit `user/default/oneclick_single_build.js` in ComfyUI (or the workflow itself), enable the hat-fix group, export **Workflow (API)**, and replace `workflows/simple.api.json`. If node ids change, update `NODES` in `lib/simple.ts`. `npm test` checks the pruning against the export.
## Deploy on the Comfy Developer Platform
diff --git a/app/api/jobs/[id]/events/route.ts b/app/api/jobs/[id]/events/route.ts
index 9c27c83..14e0abe 100644
--- a/app/api/jobs/[id]/events/route.ts
+++ b/app/api/jobs/[id]/events/route.ts
@@ -1,4 +1,4 @@
-import { getJob, loadGraph, publicJob, rawJobEvents, TERMINAL } from "../../../../../lib/comfy.ts";
+import { getJob, JOB_KINDS, loadGraph, publicJob, rawJobEvents, TERMINAL, type JobKind } from "../../../../../lib/comfy.ts";
import { nodeDescriber } from "../../../../../lib/progress.ts";
export const runtime = "nodejs";
@@ -8,7 +8,8 @@ export const dynamic = "force-dynamic";
// numbers. One upstream connection per request; the page's EventSource reconnects.
export async function GET(request: Request, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
- const describe = nodeDescriber(await loadGraph(new URL(request.url).searchParams.get("kind") === "mask" ? "mask" : "simple"));
+ const kind = new URL(request.url).searchParams.get("kind") ?? "simple";
+ const describe = nodeDescriber(await loadGraph(JOB_KINDS.includes(kind as JobKind) ? (kind as JobKind) : "simple"));
const encoder = new TextEncoder();
const stream = new ReadableStream({
diff --git a/app/api/jobs/route.ts b/app/api/jobs/route.ts
index 6b0154e..a299b30 100644
--- a/app/api/jobs/route.ts
+++ b/app/api/jobs/route.ts
@@ -1,5 +1,6 @@
import { NextResponse } from "next/server";
-import { submitMask, submitSimple } from "../../../lib/comfy.ts";
+import { submitAdvanced, submitMask, submitSimple } from "../../../lib/comfy.ts";
+import { MAX_CHARACTERS } from "../../../lib/advanced.ts";
import { CLIP_SECONDS, MARGINS, MAX_SEED, RESOLUTIONS, type Margin, type Resolution, type SimpleSettings } from "../../../lib/simple.ts";
export const runtime = "nodejs";
@@ -17,11 +18,13 @@ function parseMask(form: FormData) {
return { hatFix: form.get("hat_fix") === "true", margin: margin as Margin };
}
-function parseSimple(form: FormData) {
- const picture = form.get("picture");
+function parsePicture(picture: FormDataEntryValue | null) {
if (!(picture instanceof File) || picture.size === 0) throw new Error("Add a character photo.");
if (!picture.type.startsWith("image/")) throw new Error("The character photo must be an image.");
+ return picture;
+}
+function parseRun(form: FormData) {
const resolution = String(form.get("resolution"));
if (!RESOLUTIONS.includes(resolution as Resolution)) throw new Error("Choose a supported resolution.");
const seed = Number(form.get("seed"));
@@ -31,10 +34,24 @@ function parseSimple(form: FormData) {
throw new Error(`Clip length must be ${CLIP_SECONDS.min}-${CLIP_SECONDS.max} s.`);
}
- const settings: SimpleSettings = { role: String(form.get("role") ?? "").slice(0, 200), resolution: resolution as Resolution, ...parseMask(form), seed, clipSeconds };
+ return { resolution: resolution as Resolution, ...parseMask(form), seed, clipSeconds };
+}
+
+function parseSimple(form: FormData) {
+ const picture = parsePicture(form.get("picture"));
+ const settings: SimpleSettings = { role: String(form.get("role") ?? "").slice(0, 200), ...parseRun(form) };
return { picture, settings };
}
+function parseAdvanced(form: FormData) {
+ const pictures = form.getAll("picture").map(parsePicture);
+ if (pictures.length < 1 || pictures.length > MAX_CHARACTERS) throw new Error(`Add 1-${MAX_CHARACTERS} character photos.`);
+ const maxQuality = form.get("max_quality") === "true";
+ if (maxQuality && pictures.length !== 2) throw new Error("One pass per person needs exactly two characters.");
+ const roles = form.getAll("role").map((role) => String(role).slice(0, 200));
+ return { pictures, maxQuality, settings: { roles, ...parseRun(form) } };
+}
+
export async function POST(request: Request) {
let submit: () => ReturnType<typeof submitSimple>;
try {
@@ -47,8 +64,11 @@ export async function POST(request: Request) {
} else if (mode === "simple") {
const { picture, settings } = parseSimple(form);
submit = () => submitSimple(video, picture, settings);
+ } else if (mode === "advanced") {
+ const { pictures, maxQuality, settings } = parseAdvanced(form);
+ submit = () => submitAdvanced(video, pictures, settings, maxQuality);
} else {
- throw new Error("Only Simple motion transfer is available so far.");
+ throw new Error("Unknown mode.");
}
} catch (error) {
return NextResponse.json({ error: error instanceof Error ? error.message : "Invalid request." }, { status: 400 });
diff --git a/components/openjutsu.tsx b/components/openjutsu.tsx
index 8030be6..34e782f 100644
--- a/components/openjutsu.tsx
+++ b/components/openjutsu.tsx
@@ -5,9 +5,11 @@ import type { PublicJob } from "../lib/comfy.ts";
import type { NodeInfo } from "../lib/progress.ts";
import { clipCount, clipStarts } from "../lib/clips.ts";
import { CLIP_SECONDS, MARGINS, MAX_SEED, RESOLUTIONS, type Margin, type Resolution } from "../lib/simple.ts";
+import { MAX_CHARACTERS } from "../lib/advanced.ts";
type Character = { file: File; url: string; role: string };
-type Kind = "simple" | "mask";
+type Mode = "simple" | "advanced";
+type Kind = "simple" | "mask" | "advanced" | "advanced_maxq";
type Run = { id: string; kind: Kind; margin: Margin; clips: number; clipSeconds: number; startedAt: number };
type Progress = NodeInfo & { step: number | null; steps: number | null };
@@ -16,9 +18,9 @@ const RUN_KEY = "openjutsu.run";
const MODES = [
{ id: "simple", title: "Simple motion transfer", text: "Swap the main person in a video for your character.", ready: true },
- { id: "advanced", title: "Advanced motion transfer", text: "Several people, pick who becomes who.", ready: false },
+ { id: "advanced", title: "Advanced motion transfer", text: "Several people, pick who becomes who.", ready: true },
{ id: "object", title: "Object swap", text: "Replace a prop or product instead of a person.", ready: false },
-];
+] as const;
function readRun(): Run | null {
try {
@@ -47,7 +49,11 @@ function elapsed(ms: number) {
// Rough share of a clip done at each node: the sampler is most of the time.
function clipShare(progress: Progress) {
- if (progress.classType === "SamplerCustomAdvanced") return 0.15 + 0.75 * (progress.steps ? (progress.step ?? 0) / progress.steps : 0);
+ const steps = progress.steps ? (progress.step ?? 0) / progress.steps : 0;
+ // one pass per person samples twice per clip
+ if (progress.classType === "SamplerCustomAdvanced" && progress.title.startsWith("Pass 1:")) return 0.1 + 0.4 * steps;
+ if (progress.classType === "SamplerCustomAdvanced" && progress.title.startsWith("Pass 2:")) return 0.5 + 0.4 * steps;
+ if (progress.classType === "SamplerCustomAdvanced") return 0.15 + 0.75 * steps;
if (["VAEDecode", "VAEDecodeAudio", "MiniMaxH3LoopTrim", "MiniMaxH3ChainSegmentSave", "MiniMaxH3ChainReview"].includes(progress.classType)) return 0.95;
return 0.05;
}
@@ -81,8 +87,10 @@ function DropZone({ accept, onFiles, multiple, children, className }: {
}
export function Openjutsu() {
+ const [mode, setMode] = useState<Mode>("simple");
const [video, setVideo] = useState<{ file: File; url: string; duration: number } | null>(null);
- const [character, setCharacter] = useState<Character | null>(null);
+ const [characters, setCharacters] = useState<Character[]>([]);
+ const [maxQuality, setMaxQuality] = useState(false);
const [resolution, setResolution] = useState<Resolution>("736p");
const [hatFix, setHatFix] = useState(false);
const [margin, setMargin] = useState<Margin>("normal");
@@ -141,22 +149,36 @@ export function Openjutsu() {
probe.src = url;
}
- function chooseCharacter(files: File[]) {
- const file = files[0];
- if (!file) return;
- if (character) URL.revokeObjectURL(character.url);
- setCharacter({ file, url: URL.createObjectURL(file), role: character?.role ?? "" });
+ // Simple mode uses only the first character; the others are kept for switching back.
+ const limit = mode === "simple" ? 1 : MAX_CHARACTERS;
+ const shown = characters.slice(0, limit);
+ const character = characters[0] ?? null;
+ const onePassEach = mode === "advanced" && maxQuality && shown.length === 2;
+
+ function addCharacters(files: File[]) {
+ if (!files.length) return;
+ if (mode === "simple" && character) {
+ URL.revokeObjectURL(character.url);
+ setCharacters([{ file: files[0], url: URL.createObjectURL(files[0]), role: character.role }, ...characters.slice(1)]);
+ return;
+ }
+ const added = files.slice(0, limit - characters.length).map((file) => ({ file, url: URL.createObjectURL(file), role: "" }));
+ setCharacters([...characters, ...added]);
}
- function removeCharacter() {
- if (character) URL.revokeObjectURL(character.url);
- setCharacter(null);
+ function removeCharacter(index: number) {
+ URL.revokeObjectURL(characters[index].url);
+ setCharacters(characters.filter((_, i) => i !== index));
+ }
+
+ function setRole(index: number, role: string) {
+ setCharacters(characters.map((c, i) => (i === index ? { ...c, role } : c)));
}
const clips = video?.duration ? clipCount(video.duration, clipSeconds) : 0;
async function submit(kind: Kind) {
- if (!video || (kind === "simple" && !character)) return;
+ if (!video || (kind !== "mask" && !character)) return;
setSubmitting(true);
setFormError("");
const form = new FormData();
@@ -171,6 +193,17 @@ export function Openjutsu() {
form.set("seed", String(seed));
form.set("clip_seconds", String(clipSeconds));
}
+ if (kind === "advanced" || kind === "advanced_maxq") {
+ form.set("mode", "advanced");
+ for (const c of shown) {
+ form.append("picture", c.file);
+ form.append("role", c.role);
+ }
+ form.set("max_quality", String(kind === "advanced_maxq"));
+ form.set("resolution", resolution);
+ form.set("seed", String(seed));
+ form.set("clip_seconds", String(clipSeconds));
+ }
try {
const response = await fetch("/api/jobs", { method: "POST", body: form });
const body = await response.json();
@@ -217,11 +250,14 @@ export function Openjutsu() {
</header>
<nav className="modes" aria-label="Mode">
- {MODES.map((mode) => (
- <button key={mode.id} className={`mode ${mode.ready ? "active" : ""}`} disabled={!mode.ready} aria-pressed={mode.ready}>
- <strong>{mode.title}</strong>
- <span>{mode.text}</span>
- {!mode.ready && <em>Coming soon</em>}
+ {MODES.map((m) => (
+ <button
+ key={m.id} className={`mode ${m.id === mode ? "active" : ""}`} disabled={!m.ready || !!run} aria-pressed={m.id === mode}
+ onClick={() => m.id !== "object" && setMode(m.id)}
+ >
+ <strong>{m.title}</strong>
+ <span>{m.text}</span>
+ {!m.ready && <em>Coming soon</em>}
</button>
))}
</nav>
@@ -229,7 +265,7 @@ export function Openjutsu() {
{run ? (
<RunView
run={run} job={job} progress={progress} preview={preview} streamError={streamError} now={now}
- onCancel={cancel} onReset={reset} onGenerate={video && character && !submitting ? () => submit("simple") : null}
+ onCancel={cancel} onReset={reset} onGenerate={video && character && !submitting && mode === "simple" ? () => submit("simple") : null}
margin={margin} onMargin={setMargin} onRecheck={video && !submitting ? () => submit("mask") : null}
/>
) : (
@@ -254,33 +290,43 @@ export function Openjutsu() {
</div>
<div className="panel">
- <h2><span>2</span> Character</h2>
+ <h2><span>2</span> {mode === "simple" ? "Character" : "Characters"}</h2>
<div className="characters">
- {character ? (
- <div className="character">
- <img src={character.url} alt="Character" />
- <button className="remove" onClick={removeCharacter} aria-label="Remove the character">×</button>
+ {shown.map((c, i) => (
+ <div className="character" key={c.url}>
+ <img src={c.url} alt={`Character ${i + 1}`} />
+ <button className="remove" onClick={() => removeCharacter(i)} aria-label={`Remove character ${i + 1}`}>×</button>
<label>
<span>Who do they replace? (optional)</span>
<input
- value={character.role}
+ value={c.role}
maxLength={200}
- placeholder="e.g. the singer"
- onChange={(event) => setCharacter({ ...character, role: event.target.value })}
+ placeholder={i === 0 ? "e.g. the singer" : "e.g. the drummer"}
+ onChange={(event) => setRole(i, event.target.value)}
/>
</label>
</div>
- ) : (
- <DropZone accept="image/*" onFiles={chooseCharacter} className="add">
+ ))}
+ {shown.length < limit && (
+ <DropZone accept="image/*" onFiles={addCharacters} multiple={mode === "advanced"} className="add">
<strong>+</strong>
<span>Drop a photo</span>
</DropZone>
)}
</div>
- <p className="hint">
- The character replaces the main person in the video, the one who fills the most of the frame. Everyone else stays.
- To name them for the prompt, use a role (&ldquo;the singer&rdquo;), not clothes.
- </p>
+ {mode === "simple" ? (
+ <p className="hint">
+ The character replaces the main person in the video, the one who fills the most of the frame. Everyone else stays.
+ To name them for the prompt, use a role (&ldquo;the singer&rdquo;), not clothes.
+ </p>
+ ) : (
+ <p className="hint">
+ Up to {MAX_CHARACTERS} characters. In every clip each tracked person is matched to a role; people without a
+ character (extras, passers-by) stay as they are. Name roles (&ldquo;the drummer&rdquo;), not clothes, and add how they look
+ after &ldquo; - &rdquo; to help the matching (&ldquo;the drummer - man in a cap&rdquo;). Blank roles go to the people with the
+ most screen time.
+ </p>
+ )}
</div>
</section>
@@ -295,12 +341,19 @@ export function Openjutsu() {
</div>
</div>
<label className="setting toggle">
- <span>Hat fix <small>Also replaces hats (about 45 s more per clip).</small></span>
+ <span>Hat fix <small>Also replaces hats{mode === "advanced" ? " worn by the people being replaced" : ""} (about 45 s more per clip).</small></span>
<input type="checkbox" checked={hatFix} onChange={(event) => setHatFix(event.target.checked)} />
<i aria-hidden />
</label>
+ {mode === "advanced" && (
+ <label className="setting toggle">
+ <span>One pass per person <small>{shown.length === 2 ? "Each character gets their own H3 pass with only their photo. About twice the time." : "Needs exactly two characters."}</small></span>
+ <input type="checkbox" checked={onePassEach} disabled={shown.length !== 2} onChange={(event) => setMaxQuality(event.target.checked)} />
+ <i aria-hidden />
+ </label>
+ )}
<div className="setting">
- <span>Mask margin <small>Room around the person for a differently built character. Check mask shows it.</small></span>
+ <span>Mask margin <small>Room around the person for a differently built character.{mode === "simple" ? " Check mask shows it." : ""}</small></span>
<MarginPicker value={margin} onChange={setMargin} />
</div>
<details>
@@ -322,12 +375,12 @@ export function Openjutsu() {
<div className="go">
{formError && <p className="error">{formError}</p>}
<div className="row">
- <button className="secondary" disabled={!video || submitting} onClick={() => submit("mask")}>Check mask</button>
- <button className="primary" disabled={!video || !character || submitting} onClick={() => submit("simple")}>
+ {mode === "simple" && <button className="secondary" disabled={!video || submitting} onClick={() => submit("mask")}>Check mask</button>}
+ <button className="primary" disabled={!video || !character || submitting} onClick={() => submit(mode === "simple" ? "simple" : onePassEach ? "advanced_maxq" : "advanced")}>
{submitting ? "Uploading…" : "Generate"}
</button>
</div>
- <small>{clips ? `${clips} clip${clips > 1 ? "s" : ""} at ${resolution}` : "Add a video and a character photo."}</small>
+ <small>{clips ? `${clips} clip${clips > 1 ? "s" : ""} at ${resolution}` : `Add a video and ${mode === "simple" ? "a character photo" : "character photos"}.`}</small>
</div>
</>
)}
diff --git a/lib/advanced.ts b/lib/advanced.ts
new file mode 100644
index 0000000..b33519a
--- /dev/null
+++ b/lib/advanced.ts
@@ -0,0 +1,79 @@
+// Advanced motion transfer: 1-4 characters, SAM tracks labelled by role, only the labelled people regenerated.
+// workflows/advanced.api.json (one pass) and advanced_maxq.api.json (one pass per person, 2 characters) are exported
+// with every picture and the hat fix enabled; each request prunes what it does not use. Nodes are found by title, as
+// the builder (ComfyUI user/default/oneclick_advanced_build.js) names them.
+import { MARGINS, isLink, type ApiGraph, type Margin, type Resolution } from "./simple.ts";
+
+export const MAX_CHARACTERS = 4;
+
+export type AdvancedSettings = {
+ roles: string[]; // one per picture, "" to let the describer name them
+ resolution: Resolution;
+ hatFix: boolean;
+ margin: Margin;
+ seed: number;
+ clipSeconds: number;
+};
+
+const HAT = /\bhats?\b/i;
+const PLAN = "Swap Plan (roles, seed, size)";
+export const VIDEO = "Source video (people get replaced)";
+
+export function nodeByTitle(graph: ApiGraph, title: string) {
+ const ids = Object.keys(graph).filter((id) => graph[id]._meta?.title === title);
+ if (ids.length !== 1) throw new Error(`Expected one "${title}" node in the advanced workflow, found ${ids.length}.`);
+ return ids[0];
+}
+
+export function pictureCount(graph: ApiGraph) {
+ return Object.values(graph).filter((node) => node.class_type === "LoadImage" && /^Picture \d$/.test(node._meta?.title ?? "")).length;
+}
+
+// Names for pictures left without a role when others have one, as the Swap Plan's own defaults.
+function ordinal(i: number, count: number) {
+ return count === 1 ? "the main person" : `the person with the ${["", "second ", "third ", "fourth "][i]}most screen time`;
+}
+
+export function pruneAdvanced(source: ApiGraph, pictures: number, settings: AdvancedSettings): ApiGraph {
+ const graph: ApiGraph = structuredClone(source);
+ const available = pictureCount(graph);
+ if (pictures < 1 || pictures > available) throw new Error(`This mode takes 1-${available} character photos.`);
+
+ const removed = new Set<string>();
+ // Unused pictures: the photo, its shrink and its describer go; inputs that read them are dropped.
+ for (let k = pictures + 1; k <= available; k++) {
+ const load = nodeByTitle(graph, `Picture ${k}`);
+ const shrink = Object.keys(graph).find((id) => isLink(graph[id].inputs.image) && graph[id].inputs.image[0] === load && graph[id].class_type === "ImageScaleToMaxDimension");
+ const describe = nodeByTitle(graph, `Describe picture ${k}`);
+ for (const id of [load, shrink, describe]) if (id) removed.add(id);
+ }
+ // Hat fix off: drop the hat nodes; whatever read "people + hats" reads the people mask instead.
+ const bypass = new Map<string, unknown>();
+ if (!settings.hatFix) {
+ for (const [id, node] of Object.entries(graph)) {
+ if (!HAT.test(node._meta?.title ?? "")) continue;
+ removed.add(id);
+ if (node.class_type === "MaskComposite" && node.inputs.operation === "add") bypass.set(id, node.inputs.destination);
+ }
+ }
+ for (const id of removed) delete graph[id];
+ for (const [id, node] of Object.entries(graph)) {
+ for (const [name, value] of Object.entries(node.inputs)) {
+ if (!isLink(value) || !removed.has(value[0])) continue;
+ if (bypass.has(value[0])) node.inputs[name] = bypass.get(value[0]);
+ else if (node._meta?.title === PLAN || name.startsWith("ref_images.")) delete node.inputs[name];
+ else throw new Error(`Node ${id}.${name} still links to removed node ${value[0]}.`);
+ }
+ }
+
+ for (const node of Object.values(graph)) {
+ if (node.class_type === "GrowMaskWithBlur" && / grow mask /.test(node._meta?.title ?? "")) node.inputs.expand = MARGINS[settings.margin];
+ }
+ const plan = graph[nodeByTitle(graph, PLAN)].inputs;
+ const roles = settings.roles.slice(0, pictures).map((role) => role.replace(/\s+/g, " ").trim());
+ plan.resolution = settings.resolution;
+ plan.seed = settings.seed;
+ plan.clip_seconds = settings.clipSeconds;
+ plan.roles = roles.some(Boolean) ? roles.map((role, i) => role || ordinal(i, pictures)).join("\n") : "";
+ return graph;
+}
diff --git a/lib/comfy.ts b/lib/comfy.ts
index ca6fef8..3458709 100644
--- a/lib/comfy.ts
+++ b/lib/comfy.ts
@@ -3,6 +3,7 @@ import { join } from "node:path";
import { Comfy, resolveBaseUrl, resolveCredentials, type Job } from "@comfyorg/sdk";
import { ComfyLow } from "@comfyorg/sdk/low";
import { MASK_NODES, NODES, pruneMask, pruneSimple, type ApiGraph, type Margin, type SimpleSettings } from "./simple.ts";
+import { VIDEO, nodeByTitle, pruneAdvanced, type AdvancedSettings } from "./advanced.ts";
export type PublicJob = {
id: string;
@@ -26,7 +27,8 @@ export function rawJobEvents(job: Job, signal: AbortSignal) {
return new ComfyLow(resolveBaseUrl(), resolveCredentials(), { clientInfo: "openjutsu" }).getJobEvents(job.urls.events || job.id, { signal });
}
-export type JobKind = "simple" | "mask";
+export const JOB_KINDS = ["simple", "mask", "advanced", "advanced_maxq"] as const;
+export type JobKind = (typeof JOB_KINDS)[number];
export async function loadGraph(kind: JobKind): Promise<ApiGraph> {
return JSON.parse(await readFile(join(process.cwd(), "workflows", `${kind}.api.json`), "utf8"));
@@ -69,6 +71,15 @@ export async function submitSimple(video: File, picture: File, settings: SimpleS
return publicJob(await comfy.submit(workflow));
}
+export async function submitAdvanced(video: File, pictures: File[], settings: AdvancedSettings, maxQuality: boolean) {
+ const comfy = client();
+ const graph = pruneAdvanced(await loadGraph(maxQuality ? "advanced_maxq" : "advanced"), pictures.length, settings);
+ const workflow = comfy.workflows.fromJson(graph);
+ workflow.setInput(nodeByTitle(graph, VIDEO), "video", await upload(comfy, video));
+ for (const [i, picture] of pictures.entries()) workflow.setInput(nodeByTitle(graph, `Picture ${i + 1}`), "image", await upload(comfy, picture));
+ return publicJob(await comfy.submit(workflow));
+}
+
export async function submitMask(video: File, hatFix: boolean, margin: Margin) {
const comfy = client();
const workflow = comfy.workflows.fromJson(pruneMask(await loadGraph("mask"), hatFix, margin));
diff --git a/lib/progress.ts b/lib/progress.ts
index 1688b3b..b74611f 100644
--- a/lib/progress.ts
+++ b/lib/progress.ts
@@ -1,4 +1,4 @@
-import { NODES, isLink, type ApiGraph } from "./simple.ts";
+import { isLink, type ApiGraph } from "./simple.ts";
export type NodeInfo = { title: string; classType: string; clip: number | null };
@@ -6,6 +6,8 @@ export type NodeInfo = { title: string; classType: string; clip: number | null }
// node ids with "<parent>.<call>.<graph>." and renames Loop End to "Recurse":
// "64" (clip 1), "70.0.0.64" (clip 2), "70.0.0.Recurse.0.0.64" (clip 3).
export function nodeDescriber(graph: ApiGraph) {
+ const loopStart = Object.keys(graph).find((id) => graph[id].class_type === "MiniMaxH3ChainLoopStart");
+ const loopEnd = Object.keys(graph).find((id) => graph[id].class_type === "MiniMaxH3ChainLoopEnd");
const children = new Map<string, string[]>();
for (const [id, node] of Object.entries(graph)) {
for (const value of Object.values(node.inputs)) {
@@ -18,14 +20,14 @@ export function nodeDescriber(graph: ApiGraph) {
while (stack.length) for (const child of children.get(stack.pop()!) ?? []) if (!seen.has(child)) seen.add(child), stack.push(child);
return seen;
};
- const afterLoop = downstream(NODES.loopEnd);
- afterLoop.delete(NODES.loopEnd);
- const inLoop = new Set([...downstream(NODES.loopStart)].filter((id) => !afterLoop.has(id)));
+ const afterLoop = loopEnd ? downstream(loopEnd) : new Set<string>();
+ if (loopEnd) afterLoop.delete(loopEnd);
+ const inLoop = new Set(loopStart ? [...downstream(loopStart)].filter((id) => !afterLoop.has(id)) : []);
return (nodeId: string | null): NodeInfo | null => {
if (!nodeId) return null;
const parts = nodeId.split(".");
- const base = parts.at(-1) === "Recurse" ? NODES.loopEnd : parts.at(-1)!;
+ const base = parts.at(-1) === "Recurse" && loopEnd ? loopEnd : parts.at(-1)!;
const node = graph[base];
if (!node) return null;
return {
diff --git a/test/advanced.test.ts b/test/advanced.test.ts
new file mode 100644
index 0000000..1f66f4f
--- /dev/null
+++ b/test/advanced.test.ts
@@ -0,0 +1,75 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+import { VIDEO, nodeByTitle, pictureCount, pruneAdvanced, type AdvancedSettings } from "../lib/advanced.ts";
+import { nodeDescriber } from "../lib/progress.ts";
+import { isLink, type ApiGraph } from "../lib/simple.ts";
+
+const load = (name: string): ApiGraph => JSON.parse(readFileSync(new URL(`../workflows/${name}.api.json`, import.meta.url), "utf8"));
+const graph = load("advanced");
+const maxq = load("advanced_maxq");
+const settings = (hatFix: boolean, roles: string[] = []): AdvancedSettings => ({ roles, resolution: "480p", hatFix, margin: "tight", seed: 3, clipSeconds: 6 });
+const titles = (g: ApiGraph) => Object.values(g).map((node) => node._meta?.title ?? "");
+const dangling = (g: ApiGraph) => Object.entries(g).flatMap(([id, node]) =>
+ Object.entries(node.inputs).filter(([, v]) => isLink(v) && !g[v[0]]).map(([name]) => `${id}.${name}`));
+
+test("the exports have every picture and the hat fix", () => {
+ assert.equal(pictureCount(graph), 4);
+ assert.equal(pictureCount(maxq), 2);
+ for (const g of [graph, maxq]) {
+ assert.equal(g[nodeByTitle(g, VIDEO)].class_type, "VHS_LoadVideo");
+ assert.ok(titles(g).includes("SAM 3.1 track hats"));
+ }
+});
+
+test("two characters drop pictures 3-4 everywhere", () => {
+ const pruned = pruneAdvanced(graph, 2, settings(true));
+ assert.deepEqual(dangling(pruned), []);
+ assert.equal(pictureCount(pruned), 2);
+ for (const t of ["Describe picture 3", "Describe picture 4"]) assert.ok(!titles(pruned).includes(t));
+ const plan = pruned[nodeByTitle(pruned, "Swap Plan (roles, seed, size)")].inputs;
+ assert.ok(isLink(plan.picture_2) && !("picture_3" in plan) && !("picture_4_text" in plan));
+ const ref = Object.values(pruned).find((n) => n.class_type === "MiniMaxH3ReferenceToVideo")!.inputs;
+ assert.deepEqual(Object.keys(ref).filter((k) => k.startsWith("ref_images.")), ["ref_images.ref_image_0", "ref_images.ref_image_1"]);
+ assert.equal(Object.keys(pruned).length, Object.keys(graph).length - 6);
+ assert.ok(graph[nodeByTitle(graph, "Picture 4")], "the source graph is not modified");
+});
+
+test("without hat fix the grow masks read the role masks", () => {
+ for (const [g, n] of [[graph, 4], [maxq, 2]] as const) {
+ const pruned = pruneAdvanced(g, n, settings(false));
+ assert.deepEqual(dangling(pruned), []);
+ assert.ok(!titles(pruned).some((t) => /\bhats?\b/i.test(t)));
+ const grows = Object.values(pruned).filter((node) => / grow mask /.test(node._meta?.title ?? ""));
+ assert.equal(grows.length, n === 4 ? 1 : 2);
+ for (const grow of grows) {
+ assert.equal(grow.inputs.expand, 20);
+ assert.equal(pruned[(grow.inputs.mask as [string, number])[0]].class_type, "H3RoleMask");
+ }
+ }
+});
+
+test("roles fill in for blank ones only when some are given", () => {
+ const plan = (roles: string[]) => {
+ const pruned = pruneAdvanced(graph, 3, settings(false, roles));
+ return pruned[nodeByTitle(pruned, "Swap Plan (roles, seed, size)")].inputs;
+ };
+ assert.equal(plan(["", "", ""]).roles, "");
+ assert.equal(plan(["the singer ", "", "the drummer - man in a cap"]).roles,
+ "the singer\nthe person with the second most screen time\nthe drummer - man in a cap");
+ const inputs = plan([]);
+ assert.deepEqual([inputs.resolution, inputs.seed, inputs.clip_seconds], ["480p", 3, 6]);
+});
+
+test("picture counts outside the export are refused", () => {
+ assert.throws(() => pruneAdvanced(graph, 0, settings(true)));
+ assert.throws(() => pruneAdvanced(maxq, 3, settings(true)));
+});
+
+test("progress finds the clip loop in the advanced graph", () => {
+ const describe = nodeDescriber(graph);
+ const sampler = Object.keys(graph).find((id) => graph[id].class_type === "SamplerCustomAdvanced")!;
+ assert.equal(describe(sampler)?.clip, 1);
+ assert.equal(describe(`99.0.0.${sampler}`)?.clip, 2);
+ assert.equal(describe(nodeByTitle(graph, "Describe picture 1"))?.clip, null);
+});
diff --git a/workflows/advanced.api.json b/workflows/advanced.api.json
new file mode 100644
index 0000000..7018590
--- /dev/null
+++ b/workflows/advanced.api.json
@@ -0,0 +1,1465 @@
+{
+ "2": {
+ "inputs": {
+ "image": "apt_vest_reference.png"
+ },
+ "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": [
+ "22",
+ 0
+ ],
+ "image": [
+ "3",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 1"
+ }
+ },
+ "5": {
+ "inputs": {
+ "image": "apt_kurta_reference.png"
+ },
+ "class_type": "LoadImage",
+ "_meta": {
+ "title": "Picture 2"
+ }
+ },
+ "6": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 768,
+ "image": [
+ "5",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "7": {
+ "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": [
+ "22",
+ 0
+ ],
+ "image": [
+ "6",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 2"
+ }
+ },
+ "8": {
+ "inputs": {
+ "image": "example.png"
+ },
+ "class_type": "LoadImage",
+ "_meta": {
+ "title": "Picture 3"
+ }
+ },
+ "9": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 768,
+ "image": [
+ "8",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "10": {
+ "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": [
+ "22",
+ 0
+ ],
+ "image": [
+ "9",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 3"
+ }
+ },
+ "11": {
+ "inputs": {
+ "image": "example.png"
+ },
+ "class_type": "LoadImage",
+ "_meta": {
+ "title": "Picture 4"
+ }
+ },
+ "12": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 768,
+ "image": [
+ "11",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "13": {
+ "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": [
+ "22",
+ 0
+ ],
+ "image": [
+ "12",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 4"
+ }
+ },
+ "14": {
+ "inputs": {
+ "video": "apt_rose_16s.mkv",
+ "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)"
+ }
+ },
+ "15": {
+ "inputs": {
+ "start_index": 0,
+ "duration": 2048,
+ "audio": [
+ "14",
+ 2
+ ]
+ },
+ "class_type": "TrimAudioDuration",
+ "_meta": {
+ "title": "Soundtrack (whole video)"
+ }
+ },
+ "16": {
+ "inputs": {
+ "select_every_nth": 48,
+ "skip_first_images": 24,
+ "images": [
+ "14",
+ 0
+ ]
+ },
+ "class_type": "VHS_SelectEveryNthImage",
+ "_meta": {
+ "title": "One frame every 2 s"
+ }
+ },
+ "17": {
+ "inputs": {
+ "batch_index": 0,
+ "length": 20,
+ "image": [
+ "16",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "At most 20 frames"
+ }
+ },
+ "18": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 640,
+ "image": [
+ "17",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "19": {
+ "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": [
+ "22",
+ 0
+ ],
+ "image": [
+ "18",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Who is in the video"
+ }
+ },
+ "20": {
+ "inputs": {
+ "clip_seconds": 6,
+ "overlap_frames": 39,
+ "resolution": "736p",
+ "steps": 6,
+ "seed": 0,
+ "roles": "",
+ "source_frames": [
+ "14",
+ 0
+ ],
+ "picture_1": [
+ "2",
+ 0
+ ],
+ "picture_2": [
+ "5",
+ 0
+ ],
+ "picture_3": [
+ "8",
+ 0
+ ],
+ "picture_4": [
+ "11",
+ 0
+ ],
+ "picture_1_text": [
+ "4",
+ 0
+ ],
+ "picture_2_text": [
+ "7",
+ 0
+ ],
+ "picture_3_text": [
+ "10",
+ 0
+ ],
+ "picture_4_text": [
+ "13",
+ 0
+ ],
+ "video_people": [
+ "19",
+ 0
+ ]
+ },
+ "class_type": "H3AdvancedSwapPlan",
+ "_meta": {
+ "title": "Swap Plan (roles, seed, size)"
+ }
+ },
+ "22": {
+ "inputs": {
+ "clip_name": "qwen3vl_8b_int8_convrot.safetensors",
+ "type": "stable_diffusion",
+ "device": "default"
+ },
+ "class_type": "CLIPLoader",
+ "_meta": {
+ "title": "Describer: Qwen3-VL 8B"
+ }
+ },
+ "24": {
+ "inputs": {
+ "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
+ "weight_dtype": "default"
+ },
+ "class_type": "UNETLoader",
+ "_meta": {
+ "title": "H3 Diffusion Model"
+ }
+ },
+ "25": {
+ "inputs": {
+ "lora_name": "minimax_h3_DMAD_4step_full_lora_avg_rank_39_bf16.safetensors",
+ "strength_model": 1,
+ "model": [
+ "24",
+ 0
+ ]
+ },
+ "class_type": "LoraLoaderModelOnly",
+ "_meta": {
+ "title": "DMAD LoRA"
+ }
+ },
+ "26": {
+ "inputs": {
+ "attention": "comfy kitchen attention",
+ "model": [
+ "25",
+ 0
+ ]
+ },
+ "class_type": "ModelAttentionBackend",
+ "_meta": {
+ "title": "Comfy Kitchen Attention"
+ }
+ },
+ "27": {
+ "inputs": {
+ "shift_video": 12,
+ "shift_audio": 2,
+ "model": [
+ "26",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3SigmaShift",
+ "_meta": {
+ "title": "Sigma Shift"
+ }
+ },
+ "28": {
+ "inputs": {
+ "clip_name": "qwen3vl_32b_minimax_h3_int4_convrot.safetensors",
+ "type": "minimax",
+ "device": "default"
+ },
+ "class_type": "CLIPLoader",
+ "_meta": {
+ "title": "H3 Text Encoder"
+ }
+ },
+ "29": {
+ "inputs": {
+ "vae_name": "minimax_h3_video_vae_int8_convrot.safetensors"
+ },
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Video VAE"
+ }
+ },
+ "30": {
+ "inputs": {
+ "vae_name": "minimax_h3_audio_vae_fp32.safetensors"
+ },
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Audio VAE"
+ }
+ },
+ "31": {
+ "inputs": {
+ "sampler_name": "euler"
+ },
+ "class_type": "KSamplerSelect",
+ "_meta": {
+ "title": "Sampler"
+ }
+ },
+ "32": {
+ "inputs": {
+ "ckpt_name": "sam3.1_multiplex_fp16.safetensors"
+ },
+ "class_type": "CheckpointLoaderSimple",
+ "_meta": {
+ "title": "SAM 3.1"
+ }
+ },
+ "33": {
+ "inputs": {
+ "text": "person",
+ "clip": [
+ "32",
+ 1
+ ]
+ },
+ "class_type": "CLIPTextEncode",
+ "_meta": {
+ "title": "SAM: what to replace"
+ }
+ },
+ "34": {
+ "inputs": {
+ "scene_continuity": "Hard picture + protected audio",
+ "audio_profile": "Generate audio"
+ },
+ "class_type": "MiniMaxH3GenerationProfile",
+ "_meta": {
+ "title": "Generation Profile"
+ }
+ },
+ "35": {
+ "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": [
+ "20",
+ 3
+ ],
+ "generation_fingerprint": "",
+ "width": [
+ "20",
+ 1
+ ],
+ "height": [
+ "20",
+ 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": [
+ "34",
+ 0
+ ],
+ "plan_json_input": [
+ "20",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainPlanModern",
+ "_meta": {
+ "title": "Production Plan (filled by Swap Plan)"
+ }
+ },
+ "36": {
+ "inputs": {
+ "video_path": "",
+ "audio_path": "",
+ "embedded_audio": "auto",
+ "skip_first_frames": 0,
+ "source_audio": [
+ "15",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3SourceTimeline",
+ "_meta": {
+ "title": "Source soundtrack"
+ }
+ },
+ "37": {
+ "inputs": {
+ "start_clip": 1,
+ "scene_range": "",
+ "verify_resume_history": true,
+ "plan": [
+ "35",
+ 0
+ ],
+ "source_timeline": [
+ "36",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainLoopStart",
+ "_meta": {
+ "title": "Loop Start"
+ }
+ },
+ "38": {
+ "inputs": {
+ "align_audio_reference": false,
+ "state": [
+ "37",
+ 1
+ ]
+ },
+ "class_type": "MiniMaxH3ChainCurrent",
+ "_meta": {
+ "title": "Current Clip"
+ }
+ },
+ "39": {
+ "inputs": {
+ "expression": "round(a * 24)",
+ "values.a": [
+ "38",
+ 10
+ ]
+ },
+ "class_type": "ComfyMathExpression",
+ "_meta": {
+ "title": "Clip start frame"
+ }
+ },
+ "40": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 512,
+ "image": [
+ "14",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Motion reference video (~512 px)"
+ }
+ },
+ "41": {
+ "inputs": {
+ "batch_index": [
+ "39",
+ 1
+ ],
+ "length": [
+ "38",
+ 6
+ ],
+ "image": [
+ "40",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "Motion reference for this clip"
+ }
+ },
+ "42": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 1008,
+ "image": [
+ "14",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "SAM video (1008 px, SAM's own size)"
+ }
+ },
+ "43": {
+ "inputs": {
+ "batch_index": [
+ "39",
+ 1
+ ],
+ "length": [
+ "38",
+ 6
+ ],
+ "image": [
+ "42",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "SAM frames for this clip"
+ }
+ },
+ "44": {
+ "inputs": {
+ "detection_threshold": 0.35,
+ "max_objects": 0,
+ "detect_interval": 1,
+ "images": [
+ "43",
+ 0
+ ],
+ "model": [
+ "32",
+ 0
+ ],
+ "conditioning": [
+ "33",
+ 0
+ ]
+ },
+ "class_type": "SAM3_VideoTrack",
+ "_meta": {
+ "title": "SAM 3.1 track every person"
+ }
+ },
+ "45": {
+ "inputs": {
+ "cut_threshold": 40,
+ "track_data": [
+ "44",
+ 0
+ ],
+ "images": [
+ "43",
+ 0
+ ],
+ "people": [
+ "20",
+ 5
+ ]
+ },
+ "class_type": "H3TrackCrops",
+ "_meta": {
+ "title": "Show each track per shot"
+ }
+ },
+ "46": {
+ "inputs": {
+ "prompt": [
+ "45",
+ 1
+ ],
+ "max_length": 400,
+ "sampling_mode": "off",
+ "thinking": false,
+ "use_default_template": true,
+ "mtp": "auto",
+ "clip": [
+ "22",
+ 0
+ ],
+ "image": [
+ "45",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Who is each track (Qwen3-VL)"
+ }
+ },
+ "47": {
+ "inputs": {
+ "segments": [
+ "45",
+ 2
+ ],
+ "answer": [
+ "46",
+ 0
+ ]
+ },
+ "class_type": "H3TrackRoles",
+ "_meta": {
+ "title": "Read the track labels"
+ }
+ },
+ "48": {
+ "inputs": {
+ "source": [
+ "47",
+ 0
+ ]
+ },
+ "class_type": "PreviewAny",
+ "_meta": {
+ "title": "Track labels"
+ }
+ },
+ "49": {
+ "inputs": {
+ "images": [
+ "45",
+ 0
+ ]
+ },
+ "class_type": "PreviewImage",
+ "_meta": {
+ "title": "Who is each track (what Qwen saw)"
+ }
+ },
+ "50": {
+ "inputs": {
+ "headroom": 0,
+ "hold_frames": 0,
+ "subject": 0,
+ "track_data": [
+ "44",
+ 0
+ ],
+ "labels": [
+ "47",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Labelled people (outlined for the shot list)"
+ }
+ },
+ "51": {
+ "inputs": {
+ "cut_threshold": 40,
+ "images": [
+ "41",
+ 0
+ ],
+ "shot_prompt": [
+ "20",
+ 4
+ ],
+ "role_map": [
+ "50",
+ 2
+ ]
+ },
+ "class_type": "H3ClipShots",
+ "_meta": {
+ "title": "Find this clip's cuts"
+ }
+ },
+ "52": {
+ "inputs": {
+ "prompt": [
+ "51",
+ 1
+ ],
+ "max_length": 500,
+ "sampling_mode": "off",
+ "thinking": false,
+ "use_default_template": true,
+ "mtp": "auto",
+ "clip": [
+ "22",
+ 0
+ ],
+ "image": [
+ "51",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Write this clip's shot list (Qwen3-VL)"
+ }
+ },
+ "53": {
+ "inputs": {
+ "text": "hat",
+ "clip": [
+ "32",
+ 1
+ ]
+ },
+ "class_type": "CLIPTextEncode",
+ "_meta": {
+ "title": "SAM: hats"
+ }
+ },
+ "54": {
+ "inputs": {
+ "detection_threshold": 0.35,
+ "max_objects": 0,
+ "detect_interval": 1,
+ "images": [
+ "43",
+ 0
+ ],
+ "model": [
+ "32",
+ 0
+ ],
+ "conditioning": [
+ "53",
+ 0
+ ]
+ },
+ "class_type": "SAM3_VideoTrack",
+ "_meta": {
+ "title": "SAM 3.1 track hats"
+ }
+ },
+ "55": {
+ "inputs": {
+ "object_indices": "",
+ "track_data": [
+ "54",
+ 0
+ ]
+ },
+ "class_type": "SAM3_TrackToMask",
+ "_meta": {
+ "title": "All hats"
+ }
+ },
+ "56": {
+ "inputs": {
+ "source_fps": 24,
+ "crop": "center",
+ "state": [
+ "38",
+ 0
+ ],
+ "latent": [
+ "65",
+ 1
+ ],
+ "vae": [
+ "29",
+ 0
+ ],
+ "audio_vae": [
+ "30",
+ 0
+ ],
+ "source_frames": [
+ "14",
+ 0
+ ],
+ "source_audio": [
+ "15",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexLoopSourceAVTarget",
+ "_meta": {
+ "title": "Source clip (frames + audio)"
+ }
+ },
+ "57": {
+ "inputs": {
+ "noise_seed": [
+ "38",
+ 5
+ ]
+ },
+ "class_type": "RandomNoise",
+ "_meta": {
+ "title": "Clip Seed"
+ }
+ },
+ "58": {
+ "inputs": {
+ "headroom": 0.1,
+ "hold_frames": 2,
+ "subject": 0,
+ "track_data": [
+ "44",
+ 0
+ ],
+ "labels": [
+ "47",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Swap: labelled people (+ headroom)"
+ }
+ },
+ "59": {
+ "inputs": {
+ "headroom": 0,
+ "hold_frames": 1,
+ "subject": 0,
+ "track_data": [
+ "44",
+ 0
+ ],
+ "labels": [
+ "47",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Swap: labelled people, no headroom (mannequin)"
+ }
+ },
+ "60": {
+ "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": [
+ "64",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Swap: grow mask (~4% of the frame)"
+ }
+ },
+ "61": {
+ "inputs": {
+ "blur": 0.01,
+ "images": [
+ "41",
+ 0
+ ],
+ "mask": [
+ "59",
+ 0
+ ],
+ "size": [
+ "59",
+ 1
+ ]
+ },
+ "class_type": "H3GreyMannequins",
+ "_meta": {
+ "title": "Swap: hide them (grey mannequins)"
+ }
+ },
+ "62": {
+ "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": [
+ "58",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Swap: hat search area (person + 60 px)"
+ }
+ },
+ "63": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "multiply",
+ "destination": [
+ "55",
+ 0
+ ],
+ "source": [
+ "62",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Swap: only their hats"
+ }
+ },
+ "64": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "add",
+ "destination": [
+ "58",
+ 0
+ ],
+ "source": [
+ "63",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Swap: people + hats"
+ }
+ },
+ "65": {
+ "inputs": {
+ "prompt": [
+ "66",
+ 0
+ ],
+ "width": [
+ "38",
+ 8
+ ],
+ "height": [
+ "38",
+ 9
+ ],
+ "length": [
+ "38",
+ 6
+ ],
+ "ref_image_size": "match",
+ "clip": [
+ "28",
+ 0
+ ],
+ "vae": [
+ "29",
+ 0
+ ],
+ "audio_vae": [
+ "30",
+ 0
+ ],
+ "ref_images.ref_image_0": [
+ "2",
+ 0
+ ],
+ "ref_images.ref_image_1": [
+ "5",
+ 0
+ ],
+ "ref_images.ref_image_2": [
+ "8",
+ 0
+ ],
+ "ref_images.ref_image_3": [
+ "11",
+ 0
+ ],
+ "ref_videos.ref_video_0": [
+ "61",
+ 0
+ ],
+ "ref_video_audios.ref_video_audio_0": [
+ "38",
+ 12
+ ]
+ },
+ "class_type": "MiniMaxH3ReferenceToVideo",
+ "_meta": {
+ "title": "Swap: reference conditioning"
+ }
+ },
+ "66": {
+ "inputs": {
+ "prompt": [
+ "38",
+ 4
+ ],
+ "shots": [
+ "52",
+ 0
+ ]
+ },
+ "class_type": "H3FillShots",
+ "_meta": {
+ "title": "Swap: insert shot list into prompt"
+ }
+ },
+ "67": {
+ "inputs": {
+ "source": [
+ "66",
+ 0
+ ]
+ },
+ "class_type": "PreviewAny",
+ "_meta": {
+ "title": "Swap: clip prompt (what H3 gets)"
+ }
+ },
+ "68": {
+ "inputs": {
+ "grow": 0,
+ "keep_audio": true,
+ "megapixels": 0,
+ "vae": [
+ "29",
+ 0
+ ],
+ "images": [
+ "56",
+ 1
+ ],
+ "mask": [
+ "60",
+ 0
+ ],
+ "audio_vae": [
+ "30",
+ 0
+ ],
+ "audio": [
+ "56",
+ 2
+ ]
+ },
+ "class_type": "MiniMaxH3FantasticVideoEditLatent",
+ "_meta": {
+ "title": "Swap: edit latent (source + mask + audio)"
+ }
+ },
+ "69": {
+ "inputs": {
+ "mask_meaning": "white = generate",
+ "audio_mode": "preserve source audio",
+ "mask_conversion": "H3 exact (causal/token max)",
+ "target_latent": [
+ "68",
+ 0
+ ],
+ "mask": [
+ "60",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexMaskedTarget",
+ "_meta": {
+ "title": "Swap: masked target"
+ }
+ },
+ "70": {
+ "inputs": {
+ "state": [
+ "38",
+ 0
+ ],
+ "conditioning": [
+ "65",
+ 0
+ ],
+ "vae": [
+ "29",
+ 0
+ ],
+ "latent": [
+ "69",
+ 0
+ ],
+ "audio_vae": [
+ "30",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainContext",
+ "_meta": {
+ "title": "Swap: apply clip context"
+ }
+ },
+ "71": {
+ "inputs": {
+ "model": [
+ "27",
+ 0
+ ],
+ "conditioning": [
+ "70",
+ 0
+ ]
+ },
+ "class_type": "BasicGuider",
+ "_meta": {
+ "title": "Swap: guider"
+ }
+ },
+ "72": {
+ "inputs": {
+ "scheduler": "simple",
+ "steps": [
+ "38",
+ 7
+ ],
+ "denoise": 1,
+ "model": [
+ "27",
+ 0
+ ]
+ },
+ "class_type": "BasicScheduler",
+ "_meta": {
+ "title": "Swap: schedule"
+ }
+ },
+ "73": {
+ "inputs": {
+ "noise": [
+ "57",
+ 0
+ ],
+ "guider": [
+ "71",
+ 0
+ ],
+ "sampler": [
+ "31",
+ 0
+ ],
+ "sigmas": [
+ "72",
+ 0
+ ],
+ "latent_image": [
+ "70",
+ 3
+ ]
+ },
+ "class_type": "SamplerCustomAdvanced",
+ "_meta": {
+ "title": "Swap: sample video + audio"
+ }
+ },
+ "74": {
+ "inputs": {
+ "samples": [
+ "73",
+ 0
+ ],
+ "vae": [
+ "29",
+ 0
+ ]
+ },
+ "class_type": "VAEDecode",
+ "_meta": {
+ "title": "Swap: decode video"
+ }
+ },
+ "75": {
+ "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": [
+ "56",
+ 1
+ ],
+ "mask": [
+ "60",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexMaskGridPreview",
+ "_meta": {
+ "title": "Mask preview"
+ }
+ },
+ "76": {
+ "inputs": {
+ "images": [
+ "75",
+ 1
+ ]
+ },
+ "class_type": "PreviewImage",
+ "_meta": {
+ "title": "Mask preview (white = regenerated)"
+ }
+ },
+ "77": {
+ "inputs": {
+ "samples": [
+ "73",
+ 0
+ ],
+ "vae": [
+ "30",
+ 0
+ ]
+ },
+ "class_type": "VAEDecodeAudio",
+ "_meta": {
+ "title": "Decode Audio"
+ }
+ },
+ "78": {
+ "inputs": {
+ "trim_frames": [
+ "70",
+ 1
+ ],
+ "fps": 24,
+ "match_tail": true,
+ "audio_trim_mode": "sync_with_video",
+ "images": [
+ "74",
+ 0
+ ],
+ "audio": [
+ "77",
+ 0
+ ],
+ "state": [
+ "38",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3LoopTrim",
+ "_meta": {
+ "title": "Trim Overlap"
+ }
+ },
+ "79": {
+ "inputs": {
+ "state": [
+ "38",
+ 0
+ ],
+ "images": [
+ "78",
+ 0
+ ],
+ "sampled_latent": [
+ "73",
+ 0
+ ],
+ "audio": [
+ "78",
+ 1
+ ],
+ "images_with_overlap": [
+ "78",
+ 2
+ ]
+ },
+ "class_type": "MiniMaxH3ChainSegmentSave",
+ "_meta": {
+ "title": "Save Clip + Checkpoint"
+ }
+ },
+ "80": {
+ "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": [
+ "38",
+ 0
+ ],
+ "segment": [
+ "79",
+ 0
+ ],
+ "audio": [
+ "78",
+ 1
+ ]
+ },
+ "class_type": "MiniMaxH3ChainReview",
+ "_meta": {
+ "title": "Review (off = no pause)"
+ }
+ },
+ "81": {
+ "inputs": {
+ "between_scene_cleanup": "off",
+ "execution_mode": "recursive",
+ "flow": [
+ "37",
+ 0
+ ],
+ "state": [
+ "38",
+ 0
+ ],
+ "images": [
+ "78",
+ 0
+ ],
+ "sampled_latent": [
+ "73",
+ 0
+ ],
+ "segment": [
+ "80",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainLoopEnd",
+ "_meta": {
+ "title": "Loop End"
+ }
+ },
+ "82": {
+ "inputs": {
+ "audio_source": "source",
+ "filename": "advanced_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": [
+ "81",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainAssemble",
+ "_meta": {
+ "title": "Final Video"
+ }
+ }
+}
\ No newline at end of file
diff --git a/workflows/advanced_maxq.api.json b/workflows/advanced_maxq.api.json
new file mode 100644
index 0000000..a8c9e27
--- /dev/null
+++ b/workflows/advanced_maxq.api.json
@@ -0,0 +1,1765 @@
+{
+ "2": {
+ "inputs": {
+ "image": "apt_vest_reference.png"
+ },
+ "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": [
+ "16",
+ 0
+ ],
+ "image": [
+ "3",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 1"
+ }
+ },
+ "5": {
+ "inputs": {
+ "image": "apt_kurta_reference.png"
+ },
+ "class_type": "LoadImage",
+ "_meta": {
+ "title": "Picture 2"
+ }
+ },
+ "6": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 768,
+ "image": [
+ "5",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "7": {
+ "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": [
+ "16",
+ 0
+ ],
+ "image": [
+ "6",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Describe picture 2"
+ }
+ },
+ "8": {
+ "inputs": {
+ "video": "apt_rose_16s.mkv",
+ "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)"
+ }
+ },
+ "9": {
+ "inputs": {
+ "start_index": 0,
+ "duration": 2048,
+ "audio": [
+ "8",
+ 2
+ ]
+ },
+ "class_type": "TrimAudioDuration",
+ "_meta": {
+ "title": "Soundtrack (whole video)"
+ }
+ },
+ "10": {
+ "inputs": {
+ "select_every_nth": 48,
+ "skip_first_images": 24,
+ "images": [
+ "8",
+ 0
+ ]
+ },
+ "class_type": "VHS_SelectEveryNthImage",
+ "_meta": {
+ "title": "One frame every 2 s"
+ }
+ },
+ "11": {
+ "inputs": {
+ "batch_index": 0,
+ "length": 20,
+ "image": [
+ "10",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "At most 20 frames"
+ }
+ },
+ "12": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 640,
+ "image": [
+ "11",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Shrink for the describer"
+ }
+ },
+ "13": {
+ "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": [
+ "16",
+ 0
+ ],
+ "image": [
+ "12",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Who is in the video"
+ }
+ },
+ "14": {
+ "inputs": {
+ "clip_seconds": 6,
+ "overlap_frames": 39,
+ "resolution": "736p",
+ "steps": 6,
+ "seed": 0,
+ "roles": "",
+ "source_frames": [
+ "8",
+ 0
+ ],
+ "picture_1": [
+ "2",
+ 0
+ ],
+ "picture_2": [
+ "5",
+ 0
+ ],
+ "picture_1_text": [
+ "4",
+ 0
+ ],
+ "picture_2_text": [
+ "7",
+ 0
+ ],
+ "video_people": [
+ "13",
+ 0
+ ]
+ },
+ "class_type": "H3AdvancedSwapPlan",
+ "_meta": {
+ "title": "Swap Plan (roles, seed, size)"
+ }
+ },
+ "16": {
+ "inputs": {
+ "clip_name": "qwen3vl_8b_int8_convrot.safetensors",
+ "type": "stable_diffusion",
+ "device": "default"
+ },
+ "class_type": "CLIPLoader",
+ "_meta": {
+ "title": "Describer: Qwen3-VL 8B"
+ }
+ },
+ "18": {
+ "inputs": {
+ "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
+ "weight_dtype": "default"
+ },
+ "class_type": "UNETLoader",
+ "_meta": {
+ "title": "H3 Diffusion Model"
+ }
+ },
+ "19": {
+ "inputs": {
+ "lora_name": "minimax_h3_DMAD_4step_full_lora_avg_rank_39_bf16.safetensors",
+ "strength_model": 1,
+ "model": [
+ "18",
+ 0
+ ]
+ },
+ "class_type": "LoraLoaderModelOnly",
+ "_meta": {
+ "title": "DMAD LoRA"
+ }
+ },
+ "20": {
+ "inputs": {
+ "attention": "comfy kitchen attention",
+ "model": [
+ "19",
+ 0
+ ]
+ },
+ "class_type": "ModelAttentionBackend",
+ "_meta": {
+ "title": "Comfy Kitchen Attention"
+ }
+ },
+ "21": {
+ "inputs": {
+ "shift_video": 12,
+ "shift_audio": 2,
+ "model": [
+ "20",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3SigmaShift",
+ "_meta": {
+ "title": "Sigma Shift"
+ }
+ },
+ "22": {
+ "inputs": {
+ "clip_name": "qwen3vl_32b_minimax_h3_int4_convrot.safetensors",
+ "type": "minimax",
+ "device": "default"
+ },
+ "class_type": "CLIPLoader",
+ "_meta": {
+ "title": "H3 Text Encoder"
+ }
+ },
+ "23": {
+ "inputs": {
+ "vae_name": "minimax_h3_video_vae_int8_convrot.safetensors"
+ },
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Video VAE"
+ }
+ },
+ "24": {
+ "inputs": {
+ "vae_name": "minimax_h3_audio_vae_fp32.safetensors"
+ },
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Audio VAE"
+ }
+ },
+ "25": {
+ "inputs": {
+ "sampler_name": "euler"
+ },
+ "class_type": "KSamplerSelect",
+ "_meta": {
+ "title": "Sampler"
+ }
+ },
+ "26": {
+ "inputs": {
+ "ckpt_name": "sam3.1_multiplex_fp16.safetensors"
+ },
+ "class_type": "CheckpointLoaderSimple",
+ "_meta": {
+ "title": "SAM 3.1"
+ }
+ },
+ "27": {
+ "inputs": {
+ "text": "person",
+ "clip": [
+ "26",
+ 1
+ ]
+ },
+ "class_type": "CLIPTextEncode",
+ "_meta": {
+ "title": "SAM: what to replace"
+ }
+ },
+ "28": {
+ "inputs": {
+ "scene_continuity": "Hard picture + protected audio",
+ "audio_profile": "Generate audio"
+ },
+ "class_type": "MiniMaxH3GenerationProfile",
+ "_meta": {
+ "title": "Generation Profile"
+ }
+ },
+ "29": {
+ "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": [
+ "14",
+ 3
+ ],
+ "generation_fingerprint": "",
+ "width": [
+ "14",
+ 1
+ ],
+ "height": [
+ "14",
+ 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": [
+ "28",
+ 0
+ ],
+ "plan_json_input": [
+ "14",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainPlanModern",
+ "_meta": {
+ "title": "Production Plan (filled by Swap Plan)"
+ }
+ },
+ "30": {
+ "inputs": {
+ "video_path": "",
+ "audio_path": "",
+ "embedded_audio": "auto",
+ "skip_first_frames": 0,
+ "source_audio": [
+ "9",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3SourceTimeline",
+ "_meta": {
+ "title": "Source soundtrack"
+ }
+ },
+ "31": {
+ "inputs": {
+ "start_clip": 1,
+ "scene_range": "",
+ "verify_resume_history": true,
+ "plan": [
+ "29",
+ 0
+ ],
+ "source_timeline": [
+ "30",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainLoopStart",
+ "_meta": {
+ "title": "Loop Start"
+ }
+ },
+ "32": {
+ "inputs": {
+ "align_audio_reference": false,
+ "state": [
+ "31",
+ 1
+ ]
+ },
+ "class_type": "MiniMaxH3ChainCurrent",
+ "_meta": {
+ "title": "Current Clip"
+ }
+ },
+ "33": {
+ "inputs": {
+ "expression": "round(a * 24)",
+ "values.a": [
+ "32",
+ 10
+ ]
+ },
+ "class_type": "ComfyMathExpression",
+ "_meta": {
+ "title": "Clip start frame"
+ }
+ },
+ "34": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 512,
+ "image": [
+ "8",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Motion reference video (~512 px)"
+ }
+ },
+ "35": {
+ "inputs": {
+ "batch_index": [
+ "33",
+ 1
+ ],
+ "length": [
+ "32",
+ 6
+ ],
+ "image": [
+ "34",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "Motion reference for this clip"
+ }
+ },
+ "36": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 1008,
+ "image": [
+ "8",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "SAM video (1008 px, SAM's own size)"
+ }
+ },
+ "37": {
+ "inputs": {
+ "batch_index": [
+ "33",
+ 1
+ ],
+ "length": [
+ "32",
+ 6
+ ],
+ "image": [
+ "36",
+ 0
+ ]
+ },
+ "class_type": "ImageFromBatch",
+ "_meta": {
+ "title": "SAM frames for this clip"
+ }
+ },
+ "38": {
+ "inputs": {
+ "detection_threshold": 0.35,
+ "max_objects": 0,
+ "detect_interval": 1,
+ "images": [
+ "37",
+ 0
+ ],
+ "model": [
+ "26",
+ 0
+ ],
+ "conditioning": [
+ "27",
+ 0
+ ]
+ },
+ "class_type": "SAM3_VideoTrack",
+ "_meta": {
+ "title": "SAM 3.1 track every person"
+ }
+ },
+ "39": {
+ "inputs": {
+ "cut_threshold": 40,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "images": [
+ "37",
+ 0
+ ],
+ "people": [
+ "14",
+ 5
+ ]
+ },
+ "class_type": "H3TrackCrops",
+ "_meta": {
+ "title": "Show each track per shot"
+ }
+ },
+ "40": {
+ "inputs": {
+ "prompt": [
+ "39",
+ 1
+ ],
+ "max_length": 400,
+ "sampling_mode": "off",
+ "thinking": false,
+ "use_default_template": true,
+ "mtp": "auto",
+ "clip": [
+ "16",
+ 0
+ ],
+ "image": [
+ "39",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Who is each track (Qwen3-VL)"
+ }
+ },
+ "41": {
+ "inputs": {
+ "segments": [
+ "39",
+ 2
+ ],
+ "answer": [
+ "40",
+ 0
+ ]
+ },
+ "class_type": "H3TrackRoles",
+ "_meta": {
+ "title": "Read the track labels"
+ }
+ },
+ "42": {
+ "inputs": {
+ "source": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "PreviewAny",
+ "_meta": {
+ "title": "Track labels"
+ }
+ },
+ "43": {
+ "inputs": {
+ "images": [
+ "39",
+ 0
+ ]
+ },
+ "class_type": "PreviewImage",
+ "_meta": {
+ "title": "Who is each track (what Qwen saw)"
+ }
+ },
+ "44": {
+ "inputs": {
+ "headroom": 0,
+ "hold_frames": 0,
+ "subject": 0,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "labels": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Labelled people (outlined for the shot list)"
+ }
+ },
+ "45": {
+ "inputs": {
+ "cut_threshold": 40,
+ "images": [
+ "35",
+ 0
+ ],
+ "shot_prompt": [
+ "14",
+ 4
+ ],
+ "role_map": [
+ "44",
+ 2
+ ]
+ },
+ "class_type": "H3ClipShots",
+ "_meta": {
+ "title": "Find this clip's cuts"
+ }
+ },
+ "46": {
+ "inputs": {
+ "prompt": [
+ "45",
+ 1
+ ],
+ "max_length": 500,
+ "sampling_mode": "off",
+ "thinking": false,
+ "use_default_template": true,
+ "mtp": "auto",
+ "clip": [
+ "16",
+ 0
+ ],
+ "image": [
+ "45",
+ 0
+ ]
+ },
+ "class_type": "TextGenerate",
+ "_meta": {
+ "title": "Write this clip's shot list (Qwen3-VL)"
+ }
+ },
+ "47": {
+ "inputs": {
+ "text": "hat",
+ "clip": [
+ "26",
+ 1
+ ]
+ },
+ "class_type": "CLIPTextEncode",
+ "_meta": {
+ "title": "SAM: hats"
+ }
+ },
+ "48": {
+ "inputs": {
+ "detection_threshold": 0.35,
+ "max_objects": 0,
+ "detect_interval": 1,
+ "images": [
+ "37",
+ 0
+ ],
+ "model": [
+ "26",
+ 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": {
+ "source_fps": 24,
+ "crop": "center",
+ "state": [
+ "32",
+ 0
+ ],
+ "latent": [
+ "59",
+ 1
+ ],
+ "vae": [
+ "23",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ],
+ "source_frames": [
+ "8",
+ 0
+ ],
+ "source_audio": [
+ "9",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexLoopSourceAVTarget",
+ "_meta": {
+ "title": "Source clip (frames + audio)"
+ }
+ },
+ "51": {
+ "inputs": {
+ "noise_seed": [
+ "32",
+ 5
+ ]
+ },
+ "class_type": "RandomNoise",
+ "_meta": {
+ "title": "Clip Seed"
+ }
+ },
+ "52": {
+ "inputs": {
+ "headroom": 0.1,
+ "hold_frames": 2,
+ "subject": 1,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "labels": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Pass 1: labelled people (+ headroom)"
+ }
+ },
+ "53": {
+ "inputs": {
+ "headroom": 0,
+ "hold_frames": 1,
+ "subject": 1,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "labels": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Pass 1: labelled people, no headroom (mannequin)"
+ }
+ },
+ "54": {
+ "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": [
+ "58",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Pass 1: grow mask (~4% of the frame)"
+ }
+ },
+ "55": {
+ "inputs": {
+ "blur": 0.01,
+ "images": [
+ "35",
+ 0
+ ],
+ "mask": [
+ "53",
+ 0
+ ],
+ "size": [
+ "53",
+ 1
+ ]
+ },
+ "class_type": "H3GreyMannequins",
+ "_meta": {
+ "title": "Pass 1: hide them (grey mannequins)"
+ }
+ },
+ "56": {
+ "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": [
+ "52",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Pass 1: hat search area (person + 60 px)"
+ }
+ },
+ "57": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "multiply",
+ "destination": [
+ "49",
+ 0
+ ],
+ "source": [
+ "56",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Pass 1: only their hats"
+ }
+ },
+ "58": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "add",
+ "destination": [
+ "52",
+ 0
+ ],
+ "source": [
+ "57",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Pass 1: people + hats"
+ }
+ },
+ "59": {
+ "inputs": {
+ "prompt": [
+ "60",
+ 0
+ ],
+ "width": [
+ "32",
+ 8
+ ],
+ "height": [
+ "32",
+ 9
+ ],
+ "length": [
+ "32",
+ 6
+ ],
+ "ref_image_size": "match",
+ "clip": [
+ "22",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ],
+ "ref_images.ref_image_0": [
+ "2",
+ 0
+ ],
+ "ref_videos.ref_video_0": [
+ "55",
+ 0
+ ],
+ "ref_video_audios.ref_video_audio_0": [
+ "32",
+ 12
+ ]
+ },
+ "class_type": "MiniMaxH3ReferenceToVideo",
+ "_meta": {
+ "title": "Pass 1: reference conditioning"
+ }
+ },
+ "60": {
+ "inputs": {
+ "prompt": [
+ "62",
+ 0
+ ],
+ "shots": [
+ "46",
+ 0
+ ]
+ },
+ "class_type": "H3FillShots",
+ "_meta": {
+ "title": "Pass 1: insert shot list into prompt"
+ }
+ },
+ "61": {
+ "inputs": {
+ "source": [
+ "60",
+ 0
+ ]
+ },
+ "class_type": "PreviewAny",
+ "_meta": {
+ "title": "Pass 1: clip prompt (what H3 gets)"
+ }
+ },
+ "62": {
+ "inputs": {
+ "subject": 1,
+ "subject_prompts": [
+ "14",
+ 6
+ ],
+ "clip_index": [
+ "32",
+ 1
+ ]
+ },
+ "class_type": "H3SubjectPrompt",
+ "_meta": {
+ "title": "Pass 1: prompt for Subject 1 only"
+ }
+ },
+ "63": {
+ "inputs": {
+ "grow": 0,
+ "keep_audio": true,
+ "megapixels": 0,
+ "vae": [
+ "23",
+ 0
+ ],
+ "images": [
+ "50",
+ 1
+ ],
+ "mask": [
+ "54",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ],
+ "audio": [
+ "50",
+ 2
+ ]
+ },
+ "class_type": "MiniMaxH3FantasticVideoEditLatent",
+ "_meta": {
+ "title": "Pass 1: edit latent (source + mask + audio)"
+ }
+ },
+ "64": {
+ "inputs": {
+ "mask_meaning": "white = generate",
+ "audio_mode": "preserve source audio",
+ "mask_conversion": "H3 exact (causal/token max)",
+ "target_latent": [
+ "63",
+ 0
+ ],
+ "mask": [
+ "54",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexMaskedTarget",
+ "_meta": {
+ "title": "Pass 1: masked target"
+ }
+ },
+ "65": {
+ "inputs": {
+ "state": [
+ "32",
+ 0
+ ],
+ "conditioning": [
+ "59",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ],
+ "latent": [
+ "64",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainContext",
+ "_meta": {
+ "title": "Pass 1: apply clip context"
+ }
+ },
+ "66": {
+ "inputs": {
+ "model": [
+ "21",
+ 0
+ ],
+ "conditioning": [
+ "65",
+ 0
+ ]
+ },
+ "class_type": "BasicGuider",
+ "_meta": {
+ "title": "Pass 1: guider"
+ }
+ },
+ "67": {
+ "inputs": {
+ "scheduler": "simple",
+ "steps": [
+ "32",
+ 7
+ ],
+ "denoise": 1,
+ "model": [
+ "21",
+ 0
+ ]
+ },
+ "class_type": "BasicScheduler",
+ "_meta": {
+ "title": "Pass 1: schedule"
+ }
+ },
+ "68": {
+ "inputs": {
+ "noise": [
+ "51",
+ 0
+ ],
+ "guider": [
+ "66",
+ 0
+ ],
+ "sampler": [
+ "25",
+ 0
+ ],
+ "sigmas": [
+ "67",
+ 0
+ ],
+ "latent_image": [
+ "65",
+ 3
+ ]
+ },
+ "class_type": "SamplerCustomAdvanced",
+ "_meta": {
+ "title": "Pass 1: sample video + audio"
+ }
+ },
+ "69": {
+ "inputs": {
+ "samples": [
+ "68",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ]
+ },
+ "class_type": "VAEDecode",
+ "_meta": {
+ "title": "Pass 1: decode video"
+ }
+ },
+ "70": {
+ "inputs": {
+ "upscale_method": "area",
+ "largest_size": 512,
+ "image": [
+ "69",
+ 0
+ ]
+ },
+ "class_type": "ImageScaleToMaxDimension",
+ "_meta": {
+ "title": "Pass 2: motion reference from pass 1 (~512 px)"
+ }
+ },
+ "71": {
+ "inputs": {
+ "headroom": 0.1,
+ "hold_frames": 2,
+ "subject": 2,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "labels": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Pass 2: labelled people (+ headroom)"
+ }
+ },
+ "72": {
+ "inputs": {
+ "headroom": 0,
+ "hold_frames": 1,
+ "subject": 2,
+ "track_data": [
+ "38",
+ 0
+ ],
+ "labels": [
+ "41",
+ 0
+ ]
+ },
+ "class_type": "H3RoleMask",
+ "_meta": {
+ "title": "Pass 2: labelled people, no headroom (mannequin)"
+ }
+ },
+ "73": {
+ "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": [
+ "77",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Pass 2: grow mask (~4% of the frame)"
+ }
+ },
+ "74": {
+ "inputs": {
+ "blur": 0.01,
+ "images": [
+ "70",
+ 0
+ ],
+ "mask": [
+ "72",
+ 0
+ ],
+ "size": [
+ "72",
+ 1
+ ]
+ },
+ "class_type": "H3GreyMannequins",
+ "_meta": {
+ "title": "Pass 2: hide them (grey mannequins)"
+ }
+ },
+ "75": {
+ "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": [
+ "71",
+ 0
+ ]
+ },
+ "class_type": "GrowMaskWithBlur",
+ "_meta": {
+ "title": "Pass 2: hat search area (person + 60 px)"
+ }
+ },
+ "76": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "multiply",
+ "destination": [
+ "49",
+ 0
+ ],
+ "source": [
+ "75",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Pass 2: only their hats"
+ }
+ },
+ "77": {
+ "inputs": {
+ "x": 0,
+ "y": 0,
+ "operation": "add",
+ "destination": [
+ "71",
+ 0
+ ],
+ "source": [
+ "76",
+ 0
+ ]
+ },
+ "class_type": "MaskComposite",
+ "_meta": {
+ "title": "Pass 2: people + hats"
+ }
+ },
+ "78": {
+ "inputs": {
+ "prompt": [
+ "79",
+ 0
+ ],
+ "width": [
+ "32",
+ 8
+ ],
+ "height": [
+ "32",
+ 9
+ ],
+ "length": [
+ "32",
+ 6
+ ],
+ "ref_image_size": "match",
+ "clip": [
+ "22",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ],
+ "ref_images.ref_image_0": [
+ "5",
+ 0
+ ],
+ "ref_videos.ref_video_0": [
+ "74",
+ 0
+ ],
+ "ref_video_audios.ref_video_audio_0": [
+ "32",
+ 12
+ ]
+ },
+ "class_type": "MiniMaxH3ReferenceToVideo",
+ "_meta": {
+ "title": "Pass 2: reference conditioning"
+ }
+ },
+ "79": {
+ "inputs": {
+ "prompt": [
+ "81",
+ 0
+ ],
+ "shots": [
+ "46",
+ 0
+ ]
+ },
+ "class_type": "H3FillShots",
+ "_meta": {
+ "title": "Pass 2: insert shot list into prompt"
+ }
+ },
+ "80": {
+ "inputs": {
+ "source": [
+ "79",
+ 0
+ ]
+ },
+ "class_type": "PreviewAny",
+ "_meta": {
+ "title": "Pass 2: clip prompt (what H3 gets)"
+ }
+ },
+ "81": {
+ "inputs": {
+ "subject": 2,
+ "subject_prompts": [
+ "14",
+ 6
+ ],
+ "clip_index": [
+ "32",
+ 1
+ ]
+ },
+ "class_type": "H3SubjectPrompt",
+ "_meta": {
+ "title": "Pass 2: prompt for Subject 2 only"
+ }
+ },
+ "82": {
+ "inputs": {
+ "grow": 0,
+ "keep_audio": true,
+ "megapixels": 0,
+ "vae": [
+ "23",
+ 0
+ ],
+ "images": [
+ "69",
+ 0
+ ],
+ "mask": [
+ "73",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ],
+ "audio": [
+ "50",
+ 2
+ ]
+ },
+ "class_type": "MiniMaxH3FantasticVideoEditLatent",
+ "_meta": {
+ "title": "Pass 2: edit latent (source + mask + audio)"
+ }
+ },
+ "83": {
+ "inputs": {
+ "mask_meaning": "white = generate",
+ "audio_mode": "preserve source audio",
+ "mask_conversion": "H3 exact (causal/token max)",
+ "target_latent": [
+ "82",
+ 0
+ ],
+ "mask": [
+ "73",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexMaskedTarget",
+ "_meta": {
+ "title": "Pass 2: masked target"
+ }
+ },
+ "84": {
+ "inputs": {
+ "state": [
+ "32",
+ 0
+ ],
+ "conditioning": [
+ "78",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ],
+ "latent": [
+ "83",
+ 0
+ ],
+ "audio_vae": [
+ "24",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainContext",
+ "_meta": {
+ "title": "Pass 2: apply clip context"
+ }
+ },
+ "85": {
+ "inputs": {
+ "model": [
+ "21",
+ 0
+ ],
+ "conditioning": [
+ "84",
+ 0
+ ]
+ },
+ "class_type": "BasicGuider",
+ "_meta": {
+ "title": "Pass 2: guider"
+ }
+ },
+ "86": {
+ "inputs": {
+ "scheduler": "simple",
+ "steps": [
+ "32",
+ 7
+ ],
+ "denoise": 1,
+ "model": [
+ "21",
+ 0
+ ]
+ },
+ "class_type": "BasicScheduler",
+ "_meta": {
+ "title": "Pass 2: schedule"
+ }
+ },
+ "87": {
+ "inputs": {
+ "noise": [
+ "51",
+ 0
+ ],
+ "guider": [
+ "85",
+ 0
+ ],
+ "sampler": [
+ "25",
+ 0
+ ],
+ "sigmas": [
+ "86",
+ 0
+ ],
+ "latent_image": [
+ "84",
+ 3
+ ]
+ },
+ "class_type": "SamplerCustomAdvanced",
+ "_meta": {
+ "title": "Pass 2: sample video + audio"
+ }
+ },
+ "88": {
+ "inputs": {
+ "samples": [
+ "87",
+ 0
+ ],
+ "vae": [
+ "23",
+ 0
+ ]
+ },
+ "class_type": "VAEDecode",
+ "_meta": {
+ "title": "Pass 2: decode video"
+ }
+ },
+ "89": {
+ "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": [
+ "50",
+ 1
+ ],
+ "mask": [
+ "54",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ContexMaskGridPreview",
+ "_meta": {
+ "title": "Mask preview"
+ }
+ },
+ "90": {
+ "inputs": {
+ "images": [
+ "89",
+ 1
+ ]
+ },
+ "class_type": "PreviewImage",
+ "_meta": {
+ "title": "Mask preview (white = regenerated)"
+ }
+ },
+ "91": {
+ "inputs": {
+ "samples": [
+ "87",
+ 0
+ ],
+ "vae": [
+ "24",
+ 0
+ ]
+ },
+ "class_type": "VAEDecodeAudio",
+ "_meta": {
+ "title": "Decode Audio"
+ }
+ },
+ "92": {
+ "inputs": {
+ "trim_frames": [
+ "84",
+ 1
+ ],
+ "fps": 24,
+ "match_tail": true,
+ "audio_trim_mode": "sync_with_video",
+ "images": [
+ "88",
+ 0
+ ],
+ "audio": [
+ "91",
+ 0
+ ],
+ "state": [
+ "32",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3LoopTrim",
+ "_meta": {
+ "title": "Trim Overlap"
+ }
+ },
+ "93": {
+ "inputs": {
+ "state": [
+ "32",
+ 0
+ ],
+ "images": [
+ "92",
+ 0
+ ],
+ "sampled_latent": [
+ "87",
+ 0
+ ],
+ "audio": [
+ "92",
+ 1
+ ],
+ "images_with_overlap": [
+ "92",
+ 2
+ ]
+ },
+ "class_type": "MiniMaxH3ChainSegmentSave",
+ "_meta": {
+ "title": "Save Clip + Checkpoint"
+ }
+ },
+ "94": {
+ "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": [
+ "32",
+ 0
+ ],
+ "segment": [
+ "93",
+ 0
+ ],
+ "audio": [
+ "92",
+ 1
+ ]
+ },
+ "class_type": "MiniMaxH3ChainReview",
+ "_meta": {
+ "title": "Review (off = no pause)"
+ }
+ },
+ "95": {
+ "inputs": {
+ "between_scene_cleanup": "off",
+ "execution_mode": "recursive",
+ "flow": [
+ "31",
+ 0
+ ],
+ "state": [
+ "32",
+ 0
+ ],
+ "images": [
+ "92",
+ 0
+ ],
+ "sampled_latent": [
+ "87",
+ 0
+ ],
+ "segment": [
+ "94",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainLoopEnd",
+ "_meta": {
+ "title": "Loop End"
+ }
+ },
+ "96": {
+ "inputs": {
+ "audio_source": "source",
+ "filename": "advanced_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": [
+ "95",
+ 0
+ ]
+ },
+ "class_type": "MiniMaxH3ChainAssemble",
+ "_meta": {
+ "title": "Final Video"
+ }
+ }
+}
\ No newline at end of file