Nodes/IAMCCS-nodes/IAMCCS Cine Latent Duration Crop
ComfyUI Node

IAMCCS Cine Latent Duration Crop

The silent fixer that trims your video latent down to size

By IAMCCS·Created 11 months ago·Updated 7 days ago· 113
IAMCCS Cine Latent Duration Crop
  • latent
  • latent
  • report
target_frames81
ltx_time_factor8

Every LTX video person has met the ghost frames: you build a latent with a duration lock or a padded tail, decode, and there are extra frames you never asked for - a frozen beat at the end, or a chroma-shifted tail the model baked in. IAMCCS Cine Latent Duration Crop is the pack's blunt instrument for that: it chops a video latent down to exactly the number of frames you want, in latent space, before you ever decode.

It's a utility, so it's not glamorous. But it's one of those "why did nobody just ship this" nodes that quietly un-breaks workflows. The source docstring calls it a "safety crop for video latents when a workflow branch still carries padded tail frames." That's the whole job.

How it works

Video latents aren't frame-for-frame. LTX compresses time with a time factor (the classic LTX math is frames = latent_length × 8 + 1, which is why you see 8n+1 everywhere in this pack). This node takes your target_frames and the ltx_time_factor (default 8), works out how many latent time-steps that corresponds to, and slices the latent tensor down:

target_latent_frames = ceil((target_frames - 1) / time_factor) + 1

If the latent is already at or under that length, nothing changes - it's a no-op that returns the latent untouched. It also trims the noise_mask if one is present, so you don't get a mismatched mask after the crop. Everything else in the latent dict is preserved.

The inputs that matter

Only three, all required:

  • latent - the video latent to crop.
  • target_frames - the pixel-space frame count you actually want (default 81, the LTX native context length).
  • ltx_time_factor - leave it at 8 unless you know your pipeline uses a different temporal compression.

Outputs: latent (cropped or untouched) and report - a JSON with the target latent frames, current latent frames, and whether anything actually changed. That changed flag is genuinely useful for debugging a pipeline that keeps producing wrong-length video.

Install

One node in IAMCCS-nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

or ComfyUI Manager → search IAMCCS. README floor: ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8. No extra dependencies for this one - it's pure tensor slicing.

Where people get burned

  • Expecting the wrong unit. target_frames is pixel frames, not latent steps. Set it to 81 for the standard LTX context, not 9 or 10.
  • The crop only shrinks. It never pads. If a branch gives you a latent shorter than target, this node passes it through unchanged and the report tells you changed: false. For padding you want a duration-lock or extension node, not this one.
  • It's a post-hoc fix, not prevention. If your workflow is consistently over-length, the real cause is upstream - a timeline that didn't round to 8n+1 or a tail that wasn't locked. This node hides the symptom so you can iterate on the cause.
  • One-author utility with zero search impressions; treat the JSON report output as your documentation, since that's where the node tells you what it actually did.
CategoryIAMCCS/Cine/00 Utilities

Inputs (3)

NameTypeDefaultDescription
latentLATENT
target_framesINT811–36000
ltx_time_factorINT81–32

Outputs (2)

NameTypeDescription
latentLATENT
reportSTRING