Nodes/Difforum/Difforum · Keyframes
ComfyUI Node

Difforum · Keyframes

Pick the Right Frames Off Your Render, on the Model's Grid

By chillithebillis·Created 4 months ago·Updated 11 days ago· 10
Difforum · Keyframes
  • frames
  • masks
  • keyframes
  • indices
  • sparse_batch
  • first_frame
  • last_frame
  • length
  • key_masks
  • info
◄gridLTX-2 / 2.5 (8k+1)►
◄every_seconds1.00►
◄fps24.00►
◄indices►

Every video-model bridge in Difforum needs the same boring thing: a handful of frames out of a clip, with the frame numbers of those frames, in a form the model's conditioning node can eat. This node does that, including the two things everyone gets wrong - grid snapping and the sparse batch.

Grid snapping is the whole point

Video models don't have a frame for every frame you have. Their latent is compressed temporally, and the usable lengths snap to a grid:

  • MiniMax H3 - 17k+5
  • LTX-2 / 2.5 - 8k+1
  • Wan 2.x - 4k+1
  • any - no snapping

A keyframe parked at frame 47 of an H3 graph lands between latent frames, and the guide gets smeared or dropped. Pick the right grid and the node snaps your selections onto real latent frames, plus emits the whole clip's snapped length so you don't discover the mismatch three nodes later.

The selection logic

every_seconds is the main dial. 1 second gives you many keyframes and strong guidance; 2 gives the model more freedom; 0 gives you first and last only. H3 is trained with a few guides per clip and its bridge caps them anyway, so more is definitely not better here.

indices overrides the spacing with explicit frames - '0, 48, 96, -1', where -1 means last. That's the escape hatch for "the beat is at 2.3 seconds, not 2.0".

fps tells the node what your clip is running at (take it from Setup). masks accepts Guide Frames' masks so that Fill Reveal can repaint exactly the revealed areas of the frames you picked.

Six outputs

keyframes - the picked frames, and the ones to feed Fill Reveal or H3 Guides. indices - their frame numbers as a comma-separated string, for H3 Guides or Keyframe Images. sparse_batch - a full-length batch that's black except at keyframes, which is exactly what LTXVAddGuidesFromBatch expects. first_frame and last_frame, for first-last-frame models. length, the snapped clip length. And key_masks, the mask for just the picked frames.

The sparse_batch output is the one people don't expect. In LTX graphs you don't hand keyframes over one at a time; you give the conditioning a full-length batch with the guides in place and everything else blank. Building that by hand is miserable and building it wrong produces a clip that ignores your keyframes entirely while appearing to run fine.

Install

ComfyUI Manager → search "Difforum", or:

cd ComfyUI/custom_nodes && git clone https://github.com/chillithebillis/Difforum.git difforum

Restart. numpy only.

Where people get burned

The quality of the frames you feed in sets the ceiling on the clip. These keyframes carry their look into H3 or LTX, so if your feedback render is mushy at frame 96, the video model will faithfully reproduce the mush. The tooltip says it plainly - better frames here, better video.

Second: every_seconds and fps interact. If you change the fps in Setup and leave the default here, you'll silently get a different number of keyframes than you intended, and the guidance strength changes without you touching a dial. In practice most people work at 24 fps across all Difforum templates and never notice - until they don't.

CategoryDifforum/5 · Video model bridges

Inputs (6)

NameTypeDefaultDescription
framesIMAGEThe clip to pick keyframes from (Guide Frames, Storyboard, a Feedback render...). Keyframes carry its look into H3 / LTX: better frames here = better video.
gridCOMBOLTX-2 / 2.5 (8k+1)Snap keyframes to the video model's latent grid (H3 17k+5, LTX 8k+1, Wan 4k+1) so each one lands on a real latent frame.
every_secondsFLOAT1.000–60How many keyframes: one every N seconds. 1 = many, strong guidance; 2 = fewer, more freedom; 0 = first and last only. H3 Guides then keeps up to max_guides.
fpsFLOAT24.001–120Frames per second of the clip (from Setup).
indicesoptSTRINGExact frames instead of spacing, e.g. '0, 48, 96, -1' (-1 = last).
masksoptMASKGuide Frames masks, so Fill Reveal can repaint what the camera uncovered.

Outputs (8)

NameTypeDescription
keyframesIMAGE—
indicesSTRING—
sparse_batchIMAGE—
first_frameIMAGE—
last_frameIMAGE—
lengthINT—
key_masksMASK—
infoSTRING—