Nodes/comfyui-sequential-batcher/🛡️ VAE Safe Frame Padder
ComfyUI Node

🛡️ VAE Safe Frame Padder

The frame padder that stops WanVideo and LTX VAEs from collapsing

By Meisoftcoltd·Created 7 months ago·Updated 18 days ago· 3
🛡️ VAE Safe Frame Padder
  • images
  • PADDED_IMAGES
  • frames_added
  • log
rule

Some video models are picky about how many frames you feed their VAE, and the pickiness is not negotiable. WanVideo's 3D causal VAE and LTX's DiT both expect specific frame counts - render 12 frames into a model that wants 4n+1 and the decode can drop frames or smear. VAESafeFramePadder is the guard that pads your tensor up to a rule-compliant count before the VAE ever sees it.

It's a tool from the comfyui-sequential-batcher pack, and it sits in the middle of the recommended wiring: take the IMAGE output from VHS_LoadVideo, run it through this padder, and feed the result into your latent/VAE stage. The author's framing - "save the VAE from a collapse" - is not marketing; these are exactly the models where a bad frame count produces visible garbage or an outright failure.

How it works

The mechanism is almost embarrassingly simple, which is why it's reliable: if the frame count doesn't already satisfy the rule, it clones the last frame and appends it until it does. Cloning the last frame is deliberate - a frozen frame at the tail of a chunk is far less damaging to continuity than a black or noise frame, and the loop's calculators are built to overlap/trim around it.

Two rules, chosen with the rule dropdown:

  • WanVideo (Regla 4n+1) - pads up to ((n + 2) // 4) * 4 + 1, with a floor of 5 frames.
  • LTX (Regla 8n+1) - pads up to ((n + 6) // 8) * 8 + 1, with a floor of 9 frames.

If your chunk is already compliant, it does nothing and reports 0 added.

Inputs and outputs

Just images (an IMAGE tensor) and the rule enum - there's no knob to get wrong. Outputs are the PADDED_IMAGES tensor, an INT frames_added telling you how many clones got appended (handy for logging), and a log string. Feed PADDED_IMAGES onward; if your downstream node needs to know the real frame count, subtract frames_added.

Installing it

It's part of comfyui-sequential-batcher - install once and every node in the pack comes with it:

cd ComfyUI/custom_nodes
git clone https://github.com/Meisoftcoltd/comfyui-sequential-batcher

...or search "comfyui-sequential-batcher" in ComfyUI Manager. Restart, and you're done - no model downloads, no extra Python deps beyond what the pack installs.

Common issues

If it throws "Input is not a valid tensor," whatever you connected isn't an IMAGE tensor - it wants raw images, not latents. In LTX flows you'll usually pair this with the pack's LTXV Single Frame Injector so the padded frame and the injected anchor don't fight each other. And don't be tempted to disable the pad to "save VRAM": those padded frames are what keep the decode from collapsing, and on these models the trade isn't worth it.

Category🔁 Sequential Batcher/Tools

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
ruleCOMBO2 options: WanVideo (Regla 4n+1), LTX (Regla 8n+1)

Outputs (3)

NameTypeDescription
PADDED_IMAGESIMAGE
frames_addedINT
logSTRING