Category:
MaskEditControl/Video·MaskEditControl/Temporal·MaskEditControl/BBox
VRAM Tier: 1–2 (pure tensor math for BBox/video; optional SAM2 for propagation/temporal)
Ten nodes for video frame handling, mask propagation, temporal interpolation, motion detection, and bounding box manipulation.
Extract a single frame from a video image batch. Single images pass through unchanged.
File: nodes/video_frame_extractor.py
Category: MaskEditControl/Video
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
images |
IMAGE | — | — | Image batch (B,H,W,C). Single images pass through. |
frame_index |
INT | 0 |
0 – 999999 | Frame to extract (0-based). Clamped to batch length. |
mode |
COMBO | first |
specific_frame, first, last, middle |
Frame selection mode |
| Mode | Behavior |
|---|---|
first |
Always frame 0 |
last |
Final frame |
middle |
Middle frame (B//2) |
specific_frame |
Uses frame_index value |
| Output | Type | Description |
|---|---|---|
frame |
IMAGE | Extracted single frame |
total_frames |
INT | Total frames in input batch |
is_video |
BOOLEAN | True if input had B>1 |
Propagate a single-frame mask across all video frames using 5 modes: static copy, optical flow warping, SAM2 video tracking, fade, or linear scaling.
File: nodes/mask_propagate_video.py
Category: MaskEditControl/Video
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
images |
IMAGE | — | — | Video frames (B,H,W,C) |
mask |
MASK | — | — | Source mask (single frame or batch) |
source_frame |
INT | 0 |
0 – 99999 | Frame index where the mask was drawn |
mode |
COMBO | static |
See modes table | Propagation mode |
flow_threshold |
FLOAT | 2.0 |
0.0 – 50.0 | Optical flow magnitude threshold for masking |
fade_start |
FLOAT | 1.0 |
0.0 – 1.0 | Mask opacity at source frame (fade mode) |
fade_end |
FLOAT | 0.0 |
0.0 – 1.0 | Mask opacity at last frame (fade mode) |
bidirectional |
BOOLEAN | true |
— | Propagate both forward and backward from source |
Optional inputs:
| Parameter | Type | Description |
|---|---|---|
sam_model |
SAM_MODEL | SAM2 model for sam2_video mode |
points_json |
STRING | Point prompts for SAM2 video mode |
| Mode | Requires | Description |
|---|---|---|
static |
— | Copy the mask identically to every frame |
optical_flow |
— | Warp mask using frame-to-frame optical flow estimation |
sam2_video |
SAM_MODEL | Run SAM2 video propagation from the annotated frame |
fade |
— | Linearly interpolate mask opacity from fade_start to fade_end |
scale_linear |
— | Linearly scale mask size across frames |
| Output | Type | Description |
|---|---|---|
masks |
MASK | Propagated mask batch (one per frame) |
preview |
IMAGE | Visual preview of propagation |
Interpolate masks between anchor frames using Signed Distance Fields (SDF). Define keyframe masks at specific frame indices, and the node smoothly morphs between them across the full sequence.
File: nodes/temporal_anchor.py
Category: MaskEditControl/Temporal
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
anchor_masks |
MASK | — | — | Mask batch with one mask per anchor frame (A,H,W) |
anchor_frames |
STRING | "0" |
— | Comma-separated frame indices (e.g. "0,10,30"). Count must match masks. |
total_frames |
INT | 30 |
1 – 99999 | Total output frames |
easing |
COMBO | smooth_step |
See easing table | Interpolation easing function |
sdf_iterations |
INT | 64 |
4 – 512, step 4 | SDF diffusion iterations. More = more accurate, slower. |
flow_refinement |
BOOLEAN | false |
— | Enable optical flow refinement. Requires images input. |
Optional: images (IMAGE) — video frames for optical flow estimation
| Easing | Formula | Behavior |
|---|---|---|
linear |
Constant speed | |
ease_in |
Slow start, fast end | |
ease_out |
Fast start, slow end | |
smooth_step |
Hermite S-curve, smooth start and end |
| Output | Type | Description |
|---|---|---|
full_masks |
MASK | Complete mask sequence (total_frames, H, W) |
confidence |
FLOAT (list) | Per-frame confidence values |
info |
STRING | Anchor summary and interpolation stats |
Manually create a bounding box by specifying coordinates.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Default | Range |
|---|---|---|---|
x |
INT | 0 |
0 – 16384 |
y |
INT | 0 |
0 – 16384 |
width |
INT | 128 |
1 – 16384 |
height |
INT | 128 |
1 – 16384 |
| Output | Type | Description |
|---|---|---|
bbox |
BBOX | Bounding box [x, y, w, h] |
bbox_str |
STRING | Human-readable string |
Extract the tightest bounding box from a mask with optional per-axis padding.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
mask |
MASK | — | — | Input mask |
padding |
INT | 0 |
0 – 512 | Uniform padding around detected bbox |
padding_x |
INT | 0 |
0 – 512 | Extra horizontal padding (both sides) |
padding_y |
INT | 0 |
0 – 512 | Extra vertical padding (both sides) |
threshold |
FLOAT | 0.5 |
0.0 – 1.0 | Mask binarization threshold |
| Output | Type | Description |
|---|---|---|
bbox |
BBOX | Detected bounding box |
x |
INT | Left coordinate |
y |
INT | Top coordinate |
width |
INT | Box width |
height |
INT | Box height |
bbox_str |
STRING | Human-readable string |
Convert a bounding box into a rectangular binary mask.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
bbox |
BBOX | — | — | Input bounding box |
image_width |
INT | 512 |
1 – 16384 | Output mask width |
image_height |
INT | 512 |
1 – 16384 | Output mask height |
Optional: reference_image (IMAGE) — automatically sets width/height from image dimensions
| Output | Type | Description |
|---|---|---|
mask |
MASK | Rectangular mask at bbox location |
Pad a bounding box asymmetrically and clamp to image bounds. Negative padding shrinks the box.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
bbox |
BBOX | — | — | Input bounding box |
pad_left |
INT | 0 |
−4096 – 4096 | Left padding (negative = shrink) |
pad_right |
INT | 0 |
−4096 – 4096 | Right padding |
pad_top |
INT | 0 |
−4096 – 4096 | Top padding |
pad_bottom |
INT | 0 |
−4096 – 4096 | Bottom padding |
image_width |
INT | 512 |
1 – 16384 | Clamp boundary width |
image_height |
INT | 512 |
1 – 16384 | Clamp boundary height |
| Output | Type | Description |
|---|---|---|
bbox |
BBOX | Padded bounding box |
bbox_str |
STRING | Human-readable string |
Crop an image (and optionally a mask) to a bounding box region.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Description |
|---|---|---|
image |
IMAGE | Image to crop |
bbox |
BBOX | Crop region |
Optional: mask (MASK) — also crop this mask to the same region
| Output | Type | Description |
|---|---|---|
cropped_image |
IMAGE | Cropped image |
cropped_mask |
MASK | Cropped mask (empty if no mask input) |
bbox |
BBOX | Pass-through of the input bbox |
Smooth bounding-box sequences across video frames using moving-average or exponential smoothing, eliminating jitter in tracked crops.
File: nodes/bbox_nodes.py
Category: MaskEditControl/BBox
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
bboxes |
BBOX | — | — | Batch of bounding boxes (one per frame) |
method |
CHOICE | moving_average |
moving_average · exponential |
Smoothing method |
window_size |
INT | 5 |
1 – 30 | Moving average window (frames) |
alpha |
FLOAT | 0.3 |
0.0 – 1.0 | Exponential smoothing factor (lower = smoother) |
| Output | Type | Description |
|---|---|---|
bboxes |
BBOX | Smoothed bounding boxes |
Per-frame motion detection mask generator with 4 independent methods and camera stabilization. Feed a video batch — get a binary mask highlighting what moved between consecutive frames.
File: nodes/motion_mask_tracker.py
Category: MaskEditControl/Video
| Method | Requires | Description |
|---|---|---|
pixel_diff |
— | Absolute per-pixel brightness change between consecutive frames |
optical_flow |
opencv-python (fallback: torch) |
Dense optical flow magnitude (Farneback or phase correlation) |
background_sub |
— | Static background model from first N frames, foreground = deviation |
histogram_diff |
— | Per-region color histogram L2 distance on NxN grid |
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
images |
IMAGE | — | — | Video batch (B,H,W,C), minimum 2 frames |
camera_compensation |
BOOLEAN | true |
— | Subtract global camera motion before detection |
stabilization_method |
CHOICE | homography |
homography · affine · translation |
Camera alignment method |
detection_mode |
CHOICE | combined |
combined · pixel_diff · optical_flow · background_sub · histogram_diff |
Single method or combined |
pixel_diff_enabled |
BOOLEAN | true |
— | Enable pixel difference (combined mode) |
pixel_diff_threshold |
FLOAT | 0.05 |
0.001 – 1.0 | Pixel intensity change threshold |
flow_enabled |
BOOLEAN | true |
— | Enable optical flow |
flow_threshold |
FLOAT | 1.0 |
0.1 – 50.0 | Flow magnitude threshold (pixels/frame) |
flow_algorithm |
CHOICE | farneback |
farneback · phase_correlation |
Flow estimation algorithm |
bg_sub_enabled |
BOOLEAN | false |
— | Enable background subtraction |
bg_model_frames |
INT | 5 |
1 – 30 | BG model averaging frames |
bg_sub_threshold |
FLOAT | 0.1 |
0.001 – 1.0 | BG model deviation threshold |
hist_enabled |
BOOLEAN | false |
— | Enable histogram difference |
hist_grid_size |
INT | 16 |
4 – 64 | Grid cell count |
hist_threshold |
FLOAT | 0.15 |
0.01 – 1.0 | Histogram distance threshold |
combine_method |
CHOICE | union |
union · intersection |
How to merge enabled methods |
grow_pixels |
FLOAT | 4.0 |
0.0 – 64.0 | Dilate detected regions |
min_region_size |
INT | 100 |
0 – 10000 | Remove noise blobs < N pixels |
temporal_smooth |
BOOLEAN | true |
— | Gaussian smoothing across frames |
| Output | Type | Description |
|---|---|---|
motion_mask |
MASK | Per-frame binary motion mask (B, H, W) |
motion_intensity |
FLOAT | Mean per-frame motion coverage (%) |
info |
STRING | Detailed per-frame logging |
- Selective VFX: Apply effects only to moving regions
- Motion-triggered routing: Use
motion_intensityto switch between static/dynamic processing - Video compositing: Isolate moving subjects from static backgrounds
- Quality control: Detect unexpected motion or camera shake