Save Video (Format Converter)
One render, five containers, one ffmpeg call
- 视频
- video
- summary
A generated clip is rarely the clip someone wants. It comes out as whatever the render pipeline felt like writing, and then it needs to be an MP4 for Discord, a WEBM for a web page, or an MKV because the audio codec won't fit anywhere else. This node takes one VIDEO and writes up to five containers from a single run, adjusting codec, resolution, frame rate and audio on the way out.
Where it sits
The video ecosystem has spent two years getting very good at making frames and comparatively little time on delivering them. Most people solve delivery by dragging files through HandBrake or an ffmpeg one-liner they found in a forum. That works, but it's outside the graph - you lose the parameter trail, and you do it again every time you tweak the prompt. Putting conversion in the graph means the export is part of the workflow, downstream of Load Video (Advanced) (or any core video node), and reproducible.
The mechanism
It reads the source parameters the loader attached to the VIDEO object, then makes one decision before any encoding happens: can I skip encoding entirely? If the source file is untouched (no trim window), one of the targets matches the source's own container, and every encoding parameter is on Auto, it copies the file and labels it copy. Instant, lossless, done.
Otherwise it builds a single ffmpeg command - -ss and -t for any trim window the loader recorded, one -map 0:v:0 plus one output path per selected container - and runs it once. Five formats cost one process, not five. Encoder choice is a cascade: whatever you picked explicitly, else the source's codec if that container can carry it, else the container's first recommendation (MP4 → H.264, WEBM → VP9, AVI → MPEG-4). That fallback is the useful part - ask for H.264 in a WEBM and it quietly gives you VP9 instead of writing a file nothing will play. Auto CRF is tuned per codec too: 20 for libx264, 24 for libx265, 32 for VP9 and AV1.
Resolution scaling uses ffmpeg's force_original_aspect_ratio=decrease, so the output fits inside the box you picked without stretching or cropping - a 2.35:1 clip sent to 1920×1080 comes out roughly 1920×817, not squashed.
Inputs and outputs
You'll set 文件名前缀 (a path relative to output - video/shot_04 becomes output/video/shot_04_00001.mp4, with an incrementing counter so a re-run doesn't clobber the last one), the 导出MP4 / 导出MKV / 导出WEBM / 导出AVI / 导出MOV toggles, and 报告语言.
Then the ones you only touch when Auto isn't good enough: 视频编码, 画质CRF (16 / 20 / 23 / 26 - lower is better and bigger), 分辨率, 帧率, 音频处理, 音频码率.
One thing to know about 音频处理, because the label oversells: as of version 1.0.0, Keep original audio (no re-encoding) doesn't actually stream-copy. It maps to the container's default audio encoder - AAC at 192 kbps for MP4/MKV/MOV, MP3 for AVI, Opus for WEBM - so it does re-encode. If you need bit-exact audio, rely on the direct-copy path (target container matches source, video parameters Auto, audio Keep original or Auto) or export the audio separately. Remove audio gives you a silent file; naming a codec forces a transcode at 音频码率.
Outputs are video (the same VIDEO, carrying a record of what was written, so a Video Report downstream can list it) and summary (a STRING - the source-versus-export parameter report). It's an output node, so it runs as a terminal node on its own.
Installing
Manager → comfyui_media_toolbox, or:
cd ComfyUI/custom_nodes
git clone https://github.com/jesse890423/comfyui_media_toolbox.git
Restart. av, numpy, torch come with ComfyUI. The only added dependency is imageio-ffmpeg, which ships a static ffmpeg. That's a hard requirement for this node - it is a wrapper around the binary. Check it:
python -c "import imageio_ffmpeg; print(imageio_ffmpeg.get_ffmpeg_exe())"
And use a full ffmpeg build. Cut-down builds without libx265, libvpx-vp9 or libaom-av1 load fine, then die mid-encode with a raw ffmpeg stderr tail. gyan.dev's release-full on Windows, or BtbN's builds, or just imageio-ffmpeg.
Things that will bite
Some formats are slow. VP9 and especially AV1 (libaom) are not in the same time class as x264. Compressing a 20-second 1080p clip to AV1 at CRF 16 can take minutes of pure CPU while your GPU sits idle. If you only need it to play, H.264 is the answer nine times out of ten.
Upstream isn't a file. If the VIDEO came from a node that built frames in memory, this node has to serialize it to a temporary H.264 buffer and pipe it into ffmpeg first. Functional, noticeably slower, and the error message tells you to use Load Video (Advanced) upstream when it can't.
Trim + convert = re-encode. A clip loaded with a truncation window can never take the copy path. It's a real encode, budget accordingly.
AVI is a trap. It's offered for compatibility, but AVI with H.264 is a Frankenstein that some players refuse. Use MP4 unless you have an actual reason.
No report node needed. The save node already builds the full source-versus-export report and exposes it as summary. That's the common confusion this pack's own description warns about.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| 视频 | VIDEO | The VIDEO input of any video output node. | |
| 文件名前缀 | STRING | video/ComfyUI | A relative path inside the ComfyUI output directory. Absolute paths are rejected. |
| 导出MP4 | BOOLEAN | true | — |
| 导出MKV | BOOLEAN | false | — |
| 导出WEBM | BOOLEAN | false | — |
| 导出AVI | BOOLEAN | false | — |
| 导出MOV | BOOLEAN | false | — |
| 视频编码 | COMBO | Auto (follow source) | "Auto" reuses the source codec; if that codec is incompatible with the target container it falls back to the container's recommended codec. |
| 画质CRF | COMBO | Auto (follow source) | Constant rate factor. Lower values mean higher quality and larger files; "Auto" picks a sensible default per codec. |
| 分辨率 | COMBO | Keep original | "Keep original" uses the source resolution; any other option scales to the listed size proportionally (no distortion, no cropping). |
| 帧率 | COMBO | Keep original | "Keep original" uses the source frame rate; any other option outputs the given value. |
| 音频处理 | COMBO | Keep original audio (no re-encoding) | "Keep original audio" does not re-encode; "Auto" transcodes when the target container cannot carry the source audio; "Remove audio" exports a silent video; any other option forces transcoding to that format. |
| 音频码率 | COMBO | Auto (follow source) | Bitrate used when the audio is re-encoded. "Auto" picks a common value for the chosen audio codec. |
| 报告语言 | COMBO | Follow UI language | Language of the parameter report. "Follow UI language" produces a Chinese report while the ComfyUI interface is Chinese, and an English report otherwise. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |
| summary | STRING | — |