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

Bernini-R VAE Encode

Turning frames into latents with tiling, for the parts of Bernini-R that need it

By xiaolibai-sys·Created 2 months ago·Updated 2 months ago· 9
Bernini-R VAE Encode
  • vae
  • pixels
  • samples
enable_tilingfalse
tile_x272
tile_y272
tile_stride_x144
tile_stride_y128

Most Bernini-R workflows never need BerniniR_VAEEncode directly - BerniniR_Conditioning handles encoding your source video and references internally, with its own chunking. But there are jobs where you want the raw encoder yourself: pre-encoding a clip, building an img2vid path by hand, or encoding frames from external tools. That's this node. It's the encode half of the pack's VAE pair, and its whole personality is tiling.

How it works

It takes pixel frames (an IMAGE, shape F×H×W×C in [0,1]) and runs them through the Wan 16-channel VAE to produce a LATENT. The 16-channel shape is what you need to remember: this is the 4×-temporal, 8×8-spatial compression latent space Bernini-R samples in. Don't feed this latent to an SDXL sampler and don't feed SDXL latents here.

The interesting part is enable_tiling. When it's on, the encoder splits each frame spatially into tiles with an overlap stride, encodes each tile, and stitches the results. That's how you encode very large frames on a VRAM-limited card - but tiling is never free. It costs some encoding quality at tile boundaries, and the trade is controlled by the stride: larger strides mean fewer tiles (faster, fewer seams) but more artifacts.

The inputs that matter

  • vae - from BerniniR_VAELoader. The Wan 16-channel VAE.
  • pixels - the frames to encode.
  • enable_tiling - off by default. Turn it on when encoding big frames OOMs.
  • tile_x / tile_y - tile dimensions in pixels, both 272 by default.
  • tile_stride_x / tile_stride_y - strides, default 144/128, and they must be smaller than the tile sizes - that's the overlap that stops seams from becoming visible borders.

Output and wiring

One output: samples (LATENT). Feed it to BerniniR_KSampler (or the DualExpertSampler) as latent_image, typically with denoise < 1.0 if you want to preserve the source structure - that's the img2vid pattern.

Honest notes on tiling

The default tile setup (272×272 tiles, ~144/128 strides) is a reasonable starting point but not a magic number - if you see visible tile borders, raise the overlap by lowering the strides. If you see flicker across frames from inconsistent tile boundaries, you may be better served encoding in fewer, bigger tiles or just letting BerniniR_Conditioning's chunked encoding do the job. And a word on the ecosystem reality: the community's long-form Bernini path mostly runs through BerniniR_Conditioning rather than a standalone encode - so if you're wiring this node in because you thought you had to, check whether the conditioning node already handles it. When it doesn't, though, tiled encode is exactly what saves you from an OOM mid-graph.

CategoryBernini-R/VAE

Inputs (7)

NameTypeDefaultDescription
vaeVAEBernini-R VAE (Wan 16-channel, 4x temporal downscale)
pixelsIMAGEVideo frames (F, H, W, C) in [0, 1]
enable_tilingoptBOOLEANfalseSpatial tiling for VRAM-limited GPUs
tile_xoptINT27264–4096Tile width in pixels
tile_yoptINT27264–4096Tile height in pixels
tile_stride_xoptINT14416–4096Horizontal stride (must be < tile_x)
tile_stride_yoptINT12816–4096Vertical stride (must be < tile_y)

Outputs (1)

NameTypeDescription
samplesLATENT