Nodes/RES4LYF/Frames Slice Latent
ComfyUI Node Runs on cloud

Frames Slice Latent

Trim video frames before the VAE decode

By ClownsharkBatwing·Created 2 years ago·Updated 18 days ago· 1,222
Frames Slice Latent
  • frames
  • latent
start0
stop1

Same idea as Frames Slice, one layer deeper. This one slices a range of frames out of a LATENT instead of a decoded image - so you're trimming the video before it gets turned into pixels. That matters more than it sounds, because in a video model the latent is where the expensive work lives. Cutting frames while they're still latent lets you keep, drop, or re-process a sub-range without paying to VAE-decode the whole sequence first.

You'd use it when a Wan or other video latent has more frames than you need, or when you want to run a second sampling pass on just a slice of the timeline. Working on the latent keeps everything upstream of the decode, which is both cheaper and cleaner than decoding, slicing images, and re-encoding.

How it works

Video latents carry a temporal dimension - the frames are stacked inside the latent tensor. This node indexes that temporal axis between two positions and returns the sub-range as a new latent. Note the units: these are latent frames, and for many video models the latent is temporally compressed, so one latent frame can map to several output frames. The counts won't necessarily match your final pixel frame count one-to-one.

The inputs that matter

  • frames (LATENT) - the video latent to slice.
  • start (INT, default 0) - first latent frame to keep, zero-indexed.
  • stop (INT, default 1) - where the slice ends; confirm the range by checking what comes out rather than assuming inclusive or exclusive.

The single output is latent (LATENT), the trimmed latent, ready to decode or feed back into a sampler.

Installing it

ComfyUI Manager: search RES4LYF, install, restart. Manually:

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

pip install in the venv or portable Python, restart, hard-refresh (F5). No downloads.

Where people get tripped up

The big one is the latent/pixel frame mismatch. Because video latents are usually temporally compressed, a slice of start=0, stop=4 on the latent is not four output frames - after decode it can be many more. If your trimmed clip is a different length than you expected, that compression factor is why; work out your model's ratio and slice against latent-frame counts, not the final frame numbers.

Beyond that it's the usual slicing hygiene: keep start and stop inside the latent's actual frame count, and verify the output length with a quick decode-and-count the first time rather than trusting the indices blind. If the node isn't in your menu, RES4LYF didn't install.

CategoryRES4LYF/latents

Inputs (3)

NameTypeDefaultDescription
framesLATENT
startINT00–10000
stopINT11–10000

Outputs (1)

NameTypeDescription
latentLATENT