Nodes/H3 Motion Context/H3 Motion Context Save Latent
ComfyUI Node

H3 Motion Context Save Latent

The invisible hand that carries your H3 clip's tail into the next run

By NikoDemon80·Created 19 days ago·Updated 10 days ago· 735
H3 Motion Context Save Latent
  • latent
  • latent_path
filename_prefixh3_context/clip
clip_index0

The Motion Context node's best input - context_latent, which carries the previous clip's picture and sound across a join with no quality-sapping decode round trip - has a problem: you can't wire the sampler straight into it. ComfyUI calls that a circular connection, and it's right. The latent you want is from the previous run, not this one. So it crosses runs through a file, exactly the way your frames and audio already do, and this node is the "write" half of that file. The Load Latent node is the "read" half.

There's a reason the stock Save Latent node won't do the job: it can't serialize H3's paired video/audio latent. H3 generates picture and sound as one latent, and this node saves the two streams side by side into a .safetensors file (tagged h3_motion_context_av_v1 so it can't be mistaken for anything else). Wire its output into the Load node next run and the Motion Context node pins both streams from it.

Inputs and the one setting that matters

latent - the sampler's output latent, the same one you wire into your decode nodes. Don't grab a latent from anywhere else.

filename_prefix - defaults to h3_context/clip, saved under the ComfyUI output folder. The default keeps every chain latent in one folder, which is what lets the Load node pick files up by index. Leave it alone unless you know why you're changing it.

clip_index - which clip of the chain this one is. Set 2 here and 1 on the Load node when you're making clip 2 from clip 1. This is the setting that makes re-rolls sane: at a fixed index the save overwrites its own reject instead of stacking new files, so your "keep it?" decision is about one file, not a folder of attempts. At 0 it's the old behaviour - a new numbered file every run, numbered by run not by clip, with a trailing underscore in the name. Fine for a one-shot, a trap for anything you're going to retry.

Output is latent_path, a string pointing at the file it just wrote - handy if you want to see where things landed or feed it straight into the Load node.

Wiring

SamplerCustomAdvanced -> H3 Motion Context Save Latent   (this run)
next run:              H3 Motion Context Load Latent -> context_latent

Making clip 2 from clip 1: Load 1, Save 2. Don't like the result? Queue again, change nothing - it reloads clip 1 and overwrites clip 2. Happy with it? Bump both numbers and move on. Files are named the obvious way: clip_00002.safetensors is clip 2.

Install

Part of the NikoDemon80/ComfyUI-H3-Motion-Context pack. ComfyUI Manager (search "H3 Motion Context") or git clone https://github.com/NikoDemon80/ComfyUI-H3-Motion-Context into ComfyUI/custom_nodes, then restart. No model downloads. It needs safetensors, which ComfyUI ships, so there's nothing extra to install.

One quirk worth knowing: it's an output node, so it only runs at the end of a graph. That's fine - it should be there anyway, since the latent it wants comes off the sampler and you're already decoding that.

Categoryconditioning/minimax

Inputs (3)

NameTypeDefaultDescription
latentLATENTThe sampler's output latent (the same one you wire into the decode nodes).
filename_prefixSTRINGh3_context/clipSaved under the ComfyUI output folder. The default keeps all chain latents in one folder so the Load node can always pick the newest.
clip_indexINT00–9999Which clip of the chain THIS is. Saves to that clip's fixed slot, so a re-roll overwrites its own reject instead of stacking new files. Generating clip 2: set 2 here and 1 on the Load node. 0 = old behaviour, a new numbered file every run (numbers count runs, not clips).

Outputs (1)

NameTypeDescription
latent_pathSTRING