π§ Save Video (Dehypnotic)
Get a real MP4 out of ComfyUI (and the frames, too)
- images
- audio
- video
- images
- video_path
ComfyUI is great at producing 97 frames of video and weirdly bad at the moment you have to turn those frames into a file you can actually send someone. The stock Save Video node gets you there, but it's minimal. Save Video & Frames (Dehypnotic) is what you reach for when you want a proper MP4 (or MKV, WebM, MOV) with real codec choices, an optional still-frame export, and an optional audio track, all in one output node.
How it works
It pipes your IMAGE batch as raw RGB frames straight into ffmpeg via stdin and writes the encoded file to disk. No system-wide ffmpeg install needed - it uses the static binary bundled by imageio-ffmpeg, auto-downloaded on first run. Feed it an optional AUDIO input and it writes a temp WAV and muxes it in. Two mechanical details worth knowing: frames are padded to even dimensions (H.264 and friends demand even sizes), and container/codec pairing is enforced - pick VP9 inside an MP4 and it refuses, printing the allowed list. MP4 takes h264/h265/av1; WebM takes vp9/av1; ProRes and DNxHR are MOV-only.
The inputs that matter
- images - the frame batch from your sampler/VAE decode.
- fps - constant frame rate; 24 is the sane default.
- container and video_codec - mp4 + h264 is the right starting point for anything you'll post. WebM/VP9 or AV1 shrink files but encode slowly (the code gives AV1
-cpu-used 6and row-mt to speed it up, but don't expect miracles). - crf - quality, lower = better and bigger; 18β28 is typical for H.264.
- preset - ultrafast β veryslow; the default
fastis a fine balance. - save_mode -
video,frames, orvideo & frames.
The frame export is where this node quietly beats the core one. Set frames_dir and frames_select (-1 = all, -2 = last, 0 = first, or a comma list like 0,5,10). Default is -2, which exports only the last frame - mildly surprising the first time you use it. And loop_still_to_audio is a neat trick: one frame plus an audio track gets looped to match the audio length, giving you a slideshow-style export.
Outputs: images (the batch passed through, so you can keep chaining) and video_path (STRING, the full saved path - or the frame folder when you only export frames). It's flagged as an output node, so it can terminate the graph. show_preview dumps a temp image sequence into the UI result while you're tuning, and show_progress prints the ffmpeg command and progress to the console - leave it on during setup.
Install
Via ComfyUI Manager (search "Dehypnotic Save nodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Dehypnotic/comfyui-dehypnotic-save-nodes
Restart ComfyUI. The pack ships with no requirements.txt, so this node's only real dependency is Python packages imageio and imageio-ffmpeg. If they're missing it fails at run time with install guidance:
pip install imageio imageio-ffmpeg
Common issues
- Codec-not-in-container error - pick a pairing the node lists; it tells you the allowed set.
- Saving to an external drive fails. All three Dehypnotic save nodes refuse to write outside ComfyUI's
output/folder unless you whitelist a root. Createdehypnotic_save_allowed_paths.jsonin your ComfyUI root (orconfig/,user/config/) with{"allowed_roots": ["D:/VideoExports"]}, or point theDEHYPNOTIC_SAVE_ALLOWED_PATHSenv var at it. The error message spells out the locations. - Heads up: this repo's README announces it will be deleted - the updated home is
Dehypnotic/ComfyUI-Dehypnotic, and the node keeps the same class name, so migrating is a drop-in swap and your saved workflows keep loading.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | output/video | Folder where the video is saved. |
| date_subfolder_pattern | STRING | %Y-%m-%d | Optional strftime pattern or placeholders for subfolders. |
| filename_prefix | STRING | VID | Filename prefix, e.g. VID_0001.mp4. |
| filename_delimiter | STRING | _ | Delimiter between prefix and sequence number. |
| preview_only | COMBO | off | Skip saving video file to disk while keeping player preview functionality. |
| number_padding | INT | 41β10 | Digits in the sequence number (0001, 0002, ...). |
| number_start | INT | 10β1000000 | Starting value for the sequence number. |
| container | COMBO | mp4 | Container format (mp4, mkv, webm, mov). |
| video_codec | COMBO | h264 | Video codec to use for encoding. |
| fps | FLOAT | 241β240 | Frames per second (CFR). |
| crf | INT | 230β51 | Quality (lower = better, larger files). Typical 18-28 for H.264. |
| preset | COMBO | fast | Encoder speed versus quality (ultrafast ... veryslow). |
| imagesopt | IMAGE | Optional frame input. Batch data supported. | |
| audioopt | AUDIO | Optional audio track. Mono/stereo supported. | |
| videoopt | VIDEO | Optional video input (video file path, video tensor batch, video dictionary, or VHS_VIDEO). | |
| loop_still_to_audioopt | BOOLEAN | true | If only one frame plus audio, loop the frame to match audio length. |
| show_progressopt | BOOLEAN | true | Write progress information to the console. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | β |
| video_path | STRING | β |