Nodes/ComfyUI-Easy-Media/H3 Motion Context Latent Trim
ComfyUI Node

H3 Motion Context Latent Trim

The Little Node That Keeps Your H3 Project From OOMing

By yolain·Created 4 months ago·Updated about 23 hours ago· 184
H3 Motion Context Latent Trim
  • latent
  • context_latent
context_length22

If you've run a MiniMax H3 MultiTrack Project in ComfyUI-Easy-Media (v1.3.0+) and expanded what easy multitrackProject actually builds, you've seen this node slotted between segments doing what looks like nothing - a latent goes in, a latent comes out, and it's somehow the load-bearing part of a long take. That's by design. H3 Motion Context Latent Trim is the memory cop.

What it's for

H3's "Context" continuity mode doesn't restart from a blank slate - it feeds the tail of the previous segment's result into the next one as a starting latent, so motion and audio keep flowing across the join. The problem: that previous segment is a full, high-resolution video and audio latent sitting in VRAM, and H3 segments are heavy. Hold every finished segment in memory while you generate segment nine and you run out of card before you run out of shots.

This node is the trim. It takes the finished AV latent, keeps only the last context_length worth of video frames plus the matching audio tail, detaches it, copies it to CPU, and re-wraps it as a proper H3 nested tensor (video stream + audio stream, the format ComfyUI's H3 nodes expect). Everything else gets dropped and its VRAM freed. That's exactly what Easy Media's project pipeline does internally - the changelog calls it "keep[ing] only the 22-frame high-resolution audio/video context tail on CPU between segments and in completed project artifacts."

The inputs that matter

  • latent - the finished H3 AV latent you want to carry forward. Don't feed it pixels; this is a latent and it's going straight back into a sampler.
  • context_length - a combo, not a free number: 5, 22, 39, 56, default 22. These aren't arbitrary; they're tail lengths that land cleanly on H3's temporal grid so the context can be handed off without breaking the model's frame-token alignment. 22 frames is about a second at 24fps, which is what the project defaults to.

The single output is context_latent, and it's meant to wire into the context_latent input of easy MiniMaxH3MotionContextHard (or its high-res sibling on a second pass) for the next segment - the exact wiring the multitrack project's graph expansion produces.

When would you actually use it?

Honest answer: almost never by hand. The pack marks it internal/dev-only (is_dev_only=True, in the _EasyUse/H3 category) and no bundled template drops it in front of you. Its real job is inside the MultiTrack Project expansion, and there's a matching easy removeH3MotionContextLatent for cleaning up leftover context files when a loop finishes.

You would reach for it if you're hand-rolling your own H3 segment loop - the segment-by-segment pattern using the motion-context nodes directly instead of the all-in-one project node. There, trimming between segments is on you, and this saves you writing the torch slicing yourself.

Install and gotchas

Install is the pack install: ComfyUI Manager → search "ComfyUI-Easy-Media", or cd ComfyUI/custom_nodes && git clone https://github.com/yolain/ComfyUI-Easy-Media, then restart. The node itself has zero extra dependencies - no models, no FFmpeg, just torch. (The pack wants system FFmpeg and various optional ASR/upscaler models for its other features.) The H3 context machinery does require native audio/video keyframe support in ComfyUI 0.34.0+, so keep ComfyUI current.

Where people get burned: change context_length mid-project and a later Context segment inherits a tail trimmed at a different length than the join expects. The project pipeline always uses 22 for its checkpointing - leave the default unless you know why you're changing it.

CategoryEasyUse/H3/dev

Inputs (2)

NameTypeDefaultDescription
latentLATENT
context_lengthCOMBO224 options: 5, 22, 39, 56

Outputs (1)

NameTypeDescription
context_latentLATENT