Boyo Frame Counter
The one-line math node that keeps infinite video loops in sync
- frames_processed
Chunked video generation has a bookkeeping problem. You generate 89 frames, feed the last frame or latent back in as the start, loop, and suddenly anything that wants to know "how many frames have I processed so far?" - VHS Video Combine, audio sync nodes, trim logic - is guessing. Boyo Frame Counter is the answer, and the answer is one line of arithmetic: frames_processed = counter × chunk_size + offset.
That's the whole node. It's meant to sit in a looped workflow between your loop counter and the consumer that needs the absolute frame position. Counter 0 with a chunk size of 89 says "0 frames done." Counter 3 says "267 frames done." Trivial, but it's exactly the kind of plumbing that turns a mess of math widgets into something you can read at a glance.
The inputs that matter
- counter - the current loop iteration. Feed it from Boyo Loop Counter (or a for-loop's iteration value).
- chunk_size - how many frames each pass produces, default 89. Match this to your actual generation chunk, or every downstream sync is off by a multiple.
- offset - optional starting frame, default 0. Only reach for it when your first pass doesn't start at frame zero.
The single output, frames_processed, is an INT that wires straight into nodes like VHS Video Combine's start-frame or any duration calculator that expects absolute frame numbers.
Install
This is part of Boyonodes, so you install the pack, not the node. ComfyUI Manager → search "Boyonodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
Restart and you're done. No extra dependencies - it's pure integer math with no imports beyond the bare minimum.
Where it fits
The same pack gives you the loop pieces that make it useful: Boyo Loop Counter feeds the counter input, Boyo Latent Switch and Latent Cache Updater handle passing the previous chunk forward, and Boyo Overlap Switch handles the first-vs-subsequent overlap values. Frame Counter is the boring glue in the middle. It's not flashy, but if you've ever chased a bug where the video saver wrote over itself because every loop pass reported frame 0, you'll appreciate it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| counter | INT | 00–999999 | — |
| chunk_size | INT | 891–1000 | — |
| offsetopt | INT | 00–1000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frames_processed | INT | — |