🔊 S42 CutFlow Audio Trim
Trim audio to exactly match your video — by frames, by seconds, or by vibe
- audio
- audio
- info
The most tedious part of editing audio and video together is keeping their lengths in sync, and S42CF Audio Trim exists to make one half of that chore a single node. Give it an AUDIO input and it trims (or extends) it to the length you specify, with optional fades, in three different measurement systems. It sits in the Audio Sync category alongside Beat Snap and Audio-Video Sync, and it's the one you reach for when the video is already the right length and the audio needs to catch up.
The mode selector is the whole personality of this node:
match_frames(default) - trims the audio totarget_framesatfps. This is the mode you wire into the rest of your graph: connecttarget_framesto aframe_countoutput from a video node (likeS42CF Clip Infoor Smart Trim) and the audio always comes out the same length as the video, whatever you change upstream. It pads with silence if the audio is too short, cuts if it's too long.custom_time- trim byin_seconds/out_seconds.-1for out means "to the end of the audio." The mode for "give me the middle 30 seconds."custom_frames- trim by frame numbers at the givenfps. For when your trim points live in a frame timeline and you don't want to do the seconds math by hand.
The other knobs: fps (for all frame-based math), fade_in and fade_out (in seconds, 0–10) - short fades here are the fix for the click you get when audio is cut mid-sample. Default 0 means a hard cut; even a 0.1s fade-out on a music loop is worth it.
The mechanism is transparent and safe: it converts everything to sample indices, clamps so you can't request a start past the end, slices, applies linear fades, and hands back a standard AUDIO plus an info string summarizing what it did. Pure numpy, no model, instant.
Where people get burned: assuming match_frames also matches the tempo or the content. It makes the length right - it can't make a 2-minute song fit a 30-second clip with the interesting part preserved. For that you want S42CF_AudioVideoSync's time_stretch, which squashes the whole thing. This node is for cutting to fit; that node is for stretching to fit. Different tools, same category, and knowing which one you want saves a lot of head-scratching.
Installing it
S42-CutFlow install: ComfyUI Manager → search "S42 CutFlow" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/GeekyGhost/S42-CutFlow.git
pip install -r S42-CutFlow/requirements.txt
One-line requirements (opencv-python-headless); numpy does the slicing. "[S42 CutFlow] Loaded ..." on restart confirms the pack.
The takeaway
Wire target_frames to a video node's frame_count and you never manually calculate a trim again. Just don't expect it to rearrange the song - that's the stretch node's job.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | ComfyUI AUDIO input to trim. | |
| mode | COMBO | match_frames | 'match_frames' = trim audio to match connected clip frame count. 'custom_time' = trim to in/out seconds. 'custom_frames' = trim to in/out frame numbers at given fps. |
| in_seconds | FLOAT | 0.00–99999 | Start time in seconds (custom_time mode). |
| out_seconds | FLOAT | -1.0-1–99999 | End time in seconds. -1 = end of audio. |
| fps | FLOAT | 24.01–120 | FPS for frame-based calculations. |
| target_frames | INT | 481–99999 | Target frame count for match_frames mode. |
| fade_in | FLOAT | 0.00–10 | Fade-in duration in seconds. |
| fade_out | FLOAT | 0.00–10 | Fade-out duration in seconds. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| info | STRING | — |