β Frame Counter (Directory)
A frame counter that survives crashes β it reads your render folder, not your memory
- frame_counter
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_pathandpattern(default*) - where to lookindexing-numericreads the trailing digits from filenames (shot_0123.pngβ 123);alphabetic ordernumbers files by sort ordertotal_frames(INT, default 100) andframes_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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | β | |
| pattern | STRING | * | β |
| indexing | COMBO | 2 options: numeric, alphabetic order | |
| total_frames | INT | 1002β5184000 | β |
| frames_per_second | INT | 30 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frame_counter | FRAME_COUNTER | β |