Motion-detect one camera / stream, but record another?

Richard
edited September 2015 in SecuritySpy
I may have asked this before, if so I apologize...

I'd like to have SecuritySpy work with a low-resolution stream while it is looking for motion, but record using the highest-resolution stream once motion is detected.

If this isn't possible with a native feature, could I do either of the following alternatives?

(1) set up the second stream as a separate "device" with motion detection turned off, and then using scripting or some other means to record from that device when motion is detected on the other one? My license covers up to 4 cameras and I only have 2 at the moment, so I don't think that would be an issue.

(2) Use some external script tied to some other physical device (such as broken beam detector, door sensor, etc.) to "trigger" SecuritySpy's motion detection rather than (or in addition to) the native motion detection?

Related to (2), I'm having a particular problem in my backyard where motion at the rear of the yard (further from the camera) isn't detected, but if I increase the sensitivity, it's too trigger-happy. Being able to use another external stimulus to trigger that camera would help solve that problem.

Comments

  • (To clarify, my Dahua cameras can serve several streams at once, with different resolutions.)
  • I just noticed the "set motion" command in the AppleScript dictionary, are there any particular limitations to this that I should be aware of, particularly if I have one device's "Run script" script trigger another device's motion detection?
  • Hi Richard,

    You have hit upon the solution, which is to use the AppleScript "set motion" command to trigger camera A, and set this script as an action for camera number B. Then, when B detects motion, A will record.

    However, when you have two camera feeds coming in instead of one, this will most likely only increase CPU usage of your Mac, rather than decreasing it, which I assume to be what you want to achieve. SecuritySpy takes the same amount of time to do motion detection on a low-resolution stream as a high-resolution stream (it looks at 2048 pixels spread evenly across the whole frame, so there is the same amount of work to do in all cases).

    Hope this helps.
  • Thanks! That does help.

    I'll be looking into ways to trigger my back yard camera when motion is in the area that is too far away from the camera. Considering one of the following:

    -- Door sensor on the gate (only way in or out) somehow running a script on my Mac.
    -- Cheap IR motion sensor that turns on a light, which should wake SecuritySpy up, at least at night.
    -- A cheaper IP camera that would be scripted to trigger the other one.

    Ideas welcome...

    I'm also hoping to script something to lower the sensitivity levels automatically when it is raining.

    I wonder if it is possible to detect from the raw bitrate of the H.264 stream if there is enough motion to bother with decoding the frame? It wouldn't help if there's constant motion in the excluded areas, but when things are calm, it might be a good pre-filter.
  • Hi Richard,

    The motion-sensor-with-light idea is a good one - as well as triggering SecuritySpy's recording, this should also deter potential intruders. Just make sure that the light doesn't illuminate the whole scene, but rather is focussed on the gate, because SecuritySpy is designed to ignore whole-frame lighting changes (which are usually due to cameras adjusting to different lighting conditions, and would otherwise generate lots of false-positive detections).

    As for your idea of monitoring the H.264 bitrate - this will only fluctuate significantly if the camera is employing Variable Bit Rate (VBR) encoding. Many cameras instead use Constant Bit Rate (CBR) encoding, which is designed to keep the bit rate constant. Furthermore, due to temporal encoding, where one frame depends on its neighbours, such a scheme would be rather difficult to implement, as decoding always needs to start on a key frame (I-frame), which are typically several seconds apart.