Motion Detection

Detects scene and camera motion in the video stream.

Overview

The Motion detection node detects camera and/or scene motion in the video, adds motion detection metadata to the frame metadata, and can drop frames when there is no motion to reduce downstream processing. This node makes it easy to build use cases such as motion triggered recordings, or to reduce downstream processing when there is no motion.

Inputs & Outputs

  • Inputs : 1, Media Format : Raw Video
  • Outputs : 1, Media Format: Raw Video
  • Output Metadata : MOtion Information

Properties

PropertyDescriptionTypeDefaultRequired
detect_camera_motionDetects camera view changing (such as pan/tilt/zoom).boolfalseNo
detect_scene_motionDetects motion in the scene, optionally within specified regions of interest.booltrueNo
roi_labelsRegions of interest labelsstringNo
roisOptional ROIs for scene motion detection. If defined, motion is only detected within these regions. Leave empty to detect motion in the full frame. Conditional on roi_labels. Format: comma-separated normalized x,y coordinate pairs; separate multiple polygons with semicolons (for example, 0.1,0.1,0.9,0.1,0.9,0.9).stringnullNo
sensitivityHigher sensitivity will detect smaller motions. Range: minimum 0, maximum 100. Step: 1.integer50No
displayDisplay motion detection state on video?booltrueNo
display_roisDisplay ROI polygons on video?booltrueNo
drop_frames_without_motionDrop frames without motion?boolfalseNo
processing_intervalDetect motion every nth frame. Higher values reduce processing load but delay detection. Leave empty to set automatically. Range: minimum 1, maximum 30. Step: 1. Unit: frames.integer1No
reference_intervalUpdate reference every nth frame. Higher values help detect slow movements better. Leave empty to set automatically. Range: minimum 2, maximum 30. Step: 1. Unit: frames.integernullNo
no_motion_intervalDeclare motion stopped after n seconds without motion. Leave empty to set automatically. Unit: seconds.numbernullNo
processing_resolutionProcessing resolution. Options: Medium (medium); Small (small).enummediumNo
thread_numberNumber of threads to use in parallel processing.numbernullNo
debugDebug modeboolfalseNo

Output Metadata

The fields below are declared by this node's metadata schema; the JSON values are representative examples.

PathTypeDescription
nodes.<node_id>.rois.fullframe.motion_deltabooleantrue when pixel motion starts or stops
nodes.<node_id>.rois.fullframe.motionbooleantrue while pixel motion is being detected
nodes.<node_id>.rois.fullframe.motion_scoreintegerCurrent measured amount of motion. A number between 0 and 1 that indicates the extent of detected scene motion. Larger number means higher amount of motion.
nodes.<node_id>.rois.fullframe.motion_durationintegerTime in seconds that motion has remained active, when motion is True. -1 if motion is False
nodes.<node_id>.rois.fullframe.time_since_motion_stoppednumberSeconds elapsed since motion most recently stopped. -1 if motion is currently True.
nodes.<node_id>.rois.camera.motion_deltabooleantrue When camera motion starts or stops
nodes.<node_id>.rois.camera.motionbooleantrue While camera motion is being detected
nodes.<node_id>.rois.camera.motion_scoreintegerCurrent measured amount of motion.
nodes.<node_id>.rois.camera.motion_durationintegerTime in seconds that motion has remained active, when motion is True. -1 if motion is False.
nodes.<node_id>.rois.camera.time_since_motion_stoppednumberSeconds elapsed since motion most recently stopped. -1 if motion is currently True.
nodes.<node_id>.rois.camera.motion_info.pxnumberEstimated horizontal camera translation in pixels.
nodes.<node_id>.rois.camera.motion_info.pynumberEstimated vertical camera translation in pixels.
nodes.<node_id>.rois.camera.motion_info.tnumberEstimated camera rotation in degrees.
nodes.<node_id>.rois.camera.motion_info.znumberEstimated camera zoom factor. Numbers less than 1 imply zoom in, more than 1 imply zoom out.
nodes.<node_id>.rois.<roi_label>.motionbooleanValue of motion.
nodes.<node_id>.rois.<roi_label>.motion_deltabooleanPer-frame change in motion.
nodes.<node_id>.rois.<roi_label>.motion_durationintegerValue of motion duration.
nodes.<node_id>.rois.<roi_label>.motion_info.pxnumberValue of px.
nodes.<node_id>.rois.<roi_label>.motion_info.pynumberValue of py.
nodes.<node_id>.rois.<roi_label>.motion_info.tnumberValue of t.
nodes.<node_id>.rois.<roi_label>.motion_info.znumberValue of z.
nodes.<node_id>.rois.<roi_label>.motion_scoreintegerValue of motion score.
nodes.<node_id>.rois.<roi_label>.time_since_motion_stoppednumberValue of time since motion stopped.
nodes.<node_id>.typestringIdentifies the node type that produced this metadata.

JSON example

{
  "nodes": {
    "annotate_motion1": {
      "rois": {
        "camera": {
          "motion": false,
          "motion_delta": false,
          "motion_duration": 0,
          "motion_info": {
            "px": 0.0,
            "py": 0.0,
            "t": 0.0,
            "z": 0.0
          },
          "motion_score": 0,
          "time_since_motion_stopped": 0.0
        },
        "fullframe": {
          "motion": false,
          "motion_delta": false,
          "motion_duration": 0,
          "motion_score": 0,
          "time_since_motion_stopped": 0.0
        }
      },
      "type": "annotate_motion"
    }
  }
}

Did this page help you?