Nodes/ComfyTV/Audio Trim
ComfyUI Node

Audio Trim

Trim an audio track to an exact time range in one stage

By jtydhr88·Created 3 months ago·Updated about 15 hours ago· 725
Audio Trim
  • audio
  • video
  • audio
force_run_token0
project_id
parent_output_id0
start_s0.00
end_s0.00

Every audio chain eventually needs a haircut. Audio Trim does exactly what the display name says: it cuts an audio track (or the audio of a video) down to a start and end time in seconds and hands back the shorter clip. That's the whole job - and it's the node you'll drop in front of just about everything else, because almost no real source arrives at the exact length you want.

You'll use it to shave a voiceover's dead tail, cut a music bed to fit a shot's duration, drop the first few seconds of silence before the beat drops, or trim a room recording before you feed it into Convolve as an impulse response. It's also the polite first step before a crossfade: two tracks that each got trimmed to exactly the right region crossfade far more predictably than two full-length files.

How it works

Two inputs do the work: start_s and end_s, both in seconds (0–36000, step 0.01 - so millisecond-ish precision). The source shows the implementation is a direct trim on the decoded audio, and it's a true edit, not a fade: everything outside [start, end] is discarded, and the output starts at time zero of the trimmed region. The optional audio and video inputs accept either a COMFYTV_AUDIO or a video whose soundtrack you want trimmed. The force_run_token, project_id, and parent_output_id inputs are ComfyTV internal plumbing - the frontend fills them, you don't.

The output is audio (COMFYTV_AUDIO). Feed it straight into Dynamics, Loudness, Crossfade, or whatever comes next.

Installing ComfyTV

This is one of ~190 stages in the ComfyTV pack, so install is:

cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV

Full backend restart (quit the app / stop the server - a browser refresh isn't enough) and it appears under ComfyTV → AudioFX; ComfyUI Manager finds it by searching "ComfyTV". Zero extra Python deps - trimming runs through the PyAV/FFmpeg stack ComfyUI already ships. No models, nothing to download.

The install gotcha the README is explicit about: on macOS, ComfyUI Desktop, or machines with several ComfyUI installs, the relative cd ComfyUI/custom_nodes can clone into the wrong instance - the clone succeeds and the nodes never show up. Find the running instance's base path in its startup log, clone into that instance's custom_nodes by absolute path (quotes required if it has spaces or parentheses), confirm ComfyTV/__init__.py is top-level, and do a full backend restart.

Common issues

  • Nothing got trimmed. end_s defaults to 0 - make sure you actually set it. If end_s is 0 or before start_s, there's nothing to keep. (0 reads as "no end," which is a footgun worth knowing.)
  • Trimmed track starts mid-word. start_s is a raw time in seconds; snap it to the exact point you want. There's no waveform scrubbing here - set the number, run, listen.
  • The video input ignores my range. The stage trims the audio of the video. If you want the video itself trimmed, that's a different stage - this one only hands back audio.

Simple, predictable, and it gets used in every multi-track ComfyTV project you'll build. It's the quiet workhorse of the audio suite.

CategoryComfyTV/AudioFX

Inputs (7)

NameTypeDefaultDescription
force_run_tokenINT00–2147483647Internal — bumped on Run to invalidate ComfyUI's input cache.
project_idSTRINGInternal — populated by the projectStore on the frontend.
parent_output_idINT00–2147483647Internal — lineage parent set by spawn handlers on the frontend.
start_sFLOAT0.000–36000
end_sFLOAT0.000–36000
audiooptCOMFYTV_AUDIO
videooptCOMFYTV_VIDEO

Outputs (1)

NameTypeDescription
audioCOMFYTV_AUDIO