Nodes/RuiquNodes for ComfyUI/Split Range To Multiple Intervals
ComfyUI Node

Split Range To Multiple Intervals

Chop a number range into batched, overlapping intervals

By ruiqutech·Created 2 years ago·Updated 2 years ago· 0
Split Range To Multiple Intervals
    • begin
    • end
    • length
    total_begin0
    total_end1
    batch16
    overlap0
    intervals-1

    The node's actual display name - "Split Range To Multiple Intervals" - is a better description than its class name. Feed it a numeric range and it hands back a series of smaller chunks, sized and overlapped however you set it. The everyday use is chunking a big job into pieces you process one at a time: a long video's frame range, a huge batch of items, anything too large to run in one pass without blowing through memory.

    Inputs and outputs

    • total_begin, total_end (INT) - the whole range you're splitting, default 0 to 1.
    • batch (INT, default 16) - how big each chunk is.
    • overlap (INT, default 0) - how much consecutive chunks share at their edges.
    • intervals (INT, default -1) - set to a positive number to force an exact count of chunks instead of letting batch determine it.
    • Outputs: begin, end, length (all INT, is_list: true) - one triplet per resulting interval.

    Why overlap is there at all

    If the idea of overlapping chunks rings a bell, it's the same trick AnimateDiff-Evolved uses to get past AnimateDiff's native 16-frame training limit: process fixed-size windows with some frames shared between neighbors, then stitch the results together, and you get an output longer than any single pass could hold - VRAM scales with the window size, not the total length. RangeSplit gives you the generic version of that same move for any numeric range, not just video frames: split a big job into overlapping chunks so that whatever processes each chunk has a bit of shared context with its neighbors, which matters whenever the boundary between chunks would otherwise be visible (a seam in stitched video, a discontinuity in a batch of dependent items).

    How the outputs drive downstream work

    Because begin, end, and length are all list-typed, wiring them into whatever does the actual chunked work - a frame-range selector, an image batch loader, anything that takes a begin/end pair - runs that branch of the graph once per interval automatically, courtesy of ComfyUI's list execution. You don't need a separate loop node; RangeSplit producing a list is the loop.

    Installing it

    ComfyUI Manager: search RuiquNodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ruiqutech/ComfyUI-RuiquNodes
    

    then restart. No models or extra dependencies.

    Common issues

    Chunks look near-duplicate or degenerate. overlap is probably too close to (or larger than) batch - keep overlap meaningfully smaller than the batch size, or consecutive chunks end up mostly redundant with each other instead of sharing a useful margin.

    Fewer or more chunks than expected. Check whether intervals is set to something other than -1 - when it's a positive number, it overrides the count batch would otherwise produce, which is easy to forget once you've set it and moved on.

    Downstream only processes one chunk. Same as with any list output in ComfyUI - confirm the node consuming begin/end/length is actually set up to iterate a list, or it'll just run once against the first entry.

    Categoryruiqu/range

    Inputs (5)

    NameTypeDefaultDescription
    total_beginINT0-9999–9999
    total_endINT1-9999–9999
    batchINT161–9999
    overlapINT00–9999
    intervalsINT-1-1–9999

    Outputs (3)

    NameTypeDescription
    beginINT
    endINT
    lengthINT