Nodes/RES4LYF/Latent TrimVideo State Info
ComfyUI Node Runs on cloud

Latent TrimVideo State Info

Trim frames off a video latent without breaking sampler state

By ClownsharkBatwing·Created 2 years ago·Updated 18 days ago· 1,222
Latent TrimVideo State Info
  • samples
  • LATENT
trim_amount0

RES4LYF's README leans hard into video work - regional and temporal conditioning on Wan, sliding-window attention, chained sampler passes across a clip. Latent TrimVideo State Info is a small utility built for that world: it trims a fixed number of frames off a video latent (trim_amount) while it's still carrying RES4LYF's internal sampler state, rather than treating it as a plain tensor and risking that state going stale.

That distinction is the whole reason this exists as its own node instead of a generic "trim frames" utility elsewhere in ComfyUI. RES4LYF's samplers attach hidden state (step markers, the raw diffusion tensor, the noise schedule) to latents so multi-stage sampler chains can resume correctly. Cropping frames off a video latent naively, outside this pack's tooling, risks leaving that state pointing at frames that no longer exist. This node exists to do the trim and keep the state consistent with what's left.

How it works

You feed it a video samples latent and a trim_amount, and it returns the latent with that many frames removed - while carrying its RES4LYF state through the operation instead of dropping it. There's no direction flag in the schema (front vs. back), so treat the exact trim behavior as something to verify against your own clip rather than assume.

The inputs and outputs that matter

  • samples (required) - the video latent you're trimming, expected to be carrying RES4LYF sampler state.
  • trim_amount (default 0, range 0-99999) - how many frames to remove. At the default, this is a no-op.
  • Output: LATENT - the trimmed video latent, state intact.

How to install it

Via ComfyUI Manager: search "RES4LYF" and install. Manually, from ComfyUI/custom_nodes:

git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt

Activate your venv first if you use one; on a portable install, swap pip for python_embedded\Scripts\pip.exe. Restart ComfyUI afterward.

Common issues & troubleshooting

Not sure which end it trims from. The schema doesn't specify a direction, so run it at a small trim_amount first (a couple of frames) and inspect the decoded output rather than assuming - this is the kind of detail worth confirming on your own clip before relying on it in a longer pipeline.

trim_amount set too high produces an empty or broken result. It's an unbounded integer up to 99999 with no built-in check against your clip's actual frame count as far as the schema shows - keep it comfortably under your video's real length.

You fed it a latent without RES4LYF state on it. This node is built around latents produced by the pack's own samplers. A video latent loaded fresh from a VAE encode, with no sampler state attached, may still trim the visible frames but there's nothing meaningful for the "state" half of this node's job to preserve.

No community documentation exists for this node. It's narrow, video-specific plumbing inside an already under-documented pack. If you're debugging a chained video-sampling workflow that uses it, the RES4LYF README's linked example workflows are a better starting point than the node alone - there isn't a separate written guide to reach for.

CategoryRES4LYF/latents

Inputs (2)

NameTypeDefaultDescription
samplesLATENT
trim_amountINT00–99999

Outputs (1)

NameTypeDescription
LATENTLATENT