Remove Unnecessary Mask Keyframes is an After Effects script by nab for reducing the every-frame keyframes created by the built-in mask tracker. It compares neighboring mask keys and removes ones whose vertices stay within a specified similarity threshold.

How the two passes work

The removal pass compares each keyframe with its predecessor. Two keys count as similar when none of the mask vertices has moved farther than the removal threshold, so the later key is removed.

A reinforcement pass then checks each successive pair of remaining keys. If any vertex has moved more than the reinforcement threshold, the script restores a previously removed keyframe halfway between that pair. It repeats this check until each pair meets the condition. This second pass limits the movement between retained keys after the initial reduction.

When it helps

Use the script to simplify a mask animation after tracking when the tracker's frame-by-frame keys leave a dense sequence to inspect or edit. Its documented purpose is specifically to process keys generated by After Effects' built-in mask tracker; the listing does not describe it as a general-purpose keyframe cleanup tool.

The removal and reinforcement thresholds control different parts of the process: one determines which neighboring keys are similar enough to remove, and the other determines when a removed key must be restored between the remaining keys. After processing, review the mask through the shot to confirm the reduced sequence still suits the movement in your footage.