Skip to content

Releases: NikoDemon80/ComfyUI-H3-Motion-Context

v0.5.1 - example workflow

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 02 Sep 23:30

Requires ComfyUI 0.34.0 or newer. Use 0.3.1 on anything older.

  • Example workflow updated.

v0.5.0 - Load 0 is first clip, Chain node walks the pair

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 02 Sep 14:05

Requires ComfyUI 0.34.0 or newer. Use 0.3.1 on anything older.

#25 by feigo313 is why Load 0 is first-clip/no-context, so Motion Context stays enabled from the first clip, and why the Chain node exists: walking those indices with run-on-change queues twice and skips slots.

  • Load Latent clip_index 0 is first-clip/no-context: nothing is read, Motion Context passes the original conditioning through, and trim_frames is 0. Leave the node enabled. The chain is Load 0 / Save 1, then Load 1 / Save 2. Positive indices still load that exact slot. The old load-newest meaning of index 0 is gone.
  • H3 Motion Context Chain node: Approve advances Load/Save then queues once, Run/Re-roll repeats the current slot (use it instead of ComfyUI's Run), Chain auto-approves from the current indices, Reset sets 0/1 without queuing. Load, Save, and Chain must share one canvas group or the buttons do nothing. Button clicks do not open the node menu. Do not use queue "run on change" to walk indices.
  • Save Latent can overwrite a slot that Load still has memory-mapped on Windows (os error 1224). Load copies tensors off the file first, and Save writes through a temp file.

v0.4.0 - ComfyUI 0.34.0, patches removed

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 26 Aug 18:21

Requires ComfyUI 0.34.0 or newer. Use 0.3.1 on anything older.

ComfyUI now places keyframe anchors at any frame itself, so the two
runtime patches this pack carried are gone. Nothing in ComfyUI is
modified any more.

  • patch_layout.py and patch_payload.py removed. The node builds plain
    keyframe dicts and hands them to stock code.
  • layout_contract.py added. It proves, once before the first render,
    that anchors sit where the arithmetic says and that the pinned audio
    window is placed literally from a fractional, negative anchor index.
    No stock node can produce such an index, so nothing upstream tests it,
    and an integer cast added later would move the pinned sound silently.
    If a check fails the node refuses and names what moved.
  • The pinned audio is a keyframe rather than a reference block. A Ref2VA
    graph's reference list is left untouched.
  • Add Guide for MiniMax H3 anchors survive alongside a chained head,
    including ones carrying their own audio. Guides landing inside the
    pinned head are dropped with a warning, as first_frame anchors are.
  • Other packs may patch the layout without this one standing down, since
    it no longer competes for that code. If it finds the constructor
    wrapped it says who by and checks the behaviour anyway.
  • Anchor and audio window coordinates are identical to 0.3.1, verified
    against the real upstream layout on both shapes.

v0.3.1 - ComfyUI 0.33 compatibility

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 15 Aug 01:18

0.3.1 - ComfyUI 0.33 compatibility

Fixes the crash on ComfyUI 0.33, reported in #12 by javawock7618 and #8 by
azra1l. Thanks to both for narrowing it to the exact commits.

0.33 removed frame_count from PackedLayout.__init__, along with the
first/last keyframe restriction it existed to enforce. The pack's
self-test failed against the new signature and the node refused to run,
which is the intended failure mode but not a useful one.

The patch now reads the constructor's signature and adapts to either
shape. Verified against the real upstream file at both 0.32.0
(ddbaa87) and 0.33.0 (7fe8a61): identical anchor and audio window
coordinates on either, to the last bit.

Also in this release:

  • Keyframe audio latents are no longer dropped from the payload. 0.33
    lets a keyframe carry audio of its own, and rebuilding the list from
    references alone filled every audio conditioning row with the wrong
    content.
  • Anchors pair with the correct rows when a stock Add Guide anchor shares
    the graph. On 0.33 an audio-only guide contributes a cond_audio
    segment and no cond segment, which the old pairing miscounted.
  • The mixed keyframe guard is retired on 0.33, where stock compensates
    untagged keyframes itself. A Ref2VA graph carrying an Add Guide anchor
    is now a supported combination rather than a refusal.
  • The test harness fakes both layout shapes, so both paths stay covered.

What 0.33 means for this pack

ComfyUI 0.33 added interior keyframe anchors, multi-frame guide clips and
an Add Guide for MiniMax H3 node. If all you want is to anchor a still or
a short clip at an arbitrary frame, use the stock node.

What this pack still does that stock does not: it slices the previous
clip's tail straight out of its latent with no VAE round trip, and it ends
the pinned audio window at the join rather than starting it there, which
is the difference between the model continuing your soundtrack and the
model writing something that sounds like it.

This is a compatibility release. A rebuild on 0.33's public keyframe
format, dropping the runtime patches entirely, is next.

v0.3.0 - Last Frame Anchors, Audio Fixes, Test Node

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 12 Aug 03:22

0.3.0

New

last_frame anchors survive the chain. If your graph pins a target
image on the final frame (FirstLastFrameToVideo and friends), the Motion
Context node used to silently throw it away when it wrote its own
keyframes. Now it keeps the anchor, tags it, and the layout patch
compensates its position on the extended timeline, so you can drive a clip
toward a destination image and have it continue seamlessly from the
previous one. Anchors that land inside the pinned head are dropped with a
warning - those frames belong to the context - and a frame-count mismatch
between incoming keyframes and the current latent is now a clear error
instead of a corrupted layout.

In-graph seam measurement. New H3 Motion Context Seam Probe node:
wire it the two clips and it reports level step, spectral discontinuity and
correlation at the join, right in the graph. No more exporting audio and
running scripts to find out whether a seam is audible.

Changed

audio_context_length defaults to 24 (was 22). 24 frames is exactly
one second, follows the ×3 rule, and lands the pinned audio precisely on
the audio grid. Multiples of 24 keep both properties if you want a longer
audio context. 22 still works.

Example workflow refreshed. Ships with audio_context_length 24, the
Save Latent nodes default to clip_index 2 so rendering the example can't
overwrite your clip-1 latent, and the in-graph notes now spell out the
first-clip setup.

Docs and tests

The test scripts now run on Windows - path handling assumed forward
slashes - and the mock harness runs standalone again. New offline test for
the seam probe node, and new smoke-test coverage for the last_frame
merge, the dropped-anchor warning and the frame-count error.

README updated throughout: last-frame wiring, the seam probe, the 24-frame
audio context reasoning, and the full seven-script testing section.

v0.2.0 - Ref2VA Chaining, Audio/Video Latent

Choose a tag to compare

@NikoDemon80 NikoDemon80 released this 09 Aug 17:20

0.2.0

Read this first if you're updating

The node's settings changed. ComfyUI stores widget values by position,
so a workflow saved against 0.1 will load its numbers into the wrong
slots. Delete the Motion Context node, add it again, rewire it.

Only run one H3 chaining pack at a time. Several packs lift the same
first/last keyframe restriction independently and only one can own that
code. If another one gets there first this node now says so and refuses,
instead of failing in a way that looks like a bug here.

New

Reference mode and chaining work together. A Ref2VA graph keeps its own
image, video and audio references and the continuation audio is added
alongside them. Previously the node overwrote the list, so switching
chaining on silently dropped every reference the graph had.

The design is seitanism's, from the Banodoco MiniMax H3
seamless-extension thread, and was first implemented in @ethanfel's fork of
this repo. The implementation here is written independently, but they got
there first and the credit is theirs.

The pinned picture now comes from the latent. With context_latent
wired, the pinned frames are sliced straight out of the previous clip
instead of decoded to pixels and encoded again. No colour shift, no
contrast shift, no visible seam. Faster too. Nothing to configure, and you
no longer need to load the previous clip's video from disk at all.

56-frame context window, alongside 5, 22 and 39.

Changed

Two settings instead of six. context_length and
audio_context_length. The rest had one right answer and are now constants
at the top of nodes.py, with the losing branches still in the code if you
ever need to reproduce what they did.

The patches install on first use, not at import. Having the pack in
custom_nodes no longer changes anything about your other H3 workflows,
and both patches are gated to this pack's own graphs even once installed.

Pinned audio snaps to the audio grid. A frame is 5/3 of an audio step,
so some window and clip-length combinations placed it a third of a step off
the grid the model was filling. Fixed.

Resolution can't change mid-chain while using context_latent. A latent
can't be resized, so the node refuses and names both resolutions rather than
quietly dropping to the lossy path.

Docs and tests

README rewritten, with a section on prompting a chain: why the model renders
contradictions as unions, and how to open each clip so it doesn't.

Two new measurement scripts, tests/level_step.py for level and room-tone
continuity at each join, and tests/freeze_detect.py for held shots that
rendered as stills. Both from findings by the builder of a 16-clip sitcom
episode chained with this pack.