Video Helper Suite πŸŽ₯πŸ…₯πŸ…—πŸ…’/maskgenerated

Select Every Nth Mask πŸŽ₯πŸ…₯πŸ…—πŸ…’(SelectEveryNthMask)

This node takes a tensor representing multi-frame masks as input, skips a specified number of masks at the beginning via the `skip_first_masks` parameter, then selects one mask every N masks based on the interval (N) set by the `select_every_nth` parameter, and finally outputs a new mask sequence.

Select Every Nth Mask

mask
MASK
count
select_every_nth
INT
skip_first_masks
INT
VideoHelperSuite

The Select Every Nth Mask πŸŽ₯πŸ…₯πŸ…—πŸ…’ node receives a tensor representing multi-frame masks as input. It skips a specified number of masks at the beginning via the skip_first_masks parameter, then selects one mask every N masks according to the interval (N) set by the select_every_nth parameter, ultimately outputting a new mask sequence.

The Select Every Nth Mask node is a filtering tool for processing mask sequences. Its core function is to selectively extract specific masks from an input series of masks according to a specified interval rule, thereby creating a new, sparser mask sequence. This node is primarily used to streamline or resample mask data.

Node Function

This node receives a tensor representing multi-frame masks as input. It skips a specified number of masks at the beginning via the skip_first_masks parameter, then selects one mask every N masks according to the interval (N) set by the select_every_nth parameter, ultimately outputting a new mask sequence. Its technical implementation is based on Python's tensor slicing operations, enabling efficient processing of mask sequences of any length and returning the count of filtered masks.

Node Parameter Description - Select Every Nth Mask πŸŽ₯πŸ…₯πŸ…—πŸ…’

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
maskMASKYes--mask (Input Parameter): The input multi-frame mask sequence, of type MASK. This is the original data source to be filtered.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
select_every_nthINTYes11 - BIGMAX (Step: 1), with a step size of 1.
skip_first_masksINTYes00 - BIGMAX (Step: 1), with a step size of 1.

Output

Parameter NameData TypeDescription
MASKMASKMASK (Output Parameter): The output new mask sequence obtained after filtering.
countINTcount (Output Parameter): The total number of masks contained in the output new mask sequence after filtering.

Usage Scenarios

This node is very useful in video processing workflows. For example, when you have a high-frame-rate video mask sequence but only need to apply effects to every few frames, you can use this node to quickly extract the masks of the target frames. The result can then be passed to subsequent compositing or special effects nodes, thereby saving computational resources and controlling the processing pace.

Notes

When using this node, note that the input mask parameter must be a tensor containing multi-frame masks. The values of select_every_nth and skip_first_masks should be set to ensure the output is not an empty sequence; that is, the number of skipped masks must not be greater than or equal to the total number of input masks.

The Select Every Nth Mask πŸŽ₯πŸ…₯πŸ…—πŸ…’ node is from the ComfyUI-VideoHelperSuite node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…