Keyframe Keys To Batch Keys π π π
Translate keyframe numbers into flat batch indices β the index translator nobody names well
- INT
Keyframe Keys To Batch Keys is one of those helper nodes you'll stare at for a minute wondering what it does, because the name is doing its best and the math looks suspicious. It takes two ints - input (a keyframe key or frame number) and num_latents - and returns a single INT computed as:
input * num_latents - 1
That's the whole node. The question is what the translation is for.
FizzNodes' batch schedulers work in "keyframe space": your schedule is written in frame numbers ("0", "30", "60", β¦) across an animation of max_frames. But when you're actually stepping through a run that processes latents in chunks - several latent inputs per step, AnimateDiff-style - the flat index you need to look up in a value series isn't the keyframe number, it's the keyframe number scaled by how many latents each slot covers. Multiply the frame number by num_latents, subtract one (the off-by-one that makes every index bug in history), and you've got the batch slot for that keyframe. That's precisely the same bookkeeping Calculate Frame Offset handles on the frame side - this node is the other half of that indexing story.
When you'd actually use it
Honestly? Rarely, and only inside the kind of multi-latent animation workflows FizzNodes was built around - where a schedule keyed in frame space needs to address an entry in a batch that's been expanded by num_latents. If you're not running that pattern, this node is dead weight. If you are, it replaces a hand-rolled "multiply by the batch multiplier and knock one off" constant that you'd otherwise hard-code into a math node. Both inputs are plain widgets (input is forced to be wired in), and num_latents should match the latent count your workflow uses.
Install
cd ComfyUI/custom_nodes && git clone https://github.com/FizzleDorf/ComfyUI_FizzNodes.git
cd ComfyUI_FizzNodes && pip install -r requirements.txt
Or install "FizzNodes" via ComfyUI Manager and restart. Zero heavy dependencies, no models. If the output ever seems wrong, double-check that your num_latents matches the actual batch multiplier - the "-1" is baked in, and it only lines up when that number is right.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input | INT | 0 | β |
| num_latents | INT | 16 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |