# Masked editing MiniMax H3 can edit a real source AV latent instead of treating the source as an ordinary reference. A nested denoise mask controls every target stream: ```text 0 = preserve the source latent 1 = regenerate this row ``` This is the general form of the chain's `masked_av`, `tapered_av`, `feathered_av`, and `drift_control_av` continuation. The chain builds a temporal prefix mask automatically; the public masking nodes accept arbitrary static or tracked spatial masks. `masked_av` assigns `0` to the complete repeated picture prefix. Experimental `tapered_av` uses the same hard mask after replacing only the carried video prefix with a deterministic, disposable matched-variance noise taper; audio and the accepted predecessor remain unchanged. `feathered_av` keeps most of that picture prefix exact, then raises the mask gradually toward `1` over its final latent steps. When Audio Policy enables Generated continuity, the matching audio prefix participates too: with the recommended 39-frame context, 8 of 12 video steps and 42 of 65 audio steps are fully protected; the final 4 video and 23 audio prefix steps form the denoise ramp. With Generated continuity off, audio remains fully denoisable. Both modes trim all 39 repeated picture frames after decoding. Experimental `drift_control_av` keeps the accepted predecessor checkpoint clean. During sampling it applies the sampler's existing noise field to the oldest eight of a 12-step picture prefix at `next_sigma / current_sigma`, then tapers the last four steps `.75/.50/.25/.00` so the seam itself stays exact. The same live mask reaches H3's row-timestep calculation through Chain Context's MODEL output. Audio remains owned by Audio Policy. This mode is fixed to 39 context frames and initially validated at 20 sampling steps. Start with [`Masked Video Inpaint - MiniMax H3 0.6.json`](<../example_workflows/Masked Video Inpaint - MiniMax H3 0.6.json>). For picture-defined replacement appearance, use [`Ref2V Masked Video Inpaint - MiniMax H3 0.6.json`](<../example_workflows/Ref2V Masked Video Inpaint - MiniMax H3 0.6.json>). For temporal continuation and bridging, use the three [masked AV examples](../example_workflows/README.md#masked-av-extension-and-bridge). ## Ablejones / MaskVidExperiments interoperability Ablejones/droz's [`droz_MiniMaxH3_LatentMaskInpainting_wReference_v3.1.json`](https://discord.com/channels/1076117621407223829/1539132102585356359/1539347237887549512) uses `MVEx Mask To Latent Space` in `auto + max + max` mode before stock `Set Latent Noise Mask`. At zero additional grow, that is the same H3 mask contract as **Apply Target Mask → H3 exact**: VAE-aware causal frame groups, conservative max reduction, and 2×2 latent-token unification. The corresponding [workflow thread](https://discord.com/channels/1076117621407223829/1539132102585356359/1539132102585356359) also documents the crop-based approach and its current border-flicker caveat. The maintained Ref2V demo maps the remaining wiring as follows: | Ablejones v3.1 | This pack | |---|---| | `MiniMaxH3ReferenceToVideo` picture input | The same core Ref2VA picture input | | Video/audio VAE encode + two `SetLatentNoiseMask` nodes + `LTXVConcatAVLatent` | **Loop Source AV Target** followed by **Apply Target Mask** on the authoritative stock joint target | | `MVEx Subject Crop/Uncrop` | Optional external speed/compositing layer; the maintained loop demo stays full-frame | | SAM3 tracked mask | Any static mask or complete tracked MASK batch through **Loop Mask Slice** | | `grow_spatial` / `grow_temporal` | Optional pixel-mask preparation before **Loop Mask Slice**; the bundled generous static mask uses zero additional grow | Do not feed the source movie into Ref2VA again merely to label it. The source movie is already the clean target latent and supplies protected pixels, motion, camera, and synchronized audio. A picture reference should supply only the replacement appearance. Crop/uncrop remains useful when a small subject would otherwise spend most compute on an unchanged full frame, but a multi-scene chain must slice crop boxes on the same scene windows before uncropping. ## Nodes ### Masking · Loop Source AV Target **MiniMax H3 Masking · Loop Source AV Target** is the preferred source-video path inside Chain Loop. Connect Current Shot `state`, Chain Context `latent`, both H3 VAEs, and the complete synchronized source frames/audio. The node uses `generation_start_frame` and the stock H3 joint target to select and encode the exact current interval. The stock target's video and audio lengths are authoritative. At fractional 24-fps/40-Hz boundaries, exact picture-duration audio can encode one token shorter than the stock H3 audio target. This node adds only the encoder-grid lookahead needed to fill that target and trims back to its exact step count. Do not put `LTXVConcatAVLatent` or `LTXVSeparateAVLatent` in this path. ### Masking · Loop Mask Slice **MiniMax H3 Masking · Loop Mask Slice** accepts either one static mask or a complete tracked MASK batch. A single frame is explicitly broadcast across the current scene. A multi-frame batch is treated as a source-timeline mask and sliced with the current shot's `generation_start_frame` and `raw_frames`. Set `source_fps` to the rate represented by the tracked mask batch. For a 24-fps source/mask pair, the bundled two-scene workflow selects mask frames 0..174 for scene 1 and 136..310 for scene 2. The repeated 136..174 interval is therefore identical to the source AV continuation overlap. Connect `scene_mask` to Grid Preview; its existing spatial snapping then operates only on the correct current interval. Apply Target Mask's exact mode validates that the returned tracked batch has the complete raw scene length; it never stretches a short tracked batch silently. ### Masking · Trim Source AV **MiniMax H3 Masking · Trim Source AV** drops only trailing video frames until the source has a valid H3 `17k+5` length. Optional source audio is trimmed to the same duration at H3's fixed 24 fps. It never resizes frames, changes fps, or pads short audio. Use the returned `h3_length` for the core H3 conditioning node. Resize the returned frames once to the final H3 canvas, then feed that exact batch to the video VAE, mask preview, and any tracking path. ### Masking · Grid Preview H3's video VAE reduces each spatial axis by 16 and the DiT groups the result into 2×2 latent patches. One independently masked H3 row therefore covers roughly **32×32 source pixels**. **MiniMax H3 Masking · Grid Preview** shows those cells and returns a snapped MASK suitable for Apply Target Mask. Its canvas must match the encoded source, be divisible by 32, and contain a valid one-frame or `17k+5` H3 run. Runtime exact mode also unions every source-frame group that feeds one causal video latent, then paints that effective selection back over the grouped frames. - `runtime exact (latent max)` reproduces the spatial reduction used by H3; - `any pixel coverage` selects a whole cell for any marked source pixel; - `50% pixel coverage` selects cells at least half covered; - `full pixel coverage` selects only completely covered cells; - `cell_adjust` grows or shrinks by complete cells. The `grid_preview` IMAGE contains only the selected `preview_frame` to avoid duplicating an entire video for display. The `snapped_mask` output retains the complete static or tracked mask batch. ### Masking · Apply Target Mask **MiniMax H3 Masking · Apply Target Mask** expects the source media as the sampler's real joint video/audio target latent. In a loop, produce it with **Loop Source AV Target**, apply the mask, and connect `masked_target` to `SamplerCustomAdvanced.latent_image`. Do not also add the same source as `