Decode and Save Video
Decode long video straight to disk without OOMing
- video_latent
- video_vae
- audio_latent
- audio_vae
The usual way to finish a video in ComfyUI is VAE Decode → a giant IMAGE batch sitting in memory → a combine node that muxes it into a file. That middle step is where long or high-res clips fall over: every decoded frame lives in RAM (and VRAM) at once, and a few hundred frames at 720p will happily eat all of it. DecodeAndSaveVideo skips the pileup. As its description says, it "decodes video frames and audio from latent representations, combines them, and saves as a video file, without keeping intermediate images in memory." Decode, write, move on - no giant image batch.
It's from Kijai's KJNodes, and it fits the pattern of the pack's model-optimization side: small nodes that shave VRAM off the parts of a video workflow that blow up. For anyone doing Wan, Hunyuan, or LTX at length, this is the node that turns "out of memory on decode" into "it just finished."
How it works
Instead of decoding the whole latent into an image tensor and handing it off, it decodes in a streaming, tiled fashion and pipes frames to the encoder as it goes, so the full uncompressed sequence never coexists in memory. If your model also produces an audio latent, it decodes that too and muxes it into the same file. The result is a finished video on disk with far lower peak memory than the classic decode-then-combine chain.
The inputs and outputs that matter
video_latent(LATENT) - the sampled video latent.video_vae(VAE) - the VAE that matches your model. Get this right; a mismatched VAE gives you a smeared mess.fps(default 25) - playback frame rate of the saved file.filename_prefix(defaultvideo/ComfyUI) - where it lands under your output folder and what it's named.tiling- the VRAM lever. If you're still tight on memory, this splits the decode spatially so even single frames don't need the whole card.format/codec(both defaultauto) - leave on auto unless you have a specific container/codec need.audio_latent/audio_vae(optional) - for models that generate sound, wire these to get audio muxed in.
It's an output node - there are no outputs to wire onward. The file on disk is the deliverable, and that's deliberate.
How to install it
ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt
then restart (portable: run pip through python_embeded\python.exe). Encoding to a video file leans on ffmpeg, which ComfyUI video workflows generally already have available.
Common issues & troubleshooting
You wanted the frames to keep working on them. This node has no IMAGE output - it goes straight to a file. That's the trade for the memory savings. If you need to upscale, interpolate, or composite after decode, this isn't your node; use a normal VAE Decode and accept the memory cost, or do that work before sampling.
Still out of memory. Turn on tiling. The whole point is low peak memory, but a single 1080p+ frame can still be a lot; tiling breaks the spatial decode into pieces.
Colors or motion look wrong. Usually a VAE mismatch - the video_vae has to be the one for your model. For Wan and similar, also remember the VAE compresses time, so your latent frame count isn't the decoded frame count 1:1.
No audio in the file. You need both an audio_latent and the matching audio_vae wired in. If your model doesn't produce an audio latent, there's nothing to mux and the file is silent by design.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| video_latent | LATENT | The latent representation of the video frames. | |
| fps | FLOAT | 25.000–999 | Frame rate for the output video. |
| filename_prefix | STRING | video/ComfyUI | The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes. |
| format | COMBO | auto | The format to save the video as. |
| codec | COMBO | auto | The codec to use for the video. |
| video_vae | VAE | The VAE model to use for encoding. | |
| tiling | COMBO | 2 options: [object Object], [object Object] | |
| audio_latentopt | LATENT | The latent representation of the audio frames. | |
| audio_vaeopt | VAE | The VAE model to use for decoding audio. |
Outputs (0)
No outputs