Nodes/ComfyUI-BerniniR Wrapper/Bernini-R VAE Decode
ComfyUI Node

Bernini-R VAE Decode

Decoding latents to video, with tiling and a color-match party trick

By xiaolibai-sys·Created 2 months ago·Updated 2 months ago· 9
Bernini-R VAE Decode
  • vae
  • samples
  • ref_image
  • images
colormatchdisabled
enable_tilingfalse
tile_x272
tile_y272
tile_stride_x144
tile_stride_y128
blend_strength1.00

Every video generation ends the same way: latents out of the sampler, pixels out of the VAE. BerniniR_VAEDecode is the decode side of this pack's VAE pair, and on top of the boring-but-essential job it has two genuinely interesting features - spatial tiling for huge frames, and a color-matching mode that nails temporal consistency across long clips.

How it works

It runs the sampler's LATENT through the Wan 16-channel VAE to get frames back. The 16-channel latent decodes with 4× temporal and 8×8 spatial compression, which is why 81 pixel frames ≈ 20 latent frames - and why the pack's guidance happens in noise-residual space rather than denoised space; decode is just the last step.

Tiling works like the encode side: split each frame spatially, decode tiles, stitch. It's the tool for very large frames on small cards. Color matching is the interesting one. Bernini-R long renders drift in color balance across windows - the video gradually shifts tint and you notice it in cuts. This node can match the decoded video's color distribution to a reference - hm-mvgd-hm is the README's recommended default for temporal consistency - using any of seven algorithms (Reinhard, histogram matching hm, Monge–Kantorovich mkl/mvgd, and their combinations). If you don't provide a ref_image, it uses the first decoded frame of the batch as the reference, which is exactly the right default for keeping a whole clip consistent with its own opening.

The inputs that matter

  • vae - from BerniniR_VAELoader.
  • samples - the latent from the sampler.

Then the optional row, where the action is:

  • enable_tiling - off by default; on for VRAM-limited GPUs or very large frames.
  • tile_x / tile_y / tile_stride_x / tile_stride_y - same trade language as encode: tiles at 272×272 by default, strides 144/128, stride must stay under tile size. Lower strides = more overlap = fewer seams.
  • colormatch - disabled by default. hm-mvgd-hm when you want temporal consistency.
  • ref_image - your color reference; defaults to the first decoded frame.
  • blend_strength - how hard to apply the transfer, 0.0 = original, 1.0 = full. Start at 1.0 and back off if the reference tint is too strong.

Output and wiring

One output: images (IMAGE), the finished frames. Standard - save it with VHS_VideoCombine or whatever you normally use.

Where people get burned

Two things. Tiling artifacts - visible grid lines mean the overlap is too small (raise it) or the tile size is awkward for your resolution (make tiles divide your frame cleanly). The README's OOM-during-decode advice is literally "enable tiling, reduce tile overlap." Color match fighting your intent - if you set a ref_image with a strong tint and blend_strength at 1.0, you've signed up for that tint across the whole video; that's a feature, but it reads as a bug when you forget you set it. And remember kornia is an optional install the README lists for the CIELAB path of Reinhard color matching - skip it and that particular algorithm's full color path may not be available, even though the pack itself installs fine without it.

One honest tip: decode at the resolution you intend to keep. Up-scaling a decoded video is fine, but the color-match consistency this node buys you is best preserved when you don't re-encode the frames downstream. Decode once, save once, done.

CategoryBernini-R/VAE

Inputs (10)

NameTypeDefaultDescription
vaeVAEBernini-R VAE (Wan 16-channel, 4x temporal downscale)
samplesLATENTLatent to decode (from sampler output)
colormatchoptCOMBOdisabledColor transfer algorithm. 'hm-mvgd-hm' is a good default for temporal consistency
enable_tilingoptBOOLEANfalseSpatial tiling for VRAM-limited GPUs. Enables decoding very large frames
tile_xoptINT27264–4096Tile width in pixels
tile_yoptINT27264–4096Tile height in pixels
tile_stride_xoptINT14416–4096Horizontal stride (must be < tile_x). Larger = fewer tiles, more artifacts
tile_stride_yoptINT12816–4096Vertical stride (must be < tile_y). Larger = fewer tiles, more artifacts
ref_imageoptIMAGEReference image for color matching. If not provided, uses first decoded frame per batch
blend_strengthoptFLOAT1.000–1Color match blend. 0.0 = original, 1.0 = full transfer

Outputs (1)

NameTypeDescription
imagesIMAGE