Security cameras


sgjava
 Share

4 4

Recommended Posts

I've built my own security cameras for about 8 years (using computer vision, ML, etc.), but now I want to do something off the shelf so to speak. I just wired my attic to my office with cat 6 cable and my house is wired with cat5e, More than likely the cameras will be plugged directly into the SBC from the attic via PoE. My question is which SBC would be able to handle hardware H265 decoding using 4K cameras at 30 fps? That's about 27 Mbps per camera times 4 cameras. iperf test from my attic showed 961 Mbps using ODroid XU4. So my questions are:

  • Which SBC can handle H265 hardware decoding of four 4K cameras?
  • I want to have 2 1Gbps ports, so I can have cameras on different network from my primary network.
  • What software do you use for security/DVR?

 

Thank you for suggestions.

 

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

OK, so if you know me I don't wait around for answers. I took an old h264 camera Edimax Triple Mode Plug-n-View Internet IP Camera Supports PoE Function 1.3MP H.264 Mode and E-Cloud Technologynology (IC-3100P) updated the firmware and loaded up an Odroid XU4 since ffmpeg uses hardware encode/decode out of the box. The trick is to not decode/encode the stream and save to a mkv container. 1280x1024 @ 15 fps uses < 2% cpu. What I can do is use the MJPEG stream at like 3 FPS for motion and computer vision processing. I didn't want to code anything, so I'll start looking at security software next. The ffmpeg command I used was:

fmpeg -i rtsp://hostname:554/ipcam_h264.sdp -frames:v 200 -acodec copy -vcodec copy test.mkv

 

I also tested decoding/encoding a 2K video which used ~30% CPU

Link to post
Share on other sites

Have you seen the PineCube that's in development?  I have no idea how it compares to those specs, just throwing it out there as I have become quite enamored with Pine64 as of late.

 

Historically / currently, I have been using the little Wyze / Xiaomi IP cameras, re-flashing them with Xiaomi Dafang Hacks.  I noticed recently you can even find them in Home Depot these days (Wyze ones) for only $20-30(!).

 

Of course, if you are bound and determined to roll your own, there will be no stopping you, and I shall stand aside...  :D

Link to post
Share on other sites

I'll post a link later where various Linux compatible software was evaluated. I found a Java ffmpeg wrapper. I have built this stuff from scratch before and all these packages suck at the core functions. Health checks, etc. needs to be done, etc.

Link to post
Share on other sites

This is a good review of security software for Linux https://blog.jasonantman.com/2018/05/linux-surveillance-camera-software-evaluation. The funny thing is this guy went with Motion which is terrible and the reason I wrote https://github.com/sgjava/motiondetector. This time however I'm probably going down the Java route as I have a lot of the pieces already written in another project. I want intelligent motion detection, object classification (CV), etc. The core stuff is most important. The viewer, etc. is not really that important at this point.

 

Any ways, I'm playing with https://github.com/kokorin/Jaffree since XU4 has hardware encoding/decoding built in ffmpeg (other Armbian supported boards do too). OpenCV can also use ffmpeg. Like I mentioned above the trick is not to decode/encode the camera stream from H264. On another thread I'd read an MJPEG stream at 3 FPS which is low bandwidth to decode into numpy array OpenCV can deal with. That's where you do the motion detection, pedestrian detection, etc. Once a threshold is met then you use ffmpeg to save the stream to a MKV container.

 

At this point I'm just playing around with different libraries, but it would have been nice to get something that's not ancient like Motion and ZoneMinder or newer stuff that cannot handle motion/object detection in a decent manner.

Link to post
Share on other sites

On 2/20/2021 at 5:36 PM, sgjava said:

went with Motion which is terrible

I would like to have audio too (a bird cam), but if you only want picture and don't mind using RPi and the corresponding camera (no audio)https://github.com/kclyu/rpi-webrtc-streamer  

Motion Detection feature provided by Rpi-WebRTC-Streamer uses Inline Motion Vector which is generated during video encoding. And use this to get the approximate Motion Detection function while using minimal CPU resources.

I spent hours trying to get a Logitech c310 USB UVC compatible camera running, but UVC helps, but is not the solution to everything. IP-Camera may help or solve a lot?

 

or the original: https://github.com/mpromonet/webrtc-streamer   almost at the end of the readme.md: Object detection using tensorflow.js

 

Where are you with your project by now?

Link to post
Share on other sites

So I have two 4K @ 12 FPS cameras that stream to a buffer file. Currently I'm only doing motion detection, but that drives everything else obviously detection wise. On an Odroid XU4 each camera uses only 10%. Motion videos are just copied from the buffer file. I'm using H265+ without any transcoding. So far so good. Not quite ready to post up to github yet though. I doubt you get better CPU utilization than this. I'm using the substream at 4 FPS 640x480 for motion detection.

One other thing to note is I proxy mjpeg and h265+ streams, so for cameras that only allow one stream you can have security software running and still stream live. I'm using PoE cameras and will have six 4K cameras running soon. So in essence you can build a cheap NVR without the hardware requirements of Blue Iris etal or just build a single smart camera. Armbian allows hardware encoding with ffmpeg on some models, so you can even encode USB cams with low overhead.

Link to post
Share on other sites

OK, so I have things dialed in a bit better now. FFMPEG seems to like TCP over UDP for these streams. I'm seeing a lot less artifacts in the videos. Below is 12 hours of network and CPU activity for 3 4K cams at 12.5 FPS and 1 4K cam at 15 FPS (four 4K cams total) at highest quality. CPU seems to max out around 10% per camera and network maxes out around 45 mb total. I'm using a 1G PoE switch, so the bandwidth will never be an issue. The question then becomes how much more real-time processing can I do. CV routines are typically expensive even though I've learned tricks using ROI (region of interest). This isn't as much of a problem with a single camera, but I'm planning on six cameras. Obviously the most important thing for me now is to capture motion videos.

 

Once the bread and butter stuff is done then I can look at adding various detection code (besides motion). The question becomes do I want real-time detection or perhaps offload that to another SBC. The fact that I can record this many 4K cameras with an Odroid XU4 is pretty amazing. Look at Blue Iris requirements https://ipcamtalk.com/wiki/choosing-hardware-for-blue-iris/ and this really doesn't cover electrical costs and heat dissipation. I'm working on a Pine 64 today with USB cam, so I'll test single camera encoding. Basically the code will scale to many cameras or a single camera.

chart2.png

chart2 (1).png

 

chart3.png

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

4 4