Audio Length in Seconds
A two-output node that saves you a math node
- audio
- seconds
- seconds_exact
Audio is the newest, thinnest layer of the ComfyUI stack, and the nodes around it are mostly plumbing. Audio Length in Seconds is exactly that: you feed it an AUDIO tensor and it tells you how long the clip is. One input, two outputs, zero settings. It exists because the moment you start chaining audio into video pipelines - syncing a track to generated footage, deciding how many frames an audio-driven clip needs, clamping a voiceover to a video's duration - you discover ComfyUI has no native "how long is this audio" node, and people end up building math-node pyramids to fake it.
The two outputs are the whole story, and they're deliberately different types:
seconds- an INT, the length rounded up. This is the one you wire into anything that needs a whole number: a frame counter, a duration widget, a batch size. If your audio is 2.05 seconds, you get 3, because "at least this many seconds" is usually what the downstream node needs.seconds_exact- a FLOAT, the precise length. Use this when you're computing frame counts yourself and rounding would drift you off sync.
Rounded-up integer on the left, exact float on the right - the pairing is the feature. In practice you'll almost always take seconds_exact and multiply by FPS to get a frame count, then round that, rather than using seconds directly; but when a node wants a whole-number duration, seconds is the wire that just works.
Where it slots in
The tooltip says it plainly: "Audio to measure." It takes ComfyUI's standard AUDIO type - the {waveform, sample_rate} dict that audio loaders and generators output - so it slots straight after an audio load, an audio generation node, or a video file's audio track. There's no file path, no format handling, no hidden state. If you can see audio in the graph, you can measure it.
It's a genuinely thin node - the kind that lands at a few hundred words because there's nothing to dress up - and that's fine. It's not a headline feature; it's the utility you didn't know you needed until you synced a voiceover to a clip and had to figure out the frame count by hand.
Install and notes
Part of TrentNodes, so the pack install covers it: ComfyUI Manager (search "Trent Nodes"), or
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes && pip install -r requirements.txt
No models, no downloads, no dependencies beyond the pack's core requirements. The only realistic failure is feeding it something that isn't actually an AUDIO type - the red socket rejects that before it runs, so you won't get far enough to be confused. If you're measuring audio that lives inside a video, make sure you've extracted it to an AUDIO tensor first; a VIDEO input is not this node's job.
The one opinion worth having: keep seconds_exact around even when you only need the integer. Video pipelines that resample or trim audio change durations, and having the precise value available for a cross-check has saved me more than once.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | Audio to measure |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| seconds | INT | — |
| seconds_exact | FLOAT | — |