Motion and audio detection
Every camera can raise events when something moves in the picture or when its microphone picks up a loud sound. This page explains how both detectors work, what each per-camera setting does, how to paint zones that motion ignores, and how to keep false alarms down.
Motion detection needs no extra software and no model download. It is the trigger everything else builds on: object recognition looks at cameras while they move, notifications and automations react to the events it opens, and Motion only recording keeps footage around them (see Recording).
Turn it on for a camera
Section titled “Turn it on for a camera”- Open Devices, select the camera and switch to its Settings tab. (In Playback, administrators can also use the Camera settings button in the player controls.)
- In the Detection group, switch Motion detection on. It is on by default for new cameras.
- Choose a Sensitivity and adjust the timing fields if you need to (see Settings).
- Select Save changes.
- Optionally select Edit motion zones to paint the areas motion should ignore (see Motion zones).
When the camera’s Recording mode is Motion only, motion detection is always on: that mode needs the trigger, so the switch cannot be turned off. When the recording mode is Off, the camera raises no motion events.
With Motion detection off, a camera in 24/7 continuous or Scheduled mode still records as usual. It raises no motion events, and object recognition does not look at it.
How motion is detected
Section titled “How motion is detected”For each camera with motion detection on, Aperture runs one small ffmpeg process that decodes the camera’s stream, shrinks every picture to 64 × 36 pixels in grayscale and hands five of them a second to the detector (internal/motion).
- If the camera has a Sub stream, motion is watched on it. Otherwise the main stream is decoded. Add a sub stream when the camera offers one; see CPU cost.
- Each pair of consecutive pictures is compared pixel by pixel. A pixel counts as changed when its brightness moved by more than 24 out of 255.
- Pixels inside painted motion zones are skipped.
- The changed pixels are counted as a fraction of the pixels being watched. When that fraction is above the camera’s Sensitivity threshold, the picture is a motion frame.
The first motion frame opens an event. The event stays open while motion frames keep arriving, and closes once none has arrived for the Cooldown. A long, continuous movement is one long event, not many short ones.
Each event also stores which parts of the picture moved, on a coarser 32 × 18 grid. Grid search in Playback uses it.
While a camera sees motion, its live picture gets a thin white outline (it lingers about 1.5 seconds after the last motion frame). The outline shows whether or not object recognition is on.
Settings
Section titled “Settings”All of these are in the camera’s Detection group and apply to that camera only.
| Setting | Default | What it does |
|---|---|---|
| Sensitivity | Medium | How much of the picture has to change for a motion frame. See the table below. |
| Ignore blips under (s) | 0 (off) | Deletes events whose motion lasted less than this, once they close. See the note below the table. |
| Pre-roll (s) | 5 | How far before the first motion frame the event starts. |
| Post-roll (s) | 5 | How long after the last motion frame the event ends. |
| Cooldown (s) | 5 | How long without motion before the event closes. Motion within this gap continues the same event. Minimum 1. |
| Object recognition | Same as Settings | Whether object recognition looks at this camera while it moves. |
Sensitivity maps to the fraction of watched pixels that must change between two pictures:
| Sensitivity | Threshold |
|---|---|
| Low | more than 6 % |
| Medium-low | more than 3 % |
| Medium | more than 2 % |
| High | more than 1.2 % |
| Very high | more than 0.6 % |
The fraction counts only the pixels you have not masked. If you paint half the picture as ignored, the same person walking through the other half makes up twice the fraction, so a masked camera reacts more readily at the same setting.
Pre-roll and post-roll set the event’s start and end time, which is what the timeline, the Alarms page and Motion only retention use. A value of 0 falls back to the default of 5 seconds.
Changes to sensitivity and zones restart the camera’s motion detector. Changes to pre-roll, post-roll, cooldown and the blip filter apply from the next event.
Motion zones
Section titled “Motion zones”Motion zones are areas of the picture that motion detection ignores: a tree that sways, a road with passing cars, a neighbour’s window, a clock on the wall.
- Save the camera first; zones can only be painted on a saved camera.
- In the camera’s Detection group, select Edit motion zones. A current snapshot opens with a 32 × 18 grid over it.
- With Ignore selected, drag over the areas to ignore. Painted cells turn red. On a phone or tablet, drag with your finger.
- To take cells back, choose Erase and drag over them. Clear removes all painted cells. The counter shows how many cells are ignored.
- Select Save zones. The camera’s motion detector restarts with the new mask straight away.
What zones change:
- Motion inside an ignored area never opens an event and never counts towards the threshold.
- Object recognition only boxes things that move in a watched area. Someone who stays entirely inside an ignored area is boxed only when the model is unusually sure of them, and a car driving only through an ignored area is not boxed at all.
The editor’s snapshot comes from the main stream, while motion is watched on the sub stream when there is one. Most cameras show the same framing on both. If your sub stream is cropped differently, the painted cells will not line up with what the detector sees.
Find motion in one area
Section titled “Find motion in one area”In Playback, the Grid search (motion area) button (single-camera view only) lets you drag a rectangle over the picture and select Apply. The timeline markers and the event list then show only events whose motion touched that rectangle. To remove the filter, open it again, select Clear area and then Apply.
Grid search works on the motion map stored with each motion event. Audio and package events have no motion map, so they disappear from the list while an area is drawn.
Audio detection
Section titled “Audio detection”Audio detection raises an audio event when a camera’s sound gets loud. It needs a camera with a microphone and an audio track in its stream. It is off by default and independent of motion detection.
- In the camera’s Detection group, switch Audio detection on.
- Set the Threshold slider, or leave it at default.
- Select Save changes.
How it works (internal/audio): a separate ffmpeg process per camera decodes the main stream’s audio to 8 kHz mono and measures its loudness (the RMS level) in windows of 0.2 seconds. A window louder than the threshold opens an event, or continues the open one.
| Setting | Value |
|---|---|
| Threshold | 0 to 30 % of full scale. 0 means the default of 6 %. Move it right (Only loud sounds) for fewer events. |
| Pre-roll | 3 seconds (fixed) |
| Post-roll | 4 seconds (fixed) |
| Cooldown | 4 seconds of quiet closes the event (fixed) |
Things to know:
- It measures loudness only. It does not tell a bark from breaking glass or a car door; anything loud enough counts.
- The level is what the camera delivers after its own microphone gain. Cameras differ a lot, so start at the default, watch the Alarms page for a day, and adjust.
- Audio events get a snapshot as their picture, appear on the timeline and in Alarms (filter Audio), and trigger notifications, webhooks and automations like motion events. Object recognition does not run on them.
- Like motion, audio detection does not run while the camera’s Recording mode is Off.
- If the stream has no audio track, the detector keeps failing and retrying in the background (with a growing pause, up to 30 seconds) and no audio events appear.
Tuning tips
Section titled “Tuning tips”Start at Medium, leave it for a day, then look at the Alarms page and adjust one thing at a time.
- Trees, bushes, flags. Paint them as motion zones. If wind still sets off the camera, lower the sensitivity one step.
- A road or pavement you don’t care about. Paint it out. Remember that a masked camera reacts more readily (see Settings), so check the sensitivity afterwards.
- Rain, snow and insects at night. Drops and insects lit by the camera’s infrared light change many small spots at once. Raise Ignore blips under (s) to 1 or 2 seconds so short flurries are dropped, and use object recognition with notification rules that require a person or vehicle. Rules can also use Only when raining (see Notifications).
- Infrared switching at dusk and dawn. When the camera switches between colour and night mode, the whole picture changes at once and one event opens. This is expected; it is a single event, not a storm of them.
- Headlights and shadows. Light sweeping across a wall or driveway changes large areas. Paint out areas that only ever see light, not people. With object recognition, a parked car that headlights sweep over is not boxed, because it did not move itself.
- Too few events. Raise the sensitivity a step and check that the area is not painted out.
- One event per visit instead of several. Raise Cooldown (s) so short pauses (someone stopping at the door) continue the same event.
CPU cost
Section titled “CPU cost”Motion detection decodes each camera’s video, and decoding is where the CPU goes. The 64 × 36 comparison itself costs next to nothing.
- On a sub stream, decoding is light. On a 4K H.265 main stream it can take more than one CPU core and around half a gigabyte of memory per camera, so give every camera a sub stream when it has one.
- Each detector’s ffmpeg uses at most two threads.
- When object recognition watches a camera, the same ffmpeg also produces the colour pictures it needs, so recognition adds no second decode.
- Audio detection is a separate, small process per camera that decodes audio only.
The capacity page shows how many cameras your hardware can handle with these settings.
Troubleshooting
Section titled “Troubleshooting”- No motion events at all. Check that Motion detection is on, the Recording mode is not Off, the camera is online, and the area is not painted out. The camera’s Overview tab in Devices shows whether motion and audio detection are on.
- Events every few seconds all day. Lower the sensitivity, paint out moving foliage, and check for a flickering light or a camera that refocuses constantly.
- The white outline appears but no event. The outline also shows on cameras that are watched for the live view only (recording Off with object recognition on); those create no events.
- Audio detection never fires. Confirm the camera actually sends audio (play its stream in VLC), then lower the threshold.
Related: Object recognition · Notifications · Alarms · Recording