Motion Detect

Motion Detect operator properties for Script Engine. Detects movement and changes between frames and reports a motion level that scripts can react to. Useful for security and surveillance triggers, automating cuts when the talent moves into frame, driving heat-map graphics that show where action is happening, suppressing recording when the scene is static, or starting and stopping downstream effects based on activity in the picture. Comes with several visualisation modes (motion-only, threshold mask, alpha, overlay, colour difference) and an optional detection mode that exposes a MotionDetected flag and current MotionLevel, and can call a script function when motion starts and when it has ended.

Property Type Access Description
Sensitivity int get/set Overall sensitivity to motion. [min=1, max=20, default=5]. Higher values amplify small frame-to-frame differences so subtler movements register. Increase if the operator misses real motion; decrease if it picks up camera noise or sensor grain.
Threshold int get/set Cutoff level used by the threshold-mask visualisation. [min=0, max=100, default=10]. Only motion above this level appears as white in Threshold Mask mode. Lower means more permissive.
Method MotionMethod get/set How motion strength is measured. [default=Luminance]. Luminance reacts to brightness changes only and is least noisy. Max Channel takes the strongest of the red/green/blue differences — good for catching coloured movement on a similarly-bright background. RGB Magnitude is the most colour-sensitive and the most reactive overall.
Decay int get/set How long motion persists in the visualisation, as a percentage. [min=0, max=100, default=0]. 0 shows only the current frame's motion. Higher values fade older motion out slowly, producing trails or a heat-map look.
Output MotionOutputMode get/set Visualisation mode for the output image. [default=Motion Only]. Motion Only shows greyscale motion strength. Threshold Mask shows a hard black/white mask using Threshold. Motion as Alpha keeps the original picture but ties opacity to motion. Overlay tints moving areas with the configured overlay colour. Color Difference shows the direction of change. Pass-through leaves the picture unchanged, for an operator that is there only to detect motion; detection works the same in every mode.
OverlayRed int get/set Red component of the overlay tint. [min=0, max=255, default=0]. Only used when Output is set to Overlay.
OverlayGreen int get/set Green component of the overlay tint. [min=0, max=255, default=255]. Only used when Output is set to Overlay.
OverlayBlue int get/set Blue component of the overlay tint. [min=0, max=255, default=0]. Only used when Output is set to Overlay.
OverlayOpacity int get/set Strength of the overlay tint. [min=0, max=100, default=80]. 0 hides the overlay entirely; 100 paints moving regions with full overlay colour.
EnableDetection bool get/set Turn the detection trigger on or off. [default=false]. When on, MotionDetected and MotionLevel update each frame so scripts can react. When off, both stay at zero/false.
DetectionThreshold int get/set Motion level (0–100) required for MotionDetected to become true. [min=1, max=100, default=20]. Lower for more sensitive triggers (good in low-action settings); higher to ignore minor activity.
Grid DetectionGrid get/set How densely the image is sampled when checking for motion. [default=Normal (16x16)]. Fast (8x8) is cheapest and may miss small movements. Normal balances cost and coverage. Accurate (32x32) and Precise (64x64) catch finer motion at the cost of extra processing.
SkipFrames int get/set Frames skipped between detection checks. [min=0, max=30, default=0]. 0 checks every frame and is the most responsive. Higher values reduce processing cost when motion only needs to be sampled occasionally (for example, monitoring an empty room).
MotionDetected bool get True when current motion exceeds DetectionThreshold (read-only). The main trigger flag for scripts. Stays false when EnableDetection is off.
MotionLevel int get Current motion intensity, 0–100 (read-only). The strongest motion strength found in the current frame. Use this for proportional reactions, for example fading a graphic in based on activity level.
LastDetectionAgeSeconds int get Whole seconds since motion was last detected (read-only). Goes back to 0 each time motion is detected and counts up by one every second after that, so 5 means no motion for the last 5 seconds. Until the first motion it counts from when detection started running. Stays 0 when EnableDetection is off.
MaxDetectionAgeSeconds int get/set Seconds without motion that still count as motion. [min=1, default=2]. Motion has ended once LastDetectionAgeSeconds is above this, so at the default 2 the function named in MotionToggleCallback is called with false when Last detection age (s) reaches 3.
MotionToggleCallback string get/set Name of a script function to call when motion starts and when it has ended. [default=empty]. It is given one boolean, true or false, so if (isMotion) works: true at the first motion detected, and false once LastDetectionAgeSeconds is above MaxDetectionAgeSeconds, or when EnableDetection is turned off while motion is on, so while the project runs a true is followed by a false. Nothing is called while the operator is off or its layer is not rendered, nor when the project stops. Each run starts with no motion, and a change made while the script is still loading is given to the function once the script runs. It is called while the frame renders, so keep it short. Leave empty to call nothing.
ClearHistoryCmd Command get Clear the motion history/heat-map so the next frame starts fresh. Useful after a cut, a camera move, or any time accumulated trails are no longer wanted.
ResetCmd Command get Reset all settings to their defaults (sensitivity, thresholds, output mode, overlay colour, detection options).
Minilog FormattedMessage get/set Diagnostic message from the operator (read-only). Reports info, warnings and errors such as detection failures or output-mode changes from keyboard shortcuts.

Inherits from: AbstractOperator, AbstractAudioMetering, NamedModel.

See also: Motion Detect in Operators — user-facing introduction, screenshots, and section summaries.