🔗 S42 CutFlow Audio-Video Sync
Make audio the right length for the video — cut it, or stretch it
- audio
- audio
- info
Audio and video from different sources almost never agree on duration - the AI-generated clip is 4.7 seconds, the music track is 12, and somewhere in between the sync dies. S42CF Audio-Video Sync is the node that forces them to agree, and it gives you a real choice about how: cut the audio to fit, or stretch it to fit. That choice is the whole thing, so let's go through it.
Two ways to specify the target length:
target_duration(seconds) - if you set this above 0, it wins.target_frames+fps- used whentarget_durationis 0, which is the default. So the common wiring istarget_frames← a video node'sframe_countoutput, exactly likeS42CF AudioTrim.
Then the decision that matters, method:
trim_pad(default) - cuts excess audio or pads with silence to hit the target. Lossless: no pitch change, no quality loss. The downside is you might lose audio you wanted. This is the correct default for dialogue, voiceover, and anything where the whole track must stay intact in pitch.time_stretch- resamples the entire audio to fit the target. Nothing gets cut, but the tooltip's warning is accurate: "may change pitch slightly." Technically it's linear-interpolation resampling of the samples, so it's really a speed change - slow it down 30% and it sounds deeper. Use it when every bit of the audio matters more than the pitch (ambient textures, some music beds) or when the mismatch is small enough that the shift is inaudible.
The mechanism is honest about what it is: trim_pad slices or zero-pads; time_stretch linearly interpolates the waveform onto a new sample grid. Numpy, deterministic, instant. Outputs are the resized audio plus an info string that tells you the before/after durations - genuinely useful for checking your math.
Where it fits: voiceover over generated video, background music matched to a clip's exact length, and LTX audio-conditioning prep (though S42CF_AudioCondPrep is the more purpose-built tool there, since it also normalizes). It's the "other half" of Audio Trim: that node trims to a length you know; this one matches audio to a video you may not have measured yet.
The trap people hit is picking time_stretch when they wanted trim_pad. If your vocal track sounds chipmunk or slurred after running through this, you've time-stretched it when you should have cut. Match the tool to the content: speech → trim_pad, texture → time_stretch.
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
Requirements is one line (opencv-python-headless); numpy does the resampling. The "[S42 CutFlow] Loaded ..." console line confirms registration.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | Audio to adjust. | |
| target_duration | FLOAT | 0.00–99999 | Target duration in seconds. 0 = use target_frames/fps. |
| target_frames | INT | 481–99999 | Target frame count (used when target_duration=0). |
| fps | FLOAT | 24.01–120 | FPS for frame-to-time conversion. |
| method | COMBO | trim_pad | 'trim_pad' = cut or silence-pad to match duration (preserves pitch). 'time_stretch' = resample to fit (may change pitch slightly). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| info | STRING | — |