Masked Composite
Hide a region of a video behind a mask, EXACTLY, or cut it out as a transparent layer. Wire the clip into `video` and a black-and-white mask video into `mask` (white = the region, e.g. a Segment Mask output), then pick a `mode`: `blur` (a Gaussian blur of the clip itself, strength = sigma in pixels), `solid` (a flat `color`), `video` (a second clip wired into `fill` shows through the mask, e.g. a depth map for character-isolated depth), or `cutout` (cutout: transparent outside the mask, for Video Editor layers). Cutout is rotoscoping: Segment Mask (prompt = the object, e.g. \"red car\") into `mask` and the same clip into `video` gives that object alone on a transparent background, with the clip's own pixels inside the mask; `invert` keeps everything except the object instead, and `feather` becomes a soft alpha edge. Wired into a Video Editor it lands on `layer_N`, but the editor appends a new wired video as its own full-frame scene after the others, not on top: to stack it over the clip and move or scale it, add it with edit_video_timeline as a `kind: \"video\"` track clip (src `{{layer_N}}`, x / y / scale) over the clip's scene. The alpha in a rendered MP4 is not verified yet; check it with preview_video_frames. `alpha_format` (cutout only): `webm_vp9` (default, VP9 alpha WebM that browsers decode; ffmpeg's default vp9 decoder hides the alpha, so tooling reads it with `-c:v libvpx-vp9`) or `prores` (ProRes 4444.mov for editing tools; Chrome cannot play it). A cutout has no audio (its sound stays on the clip it came from). The face-hide recipe for Seedance reference swaps is Segment Mask (prompt \"face\") into this node, so identity can only come from your stills. Unlike Video Blend this never shifts the colours of the rest of the frame: the composite runs in the clip's own 4:2:0 planes and pixels outside the mask pass through untouched; only the final x264 encode (CRF 18 default) sees them. `grow` moves the mask's edge BEFORE the feather, in output pixels: positive grows the white region, negative shrinks it (-40 to 40, blank = 0; measured as a square, so a diagonal edge moves up to 1.4x as far). On a person swap, grow a few pixels past the feather so the original subject's outermost pixels are covered instead of mixed back in as a thin dark outline. `feather` softens the edge over about that many pixels each side; `invert` hides everything EXCEPT the region (grow acts on the region before the invert). Before the grow, `despeck` drops every separate piece of the mask smaller than that percent of the frame (new nodes start at 0.002, about 18 px on a 720x1280 mask; blank or 0 keeps them, which is what a node saved before it does), so an isolated 1 px speck in a Segment Mask output is never grown into a grey square; anything connected to the subject, a 1 px hair strand included, is kept as it was. `largestOnly` keeps just the biggest piece in each frame, for a single-subject swap where the prompt also caught something in the background. Turn on `overlapReport` when `video` is itself a mask (the Kawarimi hand paste-back: a hand mask in `video`, the head mask in `mask`) and the `overlap` output lists the frame ranges where the two touch (within the grow plus 2 px), so a grader knows where to crop-zoom. Output is the base clip's size, frame rate and length, with its audio stream-copied (cutout: no audio). The mask is scaled to the clip (refused if its shape differs by more than 2%), and refused if it is shorter than the clip, since holding its last frame would uncover the region; a shorter fill holds its last frame, a longer mask or fill is cut. Clips over 30 seconds are refused. Free to run: this node quotes and charges 0 credits.
Try Masked Composite in the playground
Masked Composite
Node type: utility:video_masked_composite
Category: Editing
Description
Masked Composite hides one region of a clip and leaves the rest of the frame exactly as it was: wire the clip into Video and a black-and-white mask video into Mask (white = region), pick what fills the white region in Fill, and the result comes out of Composited Video at the clip's size, frame rate and length. With blur the region gets a Gaussian blur of the clip itself, with solid one flat Solid colour, and with video a second clip wired into Fill Video (mode: video) shows through the mask. With cutout the clip is kept where the mask is white and everything else is transparent, so the result is a layer, not a frame, and it has no audio. Clips over 30 seconds are refused. This node is free: it quotes and charges 0 credits.
Canvas ports
These appear as port handles on the left side of the node.
| ID | Label | Details |
|---|---|---|
video |
Video | VIDEO (required) |
mask |
Mask (white = region) | VIDEO (required) |
fill |
Fill Video (mode: video) | VIDEO |
Sidebar config
These render as form fields in the right-side config panel when the node is selected.
| ID | Label | Details |
|---|---|---|
mode |
Fill | TEXT · options: blur, solid, video, cutout · default: "blur" |
fillMaskItself |
Fill the mask itself | BOOLEAN · default: false |
blur |
Blur strength (sigma px, 1-200; blank = 24) | NUMBER |
color |
Solid colour (hex; blank = #808080) | TEXT |
alpha_format |
Cutout format (mode: cutout) | TEXT · options: webm_vp9, prores · default: "webm_vp9" |
despeck |
Despeck (drop mask pieces under this % of the frame, 0-1; new nodes start at 0.002; blank or 0 = keep all) | NUMBER |
largestOnly |
Largest region only (keep one subject per frame) | BOOLEAN · default: false |
grow |
Grow mask (px, -40 to 40, negative shrinks; blank = 0) | NUMBER |
feather |
Feather (px, 0-50; blank = 0) | NUMBER |
invert |
Invert (hide everything except the region) | BOOLEAN · default: false |
overlapReport |
Overlap report (list frames where the video touches the mask) | BOOLEAN · default: false |
crf |
Quality (CRF, 12 best … 30 smallest; blank = 18) | NUMBER |
Outputs
| ID | Label | Type |
|---|---|---|
video |
Composited Video | VIDEO |
overlap |
Overlap report | JSON |
What it is for
Hide one region of a clip and leave the rest of the frame exactly as it was. Wire the clip into Video and a black-and-white mask video into Mask. White is the region. Then pick what goes there:
- blur: a Gaussian blur of the clip itself. Blur strength is the sigma in pixels (default 24); raise it on 4K footage.
- solid: one flat Solid colour (default
#808080). - video: a second clip wired into Fill Video shows through the mask.
- cutout: the opposite of a hide. The clip is kept where the mask is white and everything else is transparent, so the result is a layer, not a frame.
Recipe: cut an object out as a Video Editor layer (rotoscoping)
Any object SAM 3 can track becomes its own transparent video file, the object alone over a transparent background with its own pixels unchanged inside the mask:
- Import (your clip) into Segment Mask with the object as the prompt
(
red car,dog,the man in the hat). - Wire the same Import into Masked Composite's Video, and Segment Mask's output into Mask. Fill: cutout.
- Wire Masked Composite's output into the Video Editor. It lands on a
layer_Nport as a video.
What the wire does NOT do yet: the Video Editor adds a newly wired video as
its own full-frame SCENE after the ones already there, so the cutout plays
after the clip, not on top of it. To stack it, put it on a track over the clip
yourself: in the editor, or with edit_video_timeline as a kind: "video"
track clip whose src is {{layer_N}}, timed to the clip's scene, and
move or scale it with that clip's x, y and scale (or keyframes).
Under it goes the original clip, or a clean plate (the same clip through Masked
Composite with Fill blur or solid hides the object there).
Browsers decode the WebM's alpha, and the board preview plays it over a
checkerboard. Neither the editor's player nor a rendered MP4 has been checked
with a cutout on a track yet: look at it with preview_video_frames before
you rely on its alpha.
The dials work as they do for a hide, read for a keep:
- Invert keeps everything EXCEPT the object (a hole where it was).
- Grow mask takes in a few more pixels of the object's edge (negative trims it), before the feather.
- Feather becomes a soft alpha edge instead of a hard cut.
- Despeck and Largest region only drop stray mask pieces, so a speck the prompt caught in the background does not ride along as a floating dot.
Cutout format picks the file:
- WebM / VP9 (default): VP9 with an alpha channel. Browsers and the board
preview decode the alpha. ffmpeg's default vp9 decoder
does not and shows the clip as if it were flat: read it with
ffmpeg -c:v libvpx-vp9 -i cutout.webm(andffprobe -c:v libvpx-vp9reportsyuva420p). - ProRes 4444: a .mov with a real 4:4:4 alpha, for After Effects, Premiere, Resolve or Final Cut. Chrome cannot play ProRes, so the board shows no video for it; use WebM for anything that stays in Wireflow. ProRes files are big (about 1 byte per pixel per frame on real footage, 2.6 on grain), and the run is refused before the encode when 2.6 would pass 600 MB: about 8 s of 720x1280 at 30 fps, under 4 s of 1080x1920. Trim it or use WebM.
A cutout has no audio: its sound stays on the clip it came from, which is usually the track under it. The run checks the encoded file before it calls it done: outside the mask the alpha must be 0, inside it 255 with the clip's own pixels, on three sampled frames. Free, like every Masked Composite run.
Recipe: fill or grow the mask itself
To deliberately use the same mask file in Video and Mask, turn on Fill the mask itself, choose solid, and set an explicit Solid colour. Solid mode and a colour alone do not opt in. The processed mask is filled over black, so no original pixels leak through its edges. Grow mask (including negative shrink), Feather, Despeck, Largest region only, and Invert all apply. This setting requires the same file in both inputs; turn it off when compositing over a separate clip.
Recipe: hide the source face before a Seedance swap
Seedance 2.5 in reference mode copies whatever face it can see in the reference video, even when your stills show someone else. Take the face away and identity can only come from the stills:
- Import (your reference clip) into Segment Mask with the prompt
face. - Wire the same Import into Masked Composite's Video, and Segment Mask's output into Mask. Fill: blur (the shot still reads as a person) or solid (nothing left to copy at all).
- Wire Masked Composite's output into Seedance's reference video port, next to your character stills.
No Segment Mask on your canvas yet? Any black-and-white mask video made from the same clip works in its place.
A few pixels of Feather hide the edge if the result is also something people watch. For a model input it does not matter.
Recipe: character-isolated depth
Depth inside the person, real footage everywhere else: Segment Mask (prompt
person) into Mask, Depth Map (Video) of the same clip into Fill Video,
Fill: video. Seedance then gets the real room and camera but only a depth
silhouette of the performer.
Recipe: paste real hands back over a hidden head
A hand that passes the hidden head comes back from Seedance as a grey patch. Put the real hands back before the take:
- Segment Mask with the prompt
hand(detection threshold 0.3) on the clip. - Masked Composite: the hand mask into Video, the head mask into Mask,
Fill solid, colour
#000000, Grow mask 6. That is the hand mask minus the head. Turn on Overlap report. - Masked Composite: the head-hidden clip into Video, step 2's output into Mask, the clip into Fill Video, Fill video, grow 4, feather 3.
The Overlap report on step 2 lists the frame ranges where a hand touches
the head (within the grow plus 2 pixels), for example
touching in 1 range: 8.42-8.79 s. Those are the seconds to crop-zoom on
when you grade the take. It runs one extra pass over the two masks and costs
nothing.
Grow: the dark outline on a person swap
A segmentation mask hugs its subject's edge, and Feather softens that edge both ways. So on a person swap the original subject's outermost pixels end up half inside the blend and show as a thin dark outline around the new performer, and anything the mask missed (a dangling strap) stays in the shot.
Grow mask moves the mask's edge before the feather, in pixels of the output:
- positive grows the white region. Set it a few pixels past the feather (feather 8, grow 12) and the old outline is covered, not blended;
- negative shrinks it, for a mask that spills past its subject;
- blank or 0 uses the mask as wired.
It is measured as a square, so a diagonal edge moves up to 1.4 times as far as a straight one. Thin parts grow like the rest, and a shape touching the frame edge still touches it after a shrink. The mask is cut at 50% grey first, so a grown mask has a hard edge until Feather softens it. With Invert on, grow still acts on the white region, so a positive grow hides less.
A shrink wider than the mask would erase it and hide nothing (on a face-hide, the face goes straight to the next model). The run checks for that and fails with "grow -N erases the mask" when a shrink leaves none, or under 5%, of the mask; use a smaller shrink. With Invert on, a grow that covers the whole frame fails the same way.
That check looks at only three frames (a quarter, half and three quarters into the clip) and counts the whole mask, not each subject. So a shrink can still uncover a subject that is small only between those frames (after a cut to a wide shot), or a small subject next to a big one (a strap beside a body), and the run passes. On a face-hide, keep the shrink well under the face's width and look at the result.
Despeck: specks the grow would turn into squares
A Segment Mask output often carries isolated specks, single pixels a long way from the subject. Grown 40 px, each one becomes a solid square about 80 px across, and the next model paints over it. So before the grow, the mask's separate pieces smaller than Despeck (a percent of the frame) are dropped:
- a new node starts at 0.002% of the frame: about 18 px on a 720x1280 mask, 41 px on 1080x1920. Measured on real Segment Mask outputs, every speck was 1 to 5 px. Real pieces were almost all over 50 px; the few smaller ones were finger fragments a few pixels from their hand, which a grow covers anyway;
- blank or 0 keeps every speck. A node added before Despeck existed has it blank, so it runs exactly as it always did; type 0.002 to turn it on;
- raise it only for a mask with bigger junk, and check the card: a real subject smaller than the threshold is dropped too.
A piece is everything connected to it above the mask's black, soft edge included. So anything attached to the subject stays exactly as it was, a 1 px hair strand or a finger included, and a mask with no specks comes through unchanged, pixel for pixel. Faint compression noise in the black counts as specks too and goes with them.
Largest region only keeps just the biggest piece in each frame. Use it on a single-subject swap when the prompt also caught something else (a "head" prompt that found a chef figurine on the counter). It decides frame by frame, so if the subject is ever smaller than the other thing, that frame keeps the wrong one.
The card says what was dropped ("dropped 394 bright specks and 5942 faint flecks, largest 17 px, in 268 of 268 frames"), and how many frames held only pieces that small and now hide nothing.
Only the part of the mask the composite uses (the clip's length) is cleaned. The cleanup takes a share of the run's time and scratch disk; when a long or heavy mask would not fit in what is left, it is skipped, the mask is used as wired, and the card says "SKIPPED" with the reason, rather than failing a run that would have worked without it.
Why the rest of the frame does not change
With Fill the mask itself on, the base is black. The preservation guarantee below applies when compositing over a separate clip.
Video Blend works on the YUV planes, so a mask blended with lighten also
shifts every pixel's colour toward grey (measured: about a 24% saturation drop
over the whole frame). This node never converts the clip. It lays the fill over
the clip in the clip's own 4:2:0 planes, with the mask as the fill's alpha, so a
pixel outside the mask comes out of the composite with the same value it went in
with. The one thing that touches it is the final x264 encode (CRF 18, the same
generation every encode node here costs). Measured on a test clip: mean
difference 0.40 code values outside the mask, against 0.31 for re-encoding the
clip with no composite at all, and no colour shift (saturation ratio 1.000).
Before calling a run done, the node checks its own output: the length must match the clip's within a frame, and three sampled frames must show the fill wherever the region had to change. Pixels where the clip already showed the fill (a second composite with the same take, say) are not counted either way. A run that fails either check is an error, never a clip passed on as masked.
The mask is cleaned up before it is used: anything at or below 12% grey counts as outside, anything at or above 88% as fully inside, so compression noise in a black mask never bleeds into the frame. Invert hides everything except the region.
Sizes, frame rates and lengths
The output always has the clip's size, frames and length, and its audio is copied untouched.
- A phone clip recorded in portrait (stored sideways with a rotation flag) is used upright, and so is its mask; the output is upright with no rotation flag.
- The mask is scaled to the clip. A mask with a different shape as displayed (more than 2% off) is refused, because it was made from a different video and would not line up.
- A mask shorter than the clip is refused rather than holding its last frame, which would uncover the region for the rest of the clip. A longer one is cut.
- The fill video is scaled to cover the clip and centre-cropped. A shorter fill holds its last frame; a longer one is cut.
- Each frame of the clip uses the mask frame at the same moment, so a mask at a different frame rate still lines up, and so does a clip whose file does not start at zero (.ts recordings, trimmed exports).
Limits
Clips over 30 seconds are refused (cut first with Video Trim), as are HDR clips and inputs over 500 MB. Every adaptation the node made (scaling, a held frame) is listed on the card after the run.
This node is free: it quotes and charges 0 credits.
Auto-generated from the Wireflow node registry.