APNext H3 Stitch Clips (gapless, from the saved files)
Gapless — the joins you don't have to babysit
- song
- file_path
- report
After a multi-scene H3 run you've got a folder of per-scene mp4s, each perfect. Then you stitch them and there it is: a tiny silence, a click, a hairline gap at every join. That's not your footage being wrong - it's AAC. Every AAC stream carries ~23 ms of encoder priming and tail padding, and a player only trims that at the start and end of a file. So a plain concatenation - ffmpeg -c copy, an editor's "append" - leaves a 2–14 ms hole at every seam. Your clips are sample-exact; the container isn't. H3StitchClips is the node that puts the seams back together properly.
How it works
It runs once after the last scene and writes <project>_full.mp4 next to the clips. The H.264 packets are copied - their timestamps shifted onto one timeline, no re-encode, no quality loss, no frames held in RAM. Then the audio is handled the clean way: either the original song (wire Load Audio into song) is muxed once over the whole video from 0:00 - the cleanest possible sound - or, with song unplugged, each clip's own audio is decoded, cut to exactly that clip's frame count, concatenated, and encoded once. Either way there's nothing at the joins for a player to trim. The pack verified it on a five-clip run: 773 frames, song at +0.00 ms, no seam silences.
Inputs
file_paths- the saved clips in order, from H3 Sample + Save's (or Save Clip's)file_pathoutput, one per scene. This is a list, so wire the whole output across.suffix(default_full) - appended to the clips' common name:Project-abcd_00001_.mp4 …becomesProject-abcd_full.mp4, in the same folder.enabled(on) - off just passes the clips through untouched and writes nothing.sync_offset_ms(0) - slides the whole soundtrack against the picture. Negative = the sound comes earlier, positive = later. This is the control to reach for when the lips move a touch before you hear the word - try −40 to −80. (One frame is 41.7 ms, and audio leading the picture is noticed from ~45 ms while audio lagging isn't noticed until ~100 ms, so a small lead reads worse than a small lag.) It belongs here and not on the latent node, because the latent is sample-exact to the picture; a consistent lead is the model anticipating the sound, and the mux is where you trim a constant away without changing what the model heard.
Outputs: file_path (the stitched file) and report (what it did).
The one constraint
The clips have to share resolution and codec - and they do, because they came from one run. Don't try to stitch clips from different projects or with different formats; it'll refuse or quietly do the wrong thing. This node is designed as the last step of a single run, not a general video joiner.
Installing
Part of the dagthomas pack - ComfyUI Manager, search "comfyui_dagthomas", install, restart:
cd ComfyUI/custom_nodes
git clone https://github.com/dagthomas/comfyui_dagthomas
cd comfyui_dagthomas
pip install -r requirements.txt
No extra dependencies beyond the pack - it uses the ffmpeg machinery ComfyUI already ships. If you've been hand-stitching clips and hunting seam clicks, this is the node that makes the whole pipeline one continuous graph: Sample + Save on the way in, Stitch Clips on the way out, and nothing between them but a finished music video.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| file_paths | STRING | The saved clips in order - H3 Sample + Save's (or Save Clip's) `file_path` output, one per scene. | |
| suffix | STRING | _full | Appended to the clips' common name: `Project-abcd_00001_.mp4` ... -> `Project-abcd_full.mp4`, in the same folder. |
| enabled | BOOLEAN | true | Off = pass the clips through untouched, write nothing. |
| sync_offset_ms | FLOAT | 0-500–500 | Slides the whole soundtrack against the picture. NEGATIVE = the sound comes earlier - use it when the lips move before you hear the word (try -40 to -80). Positive = later. One frame is 41.7 ms; audio that leads the picture is noticed from ~45 ms, audio that lags from ~100 ms. |
| songopt | AUDIO | The original song (Load Audio). Muxed once over the whole video from 0:00, replacing the clips' own audio - the cleanest sound. Unconnected: the clips' audio is decoded, cut to each clip's exact frame count and encoded once, which also has no gaps. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | — |
| report | STRING | — |