💾 智绘_纯净视频保存
Audio muxing, CRF control, and a real filepath out
- images
- audio
- filepath
ComfyUI's built-in video saving works fine until you need three things at once: audio on the clip, a subfolder that isn't your output root, and the file's actual path handed back to you. That's exactly the gap ZH_VideoSaver (💾 智绘_纯净视频保存, "clean video saver") fills. It takes a batch of frames plus an optional audio track and writes an .mp4 - no interpolation, no VHS-style extras, just a solid two-stage encode.
How it actually saves
Look at the source and it's refreshingly direct. First it writes a silent video with imageio using an H.264 (libx264) encoder, yuv420p pixel format, at your chosen fps, with quality passed straight through as a crf argument. Then, if you've connected an audio input, it saves that to a temp WAV and shells out to ffmpeg to mux the two streams together with -c:v copy -c:a aac - video stream copied without re-encoding, so that second pass is near-instant. If the mux fails for any reason, it quietly keeps the silent video instead of crashing the workflow. The header comment calls this "V3 铁稳版" - the "iron-stable version" - and it earned that: the earlier approach of writing audio through imageio directly was a compatibility nightmare, so they swapped to ffmpeg CLI muxing.
The inputs that matter
- images (IMAGE) - your frame batch. Whatever you feed, it writes at
fps. - fps (FLOAT, default 24, 1–120) - the write rate. 8 frames at 24fps is a third of a second, so don't expect it to invent frames.
- crf (INT, default 20, 0–51) - the author's own tooltip says "画质控制:18-23 最佳" (quality control: 18–23 is best). Lower CRF = better quality, bigger file; 20 is a sensible default.
- filename_prefix (STRING, default
DT_Video) and sub_folder (STRING, defaultmy_videos) - the file lands inComfyUI/output/my_videos/DT_Video_0001.mp4, auto-incrementing the number so two runs never collide. - audio (AUDIO, optional) - wire in the audio output from a loader or an audio-gen node (MMAudio on the end of a Wan/Hunyuan pipeline is the classic case).
The single output, filepath (STRING), is the absolute path of the saved file - handy when you want the next node to know where the clip lives, or you just want it in the UI text.
Installing it
Same as any node from this pack:
cd ComfyUI/custom_nodes
git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
then restart, or use ComfyUI Manager and search "ComfyUI-ZhiHui". Two install notes worth knowing: the pack's requirements.txt is stuffed with heavy deps (transformers, rembg, onnxruntime) for other nodes - you don't need any of that for the saver, and nothing imports at load time to break it. The saver itself needs imageio, torchaudio, and ffmpeg, all of which a normal ComfyUI install ships; it grabs its ffmpeg from the imageio-ffmpeg bundled binary and falls back to ffmpeg on PATH.
Gotchas
- The
-shortestcomment lies. The code comments claim the mux command trims to the shortest stream, but the actual ffmpeg call omits-shortest. Feed an audio track longer than the clip and the output won't be cut down - trim audio upstream if it matters. yuv420pis hardcoded, which is fine for normal footage but will soften fine text if you're saving credit sequences or UI captures. Don't fight it; just know.- No timestamp in filenames - predictable
_0001,_0002numbering only. If you save the same prefix to the same folder forever, it'll walk up to_9999eventually, and cleaning old clips is on you. - Frame count = duration. There's no frame-repeat or looping. If your video model gives you a 33-frame clip and you want 5 seconds, raise the
fps, don't hope for interpolation.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| filename_prefix | STRING | DT_Video | — |
| fps | FLOAT | 24.001–120 | — |
| crf | INT | 200–51 | 画质控制:18-23 最佳 |
| sub_folder | STRING | my_videos | — |
| audioopt | AUDIO | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filepath | STRING | — |