Nodes/ComfyUI-H3MC-Distributed/H3 Motion Context Load Latent From Video (Distributed)
ComfyUI Node

H3 Motion Context Load Latent From Video (Distributed)

The Clip You Already Saved Is the Context — No Sidecar File to Hunt For

By ymiyad·Created 26 days ago·Updated 10 days ago· 2
H3 Motion Context Load Latent From Video (Distributed)
    • LATENT
    ◄enabledfalse►
    ◄video▾►

    MiniMax H3 makes clips measured in seconds - 4 to 15 of them at up to 2K - so anything longer than that is chaining, and chaining means the next clip needs to know what the last one did. H3 Motion Context's answer is to hand the previous clip's latent forward as context. That works, right up to the moment you have five candidate takes of clip 3 and you need to know which .safetensors blob belongs to the one you liked.

    This node deletes that problem. It reads the H3 AV latent that's embedded in a video file - the video is the context. Pick the take you want, wire its latent into the next round, done.

    How it works

    When the companion save node writes a candidate, it stuffs the previous clip's latent into the video's own container metadata under a h3_motion_context_latent_v1 tag, base64-encoded. This node opens the file with PyAV, pulls that tag out, base64-decodes it, and hands back a LATENT dict shaped the way H3 expects: a two-stream nested video/audio pair. If the tag isn't there, it raises rather than guessing.

    The clever bit isn't the metadata trick - ComfyUI has been riding workflow JSON inside PNGs and MP4s for years, and as our own metadata notes put it, the metadata is the payload. The clever bit is that the file picker is a standard ComfyUI video-upload combo backed by ComfyUI/input. ComfyUI-Distributed's media sync scans prompts for video-named inputs pointing at files under ComfyUI/input and ships them to every worker before dispatch. So dropping the winning clip into input/ is the whole handoff. No shared network drive, no manual path-passing to four machines.

    The inputs and the output

    Two required fields, and only one of them is a decision you make more than once:

    • enabled (default off). Its tooltip says it best: "Leave off for the first clip in a chain (no previous context yet)." Off means the node returns None, which is exactly what H3 Motion Context expects on clip one. Turn it on for every clip after.
    • video. A video saved by H3 Motion Context Save Video With Latent (Distributed). The dropdown lists .mp4, .webm and .mkv files found in ComfyUI/input.

    One output, LATENT - wire it to H3 Motion Context's context_latent input. Under the hood the node returns {"samples": [video_tensor, audio_tensor]}, so audio context rides along with picture. That's the part last-frame-to-first-frame chaining never had: the usual trick for stretching video models (see our Wan video notes) drops the audio entirely and drifts on identity across boundaries. Carrying the latent keeps both.

    Installing it

    You need ComfyUI-Distributed and ComfyUI-H3-Motion-Context installed and working first. This pack is glue; it doesn't replace either.

    cd ComfyUI/custom_nodes
    git clone https://github.com/ymiyad/ComfyUI-H3MC-Distributed.git
    

    Restart ComfyUI. ComfyUI Manager will also find it if you search the pack title. The only declared Python dependency is av (PyAV) - usually already present because video I/O needs it, but pip install av with ComfyUI's own interpreter if not. torch and safetensors come from ComfyUI itself. Clone it on every machine, Master and workers.

    Where it goes wrong

    The dropdown only says "none". The node builds its file list by scanning ComfyUI/input for video extensions, and falls back to a single "none" entry when it finds none. That's not a broken install - just an empty folder.

    "has no embedded H3 latent". You picked a video that wasn't saved by the companion save node, or one that got re-encoded since. Uploading a clip somewhere and downloading it again strips container metadata; so does running it through an editor. Keep the original.

    The wrong context is being used. The node's change detection keys off the file path plus its mtime, so replacing a file with a new one of the same name does invalidate the cached value. But if you're editing the graph around it and not the file, ComfyUI's cache will happily reuse the previous load - that's normal ComfyUI plumbing behavior, not a bug here.

    Distributed won't ship the file. The README flags this one directly: in the author's testing, VHS's "Load Video (Upload)" node didn't work reliably through Distributed, while ComfyUI's own video-upload widget pattern did. This node uses the latter. If you're building your own nodes around this workflow, copy that pattern, not VHS's.

    One expectation to set: H3 Motion Context is new enough that it has essentially no community footprint yet - a search of the reddit corpus turns up nothing - so you're debugging this largely alone. Read the log lines the node prints; it tells you the tensor shapes and payload size it loaded, which is usually enough to spot a mismatched clip.

    Categoryconditioning/minimax

    Inputs (2)

    NameTypeDefaultDescription
    enabledBOOLEANfalseLeave off for the first clip in a chain (no previous context yet).
    videoCOMBOA video saved by H3 Motion Context Save Video With Latent (Distributed).

    Outputs (1)

    NameTypeDescription
    LATENTLATENT—