> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/developer-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/developer-documentation/platform/sources-and-options/options/motion-detection.md).

# Motion Detection

Pause inference while the scene is still

On a camera that is mostly watching nothing happen, motion detection pauses inference until the scene changes. Frames are divided into a grid of cells; a cell counts as moved when enough of its pixels change, and the source counts as moving when enough cells have moved.

| Field               | Meaning                                                   | Default | Range       |
| ------------------- | --------------------------------------------------------- | ------- | ----------- |
| `motionDetect`      | Turn motion gating on                                     | `false` | —           |
| `motionSensitivity` | How readily a cell counts as moved                        | `0.5`   | `0.0`–`1.0` |
| `motionThreshold`   | Fraction of cells that must have moved to count as motion | `0.01`  | `0.0`–`1.0` |
| `motionGap`         | Seconds of stillness before motion is considered over     | `1`     | `1`–`60`    |
| `motionGridX`       | Grid cells across                                         | `10`    | `8`–`32`    |
| `motionGridY`       | Grid cells down                                           | `10`    | `8`–`32`    |

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import MotionDetectConfig

job = endpoint.load_from(
    "rtsp://camera.example.com/stream1",
    motion_detect=MotionDetectConfig(
        motionDetect=True,
        motionSensitivity=0.6,
        motionGap=5,
    ),
)
```

{% endtab %}

{% tab title="Node" %}

```typescript
const results = await endpoint.process({
    source: { url: 'rtsp://camera.example.com/stream1' },
    motionDetect: {
        motionDetect: true,
        motionSensitivity: 0.6,
        motionGap: 5,
    },
})
```

{% endtab %}
{% endtabs %}

Raising `motionGap` keeps inference running through short pauses — someone standing still mid-frame — at the cost of processing more quiet frames. It is the only control over the end of motion: the same value decides when motion counts as finished and when the stillness is reported, with no way to set the two apart. At the start of motion there is no knob at all — movement has to show up in two consecutive frames before it counts, so a single-frame flicker does not wake the source. Motion detection composes with `fps`: gate on motion, then throttle what gets through.
