Bernini-R Conditioning
Latents, source video, references, and mask editing in one place
- positive
- negative
- vae
- source_video
- reference_video
- reference_images
- mask
- positive
- negative
- latent
If you've used a stock ComfyUI graph, the empty latent, the VAE encode of your source, and the mask handling were three separate chores. BerniniR_Conditioning folds all of them into one node, and it's the closest thing this pack has to a workflow in a box. It creates your starting latent, encodes whatever visuals you give it into context_latents that the model attends to during denoising, and wires it all onto your conditioning. It's also where "Bernini-R does editing without a mask pipeline" stops being strictly true - the mask input is here, optional, and very good when you connect it.
How it works
You feed it your positive/negative conditioning (from BerniniR_PromptEmbedding), your VAE, and a width/height/length. It builds a zero latent and, if you connect any visual input, VAE-encodes it into context latents: source_video for video-to-video, reference_video for style/motion guidance, reference_images for subject/style conditioning (the node autogrows up to eight reference slots). Because encoding a long source video is exactly the kind of thing that OOMs small GPUs, encoding happens in chunks (chunk_frames, default 16 pixel frames) with overlap so the VAE's 3D convolutions don't leave temporal seams.
The inputs that matter
- width / height / length - output dimensions and total pixel frames. The README's starter values: 832×480, length 81 (~5 seconds at 16 fps).
- positive / negative / vae - from the prompt planner and VAE loader.
- source_video / reference_video / reference_images - the in-context visuals. Which ones you connect is what actually determines the task (prompt-only = text-to-video; prompt + reference image = I2V; prompt + source video = V2V editing).
- batch_size - >1 creates multiple latents for parallel generation in one run. Fun, but watch VRAM like a hawk.
The mask pair deserves its own paragraph:
- mask - from a segmenter like SAM2. White (1) = regenerate, black (0) = keep source, same convention as ComfyUI's
denoise_mask. Connecting it enables differential diffusion. You connect it without inverting. - mask_mode -
anneal(default) = soft background anchoring with natural boundaries;freeze= pixel-level freeze where the background stays completely still. Start withanneal;freezeis for when the background must not move a single pixel.
Outputs and wiring
Three: positive and negative (CONDITIONING) - now carrying the context latents - plus latent (LATENT). All three go to BerniniR_KSampler (or the DualExpertSampler).
Where people get burned
The two classic issues both live in this node. OOM when encoding a long source video → drop chunk_frames lower (16 is already low, but a long clip at high res still adds up) and consider force_offload in the prompt planner. Mask edits that look wrong → check you didn't invert the mask; it must be white-where-you-edit, straight from SAM2, no inversion. And remember the model-level truth that makes all editing here heavy: the source video becomes part of the model input, so an edit costs roughly double the compute of a plain Wan 2.2 generation. That's not your workflow's fault. It's the model.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| width | INT | 83264–4096 | — |
| height | INT | 48064–4096 | — |
| length | INT | 811–10000 | — |
| batch_size | INT | 11–64 | — |
| ref_max_size | INT | 84864–4096 | — |
| chunk_frames | INT | 161–256 | Max pixel frames per VAE encoding chunk. Snapped to nearest multiple of 4 internally. |
| chunk_overlap | INT | 44–32 | Pixel frames of overlap between chunks. Prevents temporal boundary artifacts from VAE 3D convolutions. |
| source_videoopt | IMAGE | — | |
| reference_videoopt | IMAGE | — | |
| reference_imagesopt | IMAGE | — | |
| maskopt | MASK | Mask of the region to edit. White (1) = regenerate, black (0) = keep source. From a segmenter like SAM2; connect directly without inverting. Connecting enables differential diffusion. | |
| mask_modeopt | COMBO | anneal | anneal = soft background anchoring with natural boundaries (default); freeze = pixel-level freeze, background stays completely still |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |