> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/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/platform/sources-and-options/options/motion-detection.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/platform/sources-and-options/options/motion-detection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
