ComfyUI Node

EzFlex-TimeLine

Do the long-video arithmetic before you spend an hour generating

By blackbossokok·Created 2 months ago·Updated 19 days ago· 5
EzFlex-TimeLine
  • video
  • frames
  • overlap_frames
  • tolerance_frames
  • net_frames
  • gen_start
  • segments
◄modelminimax_h3►
◄total30.0►
◄segment5.0►
◄fps24►
◄overlap22►
◄tolerance1►
◄alignalign►
◄index0►

Wan's native context is 81 frames - about five seconds at 16fps - and that hasn't moved. Push past it without doing anything clever and you get warps, looping motion and drift. So anything longer is generated in segments and stitched, which sounds like a workflow problem and is actually an arithmetic problem first: how many segments, how long each one, and how many frames the model has to be asked for so each segment lands on its temporal grid.

EzFlex-TimeLine is that arithmetic, in a node. It generates nothing and stitches nothing. Feed it a total duration and a segment length and it hands the loop a frame count per segment, plus the overlap you need for the join, plus the segment total so the loop knows when to stop. The reason to use it rather than a spreadsheet is the grid: these models only accept frame counts of the form B + S·k, and the constants differ (Wan is 1+4k, LTX 1+8k, MiniMax H3 5+17k). Off-grid frame counts are one of the classic "why is my clip one frame short / why does the model complain" bugs, and hand-deriving 17k+5 for six segments is where people give up and just generate 81 frames forever.

The inputs that matter

Seven widget fields, and you'll touch four:

  • model - minimax_h3 (default), wan, or ltx. This selects the grid and the model's per-frame maximum.
  • total - the finished duration in seconds. Default 30.
  • segment - seconds per segment. Default 5, which is roughly one native Wan window and a sane place to start.
  • fps - default 24, but the model picks its own: Wan starts at 16, the other two at 24. Set it to what your video node is actually running, or your timing math is decorative.
  • overlap (default 22) and tolerance (0–5): the frames of the previous segment that get carried into this one, and slack on top. The overlap is snapped up to the model's grid, so you don't have to know what "22" means in grid terms - you say how much blending you want and it rounds to something legal.
  • align - align distributes the leftover frames across segments so the total lands where you asked; strict rounds each segment on its own, which respects your per-segment length exactly but can overshoot the model's maximum.

Optional inputs: index (0-based, forced to a socket - wire EzFlex-LoopStart.index here, or an Easy-Use forLoop index) and video (the list of generated segments; the panel previews segment i with item i, with a big preview on top and the splice track underneath).

Outputs are three integers: frames - the frame count for the segment at index, which includes the overlap, because that's what you ask the model for - overlap_frames, and segments, the total segment count. segments is the one you wire into EzFlex-LoopEnd's round counter when you don't know up front how many rounds you'll need; a 30-second clip in 5-second segments is six segments, so the counter is 6.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/blackbossokok/Comfyui-EzFlex-Presets
# restart ComfyUI - or Manager, search "EzFlex"

mutagen is the only extra dependency (pip install -r requirements.txt). No models ship with it and none are needed; TimeLine is pure planning.

Troubleshooting

  • frames comes out 0. Your index is past the end of the plan. That's deliberate - it's the loop's "this segment doesn't exist, wrap up" signal - and it usually means the loop ran more rounds than there are segments (a mismatched round counter), or the index input is being fed by the wrong node. Feeding some other node's index output here is a real reported mistake, and it looks exactly like this.
  • The panel flags a segment as over the limit. genFrames exceeded the model's window (Wan 121, LTX 257, H3 362). Shorten segment, drop overlap, or use align instead of strict. Generating it anyway is how you get the warping everyone attributes to the model.
  • The video is five seconds too long, or the segments don't line up. Check fps first - a plan computed at 24 and rendered at 16 is off by a third - then check whether the overlap is actually being trimmed at the join. TimeLine tells you how much to overlap; the thing doing the stitching has to actually blend it.
  • Index unwired means segment one, every round. If your loop isn't changing index, you get the first segment's frame count forever. Wire the loop's index output here, and the round number becomes the segment number.
CategoryEzFlex

Inputs (9)

NameTypeDefaultDescription
modelCOMBOminimax_h33 options: minimax_h3, wan, ltx
totalFLOAT30.0Total length in seconds. Split into ceil(total / segment) segments.
segmentFLOAT5.0Target length of each segment in seconds (before overlap). Segment 1 is snapped up to the model grid; later segments get the remainder spread evenly.
fpsINT241–120—
overlapINT220–200Frames re-used from the previous segment's tail. Snapped DOWN to the model grid (MiniMax H3: 0 or 5+17k). Fed to the sampler as extra frames, then trimmed off the head of each segment's output.
toleranceINT10–5Extra frames generated ONLY to make the seam smooth, then trimmed off. Subtracted in addition to overlap: net = gen - overlap - tolerance. Does NOT push the generation length off the model grid.
alignCOMBOalignalign = snap generation length UP to the grid (never shorter than the target). strict = snap to the NEAREST grid step.
indexoptINT0Segment index (0-based). Wire EzFlex-LoopStart.index / easy forLoop index here; frames outputs that segment's frame count. Out of range = 0 (lets the loop finish).
videoopt*Segment videos (a list, one item per segment). Wire the generated segments here; the panel previews segment i with item i.

Outputs (6)

NameTypeDescription
framesINTFrames to GENERATE for this segment (= ezSampler length; always on the model grid).
overlap_framesINTFrames trimmed off the HEAD of this segment's output (= frames reused from the previous tail).
tolerance_framesINTExtra frames trimmed off the head on top of overlap (the seam tolerance).
net_framesINTNet frames this segment contributes to the timeline (= frames - overlap_frames - tolerance_frames).
gen_startINTWhere this segment's generation starts inside the net timeline, in seconds (negative-free: gen_start = net_start - (overlap + tolerance) / fps).
segmentsINTTotal number of segments.