Nodes/MF-PipoNodes/MF Story Sequence
ComfyUI Node

MF Story Sequence

Turn a frame counter into seq01_shot01 naming — beat points, zero math

By MomentFactory·Created 11 months ago·Updated 7 months ago· 1
MF Story Sequence
    • sequence_int
    • sequence_str
    • shot_int
    • shot_str
    • shot_name
    step0
    beats

    If you've ever rendered a 400-frame animation and tried to figure out which frames belong to which scene, you know the pain this node removes. MF Story Sequence (MF_ShotHelper) takes a frame/step counter and a list of "beats" - the frame numbers where new scenes start - and hands you back a sequence number and a shot number for every frame. Feed it to your filename and seq01_shot001 just appears, automatically. From the MF PipoNodes pack (pierreb-mf / Moment Factory).

    How it works

    Two required inputs:

    • step (INT) - the current frame or step number, typically from a counter node. It's marked as a forced input, so it takes a wire.
    • beats (multiline STRING) - the step numbers where each new sequence begins. Three accepted syntaxes:
      • Comma-separated: 120,240,360
      • One per line: 120\n240\n360
      • Array format: [120,240,360]

    The math is genuinely simple: each beat starts a new sequence, so the sequence number is 1 + how many beats are ≤ your step, and the shot number counts up from the last beat. Five outputs come out:

    • sequence_int / sequence_str - which sequence you're in (1-based).
    • shot_int / shot_str - position within the current sequence.
    • shot_name - the formatted name, e.g. seq01_shot01 (two-digit padding, and it wraps to seq01_shot99seq01_shot100 naturally since only the name is padded, not the value).

    The author's example makes it concrete: with beats 120,240,360, frames 0–119 are seq01_shot01 through seq01_shot120, frames 120–239 become seq02_shot001..., and so on. A frame past the last beat keeps incrementing a final sequence forever - nothing wraps unless you add another beat.

    Where it shines

    Two killer patterns:

    • Organized renders. shot_name → filename means every frame lands in the right scene's numbering with zero manual renaming. This is the single best use of the node.
    • Per-sequence prompting. Feed sequence_int into MF Line Select and every scene gets a different prompt, switching exactly at the beats. That's how you keep a style consistent within a shot while letting scenes differ.

    Install

    cd ComfyUI/custom_nodes/
    git clone https://github.com/pierreb-mf/ComfyUI-MF-PipoNodes
    cd ComfyUI-MF-PipoNodes
    pip install -r requirements.txt
    

    Restart after, or ComfyUI Manager → "MF PipoNodes". Only aiohttp and pyyaml.

    Gotchas

    • Beats are the start of a sequence, not the end. A beat at frame 120 means frame 120 belongs to the new sequence. Off-by-one confusion here is the #1 complaint this node could generate.
    • Invalid beat text silently becomes "no beats." A typo like 120;240 (semicolon) makes the parser give up and treat every frame as sequence 1, with a console warning. The formats must be commas, newlines, or a bracketed array.
    • Beats are sorted internally, so order doesn't matter - but duplicates will create empty zero-length sequences, which can make shot_int skip oddly.
    CategoryMF_PipoNodes/Sequencing

    Inputs (2)

    NameTypeDefaultDescription
    stepINT0
    beatsSTRING

    Outputs (5)

    NameTypeDescription
    sequence_intINT
    sequence_strSTRING
    shot_intINT
    shot_strSTRING
    shot_nameSTRING