Nodes/comfyui-extend/LTX Flow - Trim Frames
ComfyUI Node

LTX Flow - Trim Frames

Cut the overlap off the front (and back) of an extended LTX clip

By balarooty·Created 4 months ago·Updated 4 months ago· 0
LTX Flow - Trim Frames
  • video_frames
  • trimmed_frames
  • remaining_frames
trim_start0
trim_end0

Here's the dirty secret of LTX continuation: when you generate the next clip with Tail Guide conditioning on the previous tail, the new clip re-renders that tail at its start. The first several frames are a repeat of footage you already have. If you stitch without dealing with that, every join plays the same moment twice and you get a stutter every few seconds. Trim Frames is the cleanup step - it shaves the overlap off the front, and optionally off the back, of a generated batch.

It's a two-frame-int node, but it completes the pack's core loop. Without it, Extract Tail, Tail Guide, and Scene Builder are all just moving duplicates around. With it, you get a clean continuous video.

How it works

Pure tensor slicing with safety rails. trim_start drops that many frames from the front, trim_end drops that many from the back, and you get back the trimmed batch plus remaining_frames. The one piece of real logic: if your requested trims would remove every frame, it raises a clear error instead of returning an empty batch - which you'll appreciate the first time you wire a wrong number in.

The clean pattern: read overlap_frames from Tail Guide and feed it straight into trim_start. The two nodes were designed to talk to each other - overlap says how much the new clip re-rendered, trim cuts exactly that.

The inputs that matter

  • video_frames - the fresh clip, straight off the LTX video decode.
  • trim_start - frames to cut from the front. This is the one that matters for extension; wire overlap_frames here.
  • trim_end - frames to cut from the back, for when the model trails off or you generated a few frames longer than you need.

Outputs: trimmed_frames and remaining_frames (useful as a sanity check - it should equal your pre-trim count minus both trims).

Install

Search "comfyui-extend" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/balarooty/comfyui-extend

Restart ComfyUI. No Python dependencies, no model loading - it's slicing a tensor, so it works on any clip from any source.

Common issues

  • "Trim removes all frames." The exact error when trim_start + trim_end ≥ the clip length. Usually means you fed it overlap_frames from a last_only Tail Guide (which reports 1) onto a clip you expected to be longer, or you set trim_end too big. Check the numbers.
  • Stutter still visible after stitching. You trimmed, but Scene Builder's deduplicate_joins also drops a frame per join. If you trimmed the front exactly by the overlap and still see a hitch, one of the two steps ate a frame more than you intended - try trimming overlap_frames minus one.
  • Trim before or after Scene Builder? Before. Trim each clip in isolation, then stitch; deduplicating joins on already-trimmed clips is the reliable order.
  • No re-encode, no FPS change. This node only removes frames. If you want to smooth or slow the result, that's a different node entirely.

workflows/00_ltxflow_utilities_combined.json puts Trim Frames on the same canvas as Extract Tail and Scene Builder, which is exactly where you want it - grab that combined workflow as your starting point and wire the loop together.

CategoryLTXFlow/Frame Tools

Inputs (3)

NameTypeDefaultDescription
video_framesIMAGE
trim_startINT00–100000
trim_endINT00–100000

Outputs (2)

NameTypeDescription
trimmed_framesIMAGE
remaining_framesINT