RVK Finalize Segments
Glue the Clips, Keep the Audio, Re-encode Nothing
- source_video
- loop_status
- result
- path
- completed
What it actually does
You've got segment_0000.mp4, segment_0001.mp4, and a plastic bin of silent clips that need to become one video with the actor's voice back on it. That's the job. RVK Finalize Segments concatenates the segment files without re-encoding a single video frame, then muxes in the first audio track from your original driving video as AAC.
That second half is the part most people are still doing in a video editor at 1am. Fixing it in the graph means the run ends with a finished file instead of a folder and a chore.
And it's genuinely usable on its own. The pack ships a second example workflow, examples/wan_animate2/finalize_existing_segments.json, that contains no model nodes at all - you point it at a complete segment directory and it does the join. That's the workflow you reach for after a crash, a restart, or a weekend.
Why the split-segment approach exists
Long-form work on Wan means chunking, and chunking means seams. The community's own framing is blunt: your first 81-frame batch is fine, quality starts drifting after that, and by three batches you notice it. Someone doing a 1–2 minute continuous take ended up fixing joins frame-by-frame in a video editor, because a cut in the middle of static footage screams and a cut while the subject is moving hides.
RVK takes the opposite bet: don't try to hide the seam, make every chunk a complete, verified, saved file, and make the join lossless so the join itself adds nothing. Finalize is where that losslessness actually happens - a stream copy, not a re-encode and not a quality question.
How the join works
It shells out to FFmpeg with the concat demuxer and -c:v copy, so the video bytes come out of the muxer identical to what went in. Audio is the only thing encoded, and only to AAC. Before it does any of that, it checks the pieces:
- Segments must start at index
0000with no gaps, have compatible video properties, and cover exactly the frame count of the source video. - The source audio must start at video time zero - within two samples of rounding. RVK will not pad, trim, or shift it to fix an offset.
- The final audio and video must end within 100 ms of each other.
If any of that fails you get a specific error instead of a subtly out-of-sync file, and your segments stay on disk. Existing outputs are never overwritten, and finalization never deletes a segment. Assembly has a 30-minute timeout and honours ComfyUI's cancel button.
Inputs and outputs that matter
source_video- the same full, untrimmed driving video you generated from. It's doing double duty: it's the audio source and the authority on total frame count, which is how the node knows your segments are complete.output_directory- defaultrvk/run, relative to ComfyUI's output folder. In the loop workflow this is wired straight from Loop Entry, so you never type it twice.final_filename- defaultfinal.mp4.loop_status(optional) - this is the whole trick. Wire it from RVK Wan Animate 2 Advance and finalization runs automatically when the last segment lands. Leave it unconnected and the node works standalone, discovering whatever segments already exist in the directory. Two modes, one node.
Outputs are result, path (a STRING you can log), and completed, a boolean. This is an output node, so it runs and reports on its own - nothing downstream needs it.
Install
ComfyUI Manager → search Richard's Video Kits or richards-video-kits → install 1.0.0 → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Richard-Wang-fs/ComfyUI-RichardsVideoKits
Keep exactly one copy of the pack; two installs under custom_nodes cause conflicts. The pack adds no pip dependencies (its pyproject.toml declares an empty dependency list and pins ComfyUI ==0.36.0), and the author's tested setup is Windows/NTFS, Python 3.12, frontend 1.52.7, launched with --cache-classic.
The one real prerequisite is FFmpeg with AAC on the PATH of the ComfyUI process - that's a separate binary, not a pip package, and a video-only build won't do:
ffmpeg -hide_banner -encoders | grep -i aac
Where people get burned
source_audio_missing. Your driving video has no audio track. The author's own three-segment test hit this. Either generate with an audio-bearing source or just accept the silent segments - the error is not a bug.source_audio_start_mismatch. Audio begins a beat late in your source. RVK refuses to fake it; pre-mux properly and re-run:ffmpeg -i drive.mp4 -i voice.wav -map 0:v -map 1:a -c:v copy -shortest drive_with_audio.mp4.- Frame-count mismatch. Segments don't cover exactly the source's frames. Usually that's a variable-frame-rate driving video, or a segment you deleted while testing.
cleanup_required. A completed file and a leftoversegment_XXXX.partial.mp4both exist - normally a run you killed mid-write. Read the reported error before deleting anything, and make sure no writer is still active.- Re-running it twice. The existing
final.mp4is in the way. Rename or remove it; the node will not clobber it, by design.
One last thing worth knowing before you build a business on it: the pack's licence is PolyForm Noncommercial 1.0.0. Source-available, not open source, and commercial use needs separate permission from the author.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| source_video | VIDEO | — | |
| output_directory | STRING | rvk/run | Existing segment directory relative to the ComfyUI output directory. |
| final_filename | STRING | final.mp4 | — |
| loop_statusopt | RVK_WAN_LOOP_STATUS | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| result | RVK_FINAL_VIDEO_RESULT | — |
| path | STRING | — |
| completed | BOOLEAN | — |