JDCN_BatchCounterAdvance
Skip, overlap, and laps in one node
- Lap
- Range
- FinalRange
- Overlap
- TotalLapsNeeded
- Frames
- SkipFrame
- WithoutSkipFrame
JDCN_BatchCounterAdvance does the frame-counting math that animation and video batch workflows keep needing: given your total frame count, a chunk size (Range), and an Overlap between chunks, it tells you exactly how many frames to skip for the current lap, and how many total laps you'll need. If you've ever hand-computed lap * (range + overlap) to figure out which frames to feed into a frame-interpolation or video-pass pipeline, this node does it for you - and it's clearly built by someone (the pack's co-author is an animator) who got tired of doing that math by hand.
Inputs
Lap- the lap/pass you're currently on (0-based start).LapChange-fixed/increment/decrement. Same honest caveat as the plainBatchCounter: the node computes from whateverLapis now; it won't advance the lap itself.Range- frames per chunk.Overlap- how many frames each chunk shares with the next (so chunks stitch together without gaps).Frames- total frames in the sequence.
Outputs and what they mean
Eight INT outputs:
Lap,Range,Overlap,Frames- echoes of your inputs.SkipFrame-Lap Γ (Range + Overlap): how many frames to skip to reach this lap's chunk. This is the number you feed into the pack'sSkip_Frameinputs on the batch loaders.WithoutSkipFrame-Lap Γ Range: the skip if you weren't accounting for overlap.FinalRange- the size of the last chunk, which the node adjusts so the tail doesn't overshoot your frame count (with a small buffer so short final laps don't break).TotalLapsNeeded-ceil(Frames / Range): how many laps the whole sequence needs.
How to use it
The intended loop: for each lap, take SkipFrame and feed it into JDCN_BatchImageLoadFromDir or JDCN_BatchLatentLoadFromDir's Skip_Frame, with Load_Cap = Range. Each queue run advances Lap, and the math stays consistent. With Frames = 100, Range = 10, Overlap = 2, lap 1 skips 12 frames, lap 2 skips 24, and so on - chunks overlap by two frames so interpolated passes line up.
Installing it
Part of ComfyUI-JDCN:
- ComfyUI Manager β Install Custom Node β search JDCN β install ComfyUI-JDCN β restart.
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Restart; under π΅ JDCN π΅. Only dependency is piexif, no models.
Common issues
The LapChange/automatic-advance caveat again - drive Lap yourself or wire it from an upstream source. Also, TotalLapsNeeded uses plain ceil(Frames / Range) without factoring in overlap, so on heavy-overlap runs it can under-report slightly; treat it as a ballpark, not gospel. And remember the overlap math assumes your batch loaders honor Skip_Frame exactly - if you feed these numbers into a loader that clamps or re-orders, the stitching won't line up. Start with a small sequence and verify one lap end-to-end before running the whole job.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| Lap | INT | 00β9999 | β |
| LapChange | COMBO | 3 options: fixed, increment, decrement | |
| Range | INT | 11β9999 | β |
| Overlap | INT | 10β9999 | β |
| Frames | INT | 11β9999 | β |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| Lap | INT | β |
| Range | INT | β |
| FinalRange | INT | β |
| Overlap | INT | β |
| TotalLapsNeeded | INT | β |
| Frames | INT | β |
| SkipFrame | INT | β |
| WithoutSkipFrame | INT | β |