Nodes/ComfyUI-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 4 months ago·Updated about 12 hours ago· 1,483
H3 Motion Context Save Latent
  • latent
  • conditioning
  • latent_path
◄filename_prefixh3_context/clip►
◄clip_index1►
◄pin_frames—►
◄prompt—►
◄geiru_drop—►

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 (7)

NameTypeDefaultDescription
latentLATENTThe sampler's output, the same one you decode.
filename_prefixSTRINGh3_context/clipFolder and name under ComfyUI's output folder. Keep every clip of a chain in one folder.
clip_indexINT10–9999Which clip of the chain this is, starting at 1. Re-rolling a clip overwrites its own file. The Chain node sets this. 0 saves a new file every run, outside any chain.
pin_framesoptINTWire from Motion Context's trim_frames. Recorded so Chain Upscale knows the carried-over length.
promptoptSTRINGWire in this clip's prompt text. Recorded so Chain Prompt can give the upscale the right prompt for every clip.
geiru_dropoptINTWire from Motion Context's geiru_drop. Recorded so Chain Upscale matches it.
conditioningoptCONDITIONINGWire the plain Reference to Video conditioning, not Motion Context's output. Saved with the clip, so Chain Upscale refines it with exactly this prompt and these references, without a text encoder.

Outputs (1)

NameTypeDescription
latent_pathSTRING—