🎬🔊AGSoft Stitch Video & Audio
Cleaning the seam between your video segments
- stitched_images
- stitched_audio
🎬🔊AGSoft Stitch Video & Audio exists because of one boring fact: video models generate short clips. Wan stops making sense past about 81 frames - roughly five seconds at 16fps - and MiniMax H3's native window is 4 to 15 seconds. Everything longer than that is segments chained together, and chaining segments leaves marks: the first frame of segment N is a copy of the last frame of segment N-1, and the audio you generated per segment is now offset from the join by exactly that duplicate.
This node joins already-decoded IMAGE and AUDIO segments and cleans up after the join. It's the dumb version of the operation, in the best sense: no decode, no model, no VAE. It takes pixels and waveforms and puts them end to end.
How it works
Sockets are dynamic and come in pairs per segment: images_1/audio_1, images_2/audio_2, and so on. inputs_count (2–50) controls how many sockets are visible; the node's frontend extension adds and removes them. Anything unconnected, bypassed, or None is simply skipped - there is no "you said 6 segments but sent 4" error.
Then, per segment, index in ascending order:
- Trim the anchor.
trim_first_framesdrops the first N frames from every segment except the first (N defaults to 1). That's the duplicate anchor frame, gone. - Fill the gaps. No audio for a segment but video is there? It generates silence for the segment's duration. Audio but no images? It inserts black frames for the audio's length. Order stays intact, nothing shifts position.
- Conform and concatenate. Image segments are matched to the first segment's shape and concatenated; audio chunks are resampled to the first chunk's sample rate and channel count, then joined. Both happen on CPU, which keeps VRAM free on a card that already spent everything generating.
Outputs are stitched_images (one IMAGE batch, ready for a save-video node or a mux node) and stitched_audio (an AUDIO). You drive the timing with fps_float (24 by default) - it's what turns frame counts into durations for the silence and black-frame fills.
The one setting that bites
trim_audio defaults to false, and the tooltip is blunt about why: enable it only if the incoming audio has not already been trimmed. Turn it on when your segments arrive pre-trimmed and you trim twice, which slides the audio earlier at every join and accumulates as drift down the stitch. The latent-based sibling of this node defaults the same switch to true, because there nothing upstream has touched the audio yet.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft
# restart ComfyUI
Manager → search comfyui-AGSoft. This node imports torch only - no model downloads, no ffmpeg.
Worth knowing if you go further into this pack: the video and audio split and concat nodes next to this one shell out to ffmpeg through imageio-ffmpeg, which isn't in the pack's requirements.txt. If one of those errors with a missing imageio_ffmpeg, that's the fix:
pip install imageio-ffmpeg
Where people get burned
Drift that grows with every join. Two causes, both checkable. A wrong fps_float makes every generated silence and black-frame run the wrong length, so pick the fps you actually generated at rather than the 24 default. And double-trimmed audio from trim_audio being on when it shouldn't be.
A click at the seam. With trim_first_frames at 1, the duplicated anchor frame is removed - but if your segments were chained by feeding the last frame in at a different size or crop, the first frame of each segment isn't quite the same image and the cut is visible. Look at the join before blaming the node.
Sockets that won't appear. The dynamic inputs are drawn by the pack's frontend JavaScript; if the extension didn't load, you get two sockets and no way to ask for more. Reload the page, then check the browser console. Custom-node frontends have had a rough time with the Nodes 2.0 renderer - if you've switched it on, try the legacy canvas before debugging anything else.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| inputs_count | COMBO | 2 | Number of visible segment sockets. Unconnected sockets are ignored. --- Количество видимых сокетов. Неподключённые сокеты игнорируются. |
| trim_first_frames | INT | 10–8 | Trim first frames from segments 2+ (anchor-frame duplicate). --- Подрезать первые кадры у сегментов 2+ (дубль кадра-якоря). |
| fps_floatopt | FLOAT | 24.0001–120 | FPS for silence generation and fallback audio trim. --- FPS для генерации тишины и резервной подрезки аудио. |
| trim_audioopt | BOOLEAN | false | Enable only if incoming AUDIO is NOT already trimmed. --- Включайте только если входящее аудио ещё НЕ подрезано. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| stitched_images | IMAGE | — |
| stitched_audio | AUDIO | — |