ComfyUI Node

OpenSora Decode

The decoder that turns video latents into actual frames

By kijai·Created 2 years ago·Updated 2 years ago· 43
OpenSora Decode
  • samples
  • opendit_vae
  • images

If you've built a ComfyUI image workflow, you know the drill: sample, then VAE Decode, then Save Image. Video is the same shape - except the stock VAE Decode node will refuse or mangle your OpenSora output, because a video latent has a time axis and the built-in decoder has never seen one. This node is the replacement: feed it the sampler's latent and the OpenSora VAE, and you get a batch of frames out the other side.

How it works

Mechanically it's thin, and that's the point. The node takes your samples latent and opendit_vae, moves the VAE onto the GPU, and runs the decode with the frame count taken straight from the latent - num_frames=len(samples). The output tensor is squeezed and reordered into (frames, height, width, channels) as a normal IMAGE, which is exactly what every video-saving node in ComfyUI expects.

Two quirks in the source are worth knowing. First, it clamps the raw VAE output to [-1, 1]. Second, and more interesting, it then does a per-clip min-max normalization across the whole batch to map everything to [0, 1]. That second step means the brightness and contrast of your clip are stretched to fill the full range on every run. It usually looks fine and honestly often flatters the output, but it's not a mathematically faithful decode - don't be surprised if a dark scene comes out punchier than the latent "should" be. If you're grading your clips downstream, that's the thing shifting your values.

Inputs and output

  • samples (LATENT) - straight from OpenDiTSampler's samples output.
  • opendit_vae (VAE) - the same VAE the sampler used. You can either wire your original loader here or use the sampler's handy opendit_vae pass-through output, which is what the pack's example workflows do.

The single output, images (IMAGE), is a batch of frames in time order. Wire it into VHS Video Combine (or any batch-to-video node) to save an mp4. You can also feed it into standard image nodes like frame interpolation or upscaling - frames are just a batch of images to everything downstream.

Installing

Same shared install as the rest of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-OpenDiTWrapper
pip install -r requirements.txt
pip install xformers --no-deps

or find "ComfyUI-OpenDiTWrapper" in ComfyUI Manager and restart. Windows portable users run pip through python_embeded\python.exe.

Common issues

The classic mistake is skipping this node and running the sampler's LATENT through the stock VAE Decode. It errors on the shape or silently produces garbage - this node exists precisely because of that mismatch. Decoding is also the second-biggest VRAM spike in the whole pipeline (the sampler is first), so if you OOM late in a run, consider decoding at a lower resolution or letting the sampler's keep_model_loaded stay off so the diffusion model has already been offloaded before the decode begins.

CategoryOpenDiTWrapper

Inputs (2)

NameTypeDefaultDescription
samplesLATENT
opendit_vaeVAE

Outputs (1)

NameTypeDescription
imagesIMAGE