📊 Auto Loop Calculator
The node that decides where each chunk starts and ends
- safe_faces_list
- scene_cuts_list
- chunk_frames
- skip_frames
- select_every_nth
- log
Long video doesn't fit in VRAM, so you cut it into chunks. The whole Sequential Batcher loop depends on one question being answered right every single cycle: which frames go in this chunk? AutoLoopCalculator is the base answer to that - the "generic" calculator in the pack's family. It looks at where the loop has already gotten to, how many frames you want per loop, and where the scene cuts and sharp faces are, then returns chunk_frames and skip_frames for this cycle.
Think of it as the scheduler. The WanVideo and LTX variants are this node plus the rigid frame-count rules those models' VAEs enforce; this base version has no divisibility constraint at all, which makes it the right pick for models that don't care about 4n+1 or 8n+1.
How it works
It tracks progress against the pack's global accumulated-frame counter (updated by the stitcher after each cycle). Given your target_frames_per_loop and the select_every_nth skip, it computes an "ideal cut" position, then refines it:
- If
scene_cuts_listis connected, it tries to land the cut on the next scene boundary - one scene per loop when it fits in VRAM, otherwise it cuts at the technical limit rather than blow memory. - Falling back to
safe_faces_list, it cuts as close to the nearest detected face frame as possible. - With neither, it makes equal-size chunks to your target.
Each cycle it returns the effective chunk_frames to request and skip_frames to start from, and it logs the reasoning so you can see why a cut landed where it did.
The inputs that matter
source_frame_count(INT) - from the video analyzer. The universe you're walking.target_frames_per_loop(INT, default50) - your chunk size ambition. The node does a proportional rebalance so the last chunk isn't a sad little stub.select_every_nth(INT) - pair with an AutoFPSLimiter if you're dropping frames.current_loop_index(INT) - from SequentialLoopStart; the node reads it but mostly lets the global accumulator drive.
Optional safe_faces_list (FACE_CUTS) and scene_cuts_list (SCENE_CUTS) come from the analyzer nodes. Outputs are chunk_frames, skip_frames, the echo of select_every_nth, and log.
Where it fits
Wire total_frames and (optionally) scene_cuts_list from the analyzer into it, then route chunk_frames and skip_frames into whatever loads frames in your generation path. The stitcher keeps the accumulator honest; the loop trigger decides when you're done. For Wan or LTX specifically, reach for the dedicated variants - this base node won't pad your frames to the VAE's rules, which those models need.
Install
ComfyUI Manager → search "comfyui-sequential-batcher", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Meisoftcoltd/comfyui-sequential-batcher
Restart ComfyUI. No model downloads. And the pack's standing warning applies: skip --highvram at launch, or the memory purge that keeps long loops alive never gets to run.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| source_frame_count | INT | — | |
| target_frames_per_loop | INT | 501–10000 | — |
| select_every_nth | INT | 11–100 | — |
| current_loop_index | INT | — | |
| safe_faces_listopt | FACE_CUTS | — | |
| scene_cuts_listopt | SCENE_CUTS | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| chunk_frames | INT | — |
| skip_frames | INT | — |
| select_every_nth | INT | — |
| log | STRING | — |