Nodes/Lostless Nodes/Lostless Buffer
ComfyUI Node

Lostless Buffer

Padding video batches for LTX and Wan

By lostlessvisuals·Created 7 months ago·Updated 10 days ago· 0
Lostless Buffer
  • images
  • images
modeLTX (8n+1)

LTX and Wan video models are annoyingly picky about how many frames you hand them. LTX wants a frame count of 8n+1; Wan wants 4n+1. Wan 2.x's native context, for instance, is 81 frames - that's 4×20+1, not an accident. Feed the sampler a count that doesn't fit and you're either staring at a batch-dimension error out of the temporal VAE or manually copying the last frame over and over until the number lines up. Lostless Buffer is the second of those, automated, and honestly the cleanest version of the fix I've seen in a small pack.

The mechanism is dead simple, which is why it's trustworthy: it takes your IMAGE batch, checks whether the frame count satisfies the pattern, and if not, pads by duplicating the last frame until it does. For LTX (8n+1) mode the step is 8; for WAN (4n+1) it's 4. A 10-frame clip in LTX mode becomes 17 frames (10 → (10-1) % 8 = 1, pad 7). It only ever pads up, never trims down, and it never resamples or blends - the tail just holds still, which is exactly the "freeze the end" look you want at the close of a shot anyway.

What you actually touch

Two inputs, one output. That's the whole node:

  • images - your IMAGE tensor (a batch of frames from a loader, a video-tool output, or a generated sequence).
  • mode - LTX (8n+1) or WAN (4n+1). Pick the model you're feeding next.
  • Output images - the same tensor, padded to a conforming count.

One subtlety worth knowing: a single image passes straight through. 1 = 8×0+1 = 4×0+1, so a one-frame batch is already valid - this is a padding node, not a "make it 9 frames" node. If you're at a valid count already, the tensor just comes back contiguous and untouched.

Where it goes in a workflow

Stick it between whatever produces your frame sequence and the video model's input. The typical chain: generate or load frames → Lostless Buffer → VAE encode / sampler. It also shines after looping or extending a clip, because those operations routinely leave you at a count the model refuses. Think of it as the unglamorous but load-bearing step that keeps your I2V or image-sequence-to-video run from dying on a math error.

Install

It's part of the Lostless Nodes pack. In ComfyUI Manager, search for Lostless Nodes. Or, manually:

cd ComfyUI/custom_nodes
git clone https://github.com/lostlessvisuals/comfyui-lostless-nodes
python -m pip install -r ComfyUI/custom_nodes/comfyui-lostless-nodes/requirements.txt

Then restart ComfyUI. There are no model downloads - everything here is pure Python/torch. The requirements (opencv-python, numpy, PyQt5, psutil) are shared with the pack's mask editor; PyQt5 is the only heavyweight and it's only needed if you use the embedded editor.

Gotchas

  • It won't fix a wrong-length input that's already invalid in the other direction. Too many frames just get padded, never trimmed. If you've got 20 frames for Wan, you'll get 21 - trim yourself first if you needed exactly 20.
  • Padding is last-frame duplication. That's a feature for holding a still tail, but if your last frame is a mid-motion blur, that's the frame you'll be staring at. Cut clean before you buffer.
  • The mode must match the model. LTX on 4n+1 is a silent no-op, and vice versa - the node has no idea which model is downstream, only what you tell it.
Categorylostless/nodes

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOLTX (8n+1)2 options: LTX (8n+1), WAN (4n+1)

Outputs (1)

NameTypeDescription
imagesIMAGE