Nodes/Dream Project Animation Nodes/βš‹ Frame Counter (Directory)
ComfyUI Node

βš‹ Frame Counter (Directory)

A frame counter that survives crashes β€” it reads your render folder, not your memory

By alt-key-projectΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 114
βš‹ Frame Counter (Directory)
    • frame_counter
    β—„directory_pathβ–Ί
    β—„pattern*β–Ί
    β—„indexingβ–Ύβ–Ί
    β—„total_frames100β–Ί
    β—„frames_per_second30β–Ί

    Long animations take hours, and hours means crashes. The whole reason Frame Counter (Directory) [Dream] exists is that your place in the animation should be a fact about the disk, not a number living in a node that resets when ComfyUI restarts. It counts the frames already rendered in a folder and turns that count into a FRAME_COUNTER - so an interrupted render resumes from the next frame instead of starting over.

    It's one of the frame-counter family in the Dream Project Animation Nodes pack (alt-key-project), the 2023 Deforum-style animation toolkit. The pack isn't maintained anymore, but the directory-backed counter is still one of the cleanest "resume my render" ideas in the ecosystem.

    How it works

    You give it:

    • directory_path and pattern (default *) - where to look
    • indexing - numeric reads the trailing digits from filenames (shot_0123.png β†’ 123); alphabetic order numbers files by sort order
    • total_frames (INT, default 100) and frames_per_second (INT, default 30) - the animation's size and speed, which get baked into the counter

    The output is a single frame_counter whose current frame is derived from how many image files already exist (plus one - it's positioned at the next frame to render). It also detects the pack's batch_0001-style subfolders, so it plays nice with Image Sequence Saver's layout.

    The important side effect: because the position comes from files on disk, it's stable across restarts, graph edits, and queue interruptions. That's the property you're actually paying for.

    Where it shines

    • Resumable renders: crash at frame 340, relaunch, and the counter is already at 341.
    • Appending to existing animations: want to continue a sequence you generated last week? Point it at the folder and it picks up where the files end.
    • Scripted / headless runs where nobody's around to babysit a primitive.

    The trade-off: it's only as good as your filename scheme. If your files aren't numbered predictably, numeric indexing will miscount. Keep your renderer writing zero-padded, trailing-digit filenames and you're golden.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/alt-key-project/comfyui-dream-project.git
    

    Or via ComfyUI Manager under "Dream Project Animation". No model downloads; the pack's deps are imageio, scipy, torchvision, pilgram, and evalidate. As always with this pack, watch the numpy<2.0 pin. Find it under Dream β†’ animation.

    Category✨ Dream/πŸŽ₯ animation

    Inputs (5)

    NameTypeDefaultDescription
    directory_pathSTRINGβ€”
    patternSTRING*β€”
    indexingCOMBO2 options: numeric, alphabetic order
    total_framesINT1002–5184000β€”
    frames_per_secondINT30β€”

    Outputs (1)

    NameTypeDescription
    frame_counterFRAME_COUNTERβ€”