Nodes/Mickmumpitz-Nodes/End Frame Injector
ComfyUI Node

End Frame Injector

Hands each iteration its target end frame

By mickmumpitz·Created 8 months ago·Updated 9 days ago· 47
End Frame Injector
  • anchor_frames
  • image
  • has_frame

End Frame Injector answers one question inside Mickmumpitz's iterative video loop: "what frame should this pass be heading toward?" Long-form video in ComfyUI is built from chunks, and chunk generation drifts unless you anchor it. The pack's FrameContextFit + AnchorFrameExtractor pair builds a ladder of "here's the shape of the whole shot" key frames; this node picks the single anchor frame that ends the current iteration, so the generator has a destination instead of wandering.

The author's own description is refreshingly concrete: "Iteration 0 → anchor_frames[1], iteration 1 → anchor_frames[2], etc." The off-by-one is deliberate. AnchorFrameExtractor puts the start frame at index 0, so the end frame for iteration N lives at N + 1.

How it works

Like the other loop nodes, it has a hidden iteration input that the pack's prompt handler injects at submit time - you never type the number. When the node runs, it computes target_idx = iteration + 1 and pulls that frame out of the anchor_frames batch (as a single-frame IMAGE, so it plugs straight into an image input). If the anchor batch is shorter than iteration + 1 - you've generated past the end of your planned key frames - it falls back to the last anchor frame and sets has_frame to false. That false flag is the loop's cue: "no more planned anchors, you're on your own from here."

So it's not magic. It's a carefully indexed indexer, and its whole value is that the indexing matches the pack's iteration rhythm.

The inputs and outputs

  • anchor_frames (IMAGE) - the batch from AnchorFrameExtractor (or anything shaped like it: first frame = start, then one anchor per planned boundary).
  • iteration - hidden, injected by the loop; defaults to 0.

Outputs:

  • image (IMAGE) - the end frame for the current iteration, as a 1-frame batch.
  • has_frame (BOOLEAN) - true when the target index existed in the anchor batch, false on the fallback.

Wire image into wherever your loop consumes the "target end frame" - typically a reference/context input on the sampler or a control setup. Wire has_frame into whatever decides whether the loop can keep going.

Installing it

Ships with the whole Mickmumpitz pack - Manager, search "Mickmumpitz", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git

Just tensor indexing under the hood, so the pack's base deps cover it. No models.

Common issues

The usual failure is feeding it a batch that isn't actually anchor-shaped. If you hand it raw frames or a ControlEndFrameExtractor output (which starts with frame 0 but was built for a different rhythm), the off-by-one lands on the wrong frame and your chunks aim at the wrong target. Keep it wired to AnchorFrameExtractor - that's the contract it was written against. And remember has_frame going false isn't an error: it's the designed "you've run out of anchors" signal. If you never look at it, your loop can generate into the void after the plan ends.

Categoryimage/sequence

Inputs (1)

NameTypeDefaultDescription
anchor_framesIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
has_frameBOOLEAN