Nodes/Mickmumpitz-Nodes/Iter Prompt Builder
ComfyUI Node

Iter Prompt Builder

A prompt per video iteration, plus where each one starts

By mickmumpitz·Created 8 months ago·Updated 10 days ago· 47
Iter Prompt Builder
  • input_video
  • string_batch
  • iteration_start_frames
frames_per_iteration81
num_start_frames1
num_fields4
string_1
string_2
string_3
string_4
string_5
string_6
string_7
string_8
string_9
string_10
string_11
string_12
string_13
string_14
string_15
string_16
string_17
string_18
string_19
string_20
string_21
string_22
string_23
string_24

Long videos in ComfyUI aren't one generation - they're a chain of iterations, and each iteration usually wants its own prompt. Scene 1's prompt shouldn't still be running when you're two scenes deep. Iter Prompt Builder packages up to 24 per-iteration prompts into a single string_batch, and throws in a genuinely useful extra: it extracts the exact frame where each iteration's new content begins, so you can preview or condition on where the story actually shifts.

It belongs to the pack's video/iteration family and is the string-side twin of Iter Seed Batch (which does the same batching for seeds). Both feed the pack's slicer nodes, which hand the current iteration its prompt and seed.

How it works

Set num_fields (how many iterations, 1–24) and fill the matching string_N widgets. You also give it input_video (an IMAGE batch of your frames), plus two numbers that define the loop's rhythm:

  • frames_per_iteration - how long each iteration runs (default 81).
  • num_start_frames - the overlapping frames carried from the previous iteration (default 1).

The node computes the new content step as frames_per_iteration - num_start_frames - the actual stride between iteration starts. It then pulls the frame at 0, step, 2*step, ... for each field and returns them as iteration_start_frames. Those are the frames where each iteration's fresh content begins: exactly what you'd preview to sanity-check your story beats, or feed as a context/conditioning reference for the next pass.

The string side is simpler: the strings become a STRING_BATCH in order. Downstream, Iter String Selector picks the current iteration's string (falling back to the last non-empty one, so blank fields don't kill the loop).

Inputs and outputs

  • input_video (IMAGE), frames_per_iteration (INT), num_start_frames (INT), num_fields (INT) - the rhythm and count.
  • string_1string_24 (STRING) - the per-iteration prompts.
  • Outputs: string_batch (STRING_BATCH) and iteration_start_frames (IMAGE).

Where it fits

Any iterative video loop where the prompt should change as the timeline advances. It's the author's own structure for his workflow videos - this pack is by Mickmumpitz, a YouTuber whose iterative-video and consistent-character workflows are the reason these nodes exist. If you're hand-stitching a growing video, this is the node that keeps prompts and timeline in the same rhythm.

Installing

ComfyUI Manager → search "Mickmumpitz" → install → restart, or:

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

Just numpy, Pillow, opencv-python; nothing to download.

Gotchas

The math only works if frames_per_iteration and num_start_frames match what your actual loop is doing - if your iterations run longer than frames_per_iteration, the extracted start frames drift off the real boundaries. Keep them in sync with the rest of the pack's iteration nodes. And num_fields defines both how many strings are batched and how many preview frames come out, so set it to your real iteration count rather than leaving it at the default 4.

CategoryMickmumpitz/video/iteration

Inputs (28)

NameTypeDefaultDescription
input_videoIMAGE
frames_per_iterationINT811–9999
num_start_framesINT10–999
num_fieldsINT41–24
string_1optSTRING
string_2optSTRING
string_3optSTRING
string_4optSTRING
string_5optSTRING
string_6optSTRING
string_7optSTRING
string_8optSTRING
string_9optSTRING
string_10optSTRING
string_11optSTRING
string_12optSTRING
string_13optSTRING
string_14optSTRING
string_15optSTRING
string_16optSTRING
string_17optSTRING
string_18optSTRING
string_19optSTRING
string_20optSTRING
string_21optSTRING
string_22optSTRING
string_23optSTRING
string_24optSTRING

Outputs (2)

NameTypeDescription
string_batchSTRING_BATCH
iteration_start_framesIMAGE