Will Raspberry Pi handle motion detection on 8 IP cameras?

Hi!

I have 8 APTI IP cameras with 2-3 Mpx resolution and working with APTI NVR (everything wired with ethernet cables). Software which is installed on the NVR has motion detection option, but it works really poor and i have many false notifications while there is no movement or lack of notifications while there is a real movement (no matter how i try to configure its sensitivity). Firstly, I was wondering about frigate-hass or something like that to detect people/cars etc, but it would require really hardware… :confused: But is there a possibility to connect cameras to HA and just handle motion detection onboard of Rasbperry Pi? I don’t want HA to save videos, because NVR will do it continuosly, but snapshots with notifications would be great. Do you have any experience with that?

Best regards!

Hey, you could use Motion Eye. But without thermal imaging, you will always have false positive. At least that is my experience. I have build some counter logic arround the motion eye alarm, which reduces the false positives…

For 8 cameras ? Forget it.

If you want more or less reliable detection from cameras, then you need to use machine learning. There’s just no way around this. That means using something like Deepstack, Frigate, DOODS, etc. Under the hood they’re all pretty much the same and use a pretrained neural net for person detection. And that is a very performance heavy operation. Using a Pi to do that for a single camera (and without an additional tensor processing unit like the Coral) is bad enough. Doing it for 8 is impossible.

So either switch to more powerful hardware or rely on a different motion detection technology (PIRs, radar, lidar, etc).

1 Like

Do you have any idea which more powerful hardware (with Coral usb accelerator of course) can handle 8 IP cameras?

Will Raspberry Pi 4 handle 8 stream previews (it doesn’t have to be simultaneously) with (dumb) motion detection?

I would go with a decent spec’ed PC.

Alternatively you could use cameras with builtin AI person detection. Some of them are pretty good, but that would imply replacing all your current ones.

First off you will have to find out if these cameras are supported by ha? First step would be to get an rtsp or onvif stream into ha. ONVIF compliant cameras don’t always work.

I have an old mac mini running Ubuntu, which has a Shinobi NVR with two Foscam G2 cameras. It also is running Home Assistant and several other things.

https://shinobi.video/

The cameras support rtsp. Shinobi records all the time 24/7 to an attached 2TB hard drive.

The cameras can be easily integrated into Home Assistant - Foscam - Home Assistant They also have built in person detection that can be triggered to turn on and off through home assistant with the camera.enable_motion_detection service. Its honestly pretty good with not that many false alarms.

To create a motion detection sensor, I made an input boolean for motion and then I set that up with Node Red to respond to an FTP image being uploaded from the camera to Node red. (The Foscam G2 can upload to an FTP server when motion is detected).

[{"id":"96351be4fc5ac315","type":"ftp-server","z":"97c95af8.85266","name":"Porch","ip":"192.168.0.131","port":"6021","passiveportrange":"","credentials":{},"x":130,"y":740,"wires":[["e2d6d8dc5dd52c63"],[]]},{"id":"e2d6d8dc5dd52c63","type":"delay","z":"97c95af8.85266","name":"Every 5","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":300,"y":740,"wires":[["4d55e04f8ab7b94a"]]},{"id":"4d55e04f8ab7b94a","type":"api-call-service","z":"97c95af8.85266","name":"Motion On","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.porch_motion","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":740,"wires":[["4edae01df738a73f"]]},{"id":"4edae01df738a73f","type":"stoptimer","z":"97c95af8.85266","duration":"45","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":690,"y":740,"wires":[["30a6ad9eb4cafd73"],[]]},{"id":"30a6ad9eb4cafd73","type":"api-call-service","z":"97c95af8.85266","name":"Motion Off","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.porch_motion","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":740,"wires":[[]]},{"id":"ae531ce.a39906","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

This works pretty well, and CPU usage is minimal with everything running. I’m sure I could easily add more cameras.

Screenshot from 2021-08-31 20-00-51

I have a spare one but it has around 500W power supply and that’s a lot of money to pay for the electricity :frowning:

That doesn’t mean it will suck 500W continuously out of your power line. Power usage very much depends on the load of the machine behind the power supply.

Regarding your IP cams I once tried MotionEye on the RPI4 with 8 Cams. CPU-load went up from <20% to >97%. As @HeyImAlex already wrote: Better forget it on a RPI4.

As Tamsy mentioned, it won’t use that much in practice. But it’s a performance demanding task you’re asking for.

If electricity use is of concern, you may want to think about doing this differently. Don’t do continuous person detection on all cameras 24/7. Install some PIR sensors next to the cameras. When a PIR triggers, then get one or several still image shots from the affected camera(s) and run a ML model on them to confirm that the motion was indeed from a person. Hybrid on-demand approaches like that will dramatically lower the performance needed and may even work on a Pi if there’s not too much motion around each camera.