Frigate CCTV is absolutely amazing reddit / selfhosted ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 14:13 So I've been self-hosting my CCTV for about 3 years now and it's always been... not great First I gave Blue Iris a try which meant I needed a full Windows VM to run it And it worked - it did the job and recorded stuff and it was fairly OK at motion detection, but damn did it eat the CPU and draw a lot of electricity for no real reason A few months later I gave Shinobi CCTV a try in Docker and that's what I've been running since Again, it's mostly fine but the UI is a little clunky and my use case of "24/7 recording that I can easily watch back" was mostly being met, although I had 1 problem By default Shinobi segments video into 15 minute chunks So if someone smashes into my car at 14:45:01 then I can't watch that footage until 15:00 Obviously this is a big flaw, so to get around this I changed the segment size to 1 minute But I have 4 cameras, so this means that over a day I'll now have 5760 clips per day Sifting through those to find some footage is not fun Enter Frigate - I'd tried it before but never really gave it a full chance It's a bit to wrap your head around at first, but once it's up and running it's just a docker-compose.yml for the container and a simple frigate.yml config file The docs are EXTENSIVE and answered almost every question I had But there's 1 extra awesome feature I wasn't originally aware of: OpenVINO OpenVINO is a deep learning model from Intel that apparently runs on my old Broadwell gen Xeon E5-2650v4 CPUs without issue I've turned it on and enabled object detection and I gotta say, WOW, it's very good I can go outside with the dog, walk around for a moment and come back in and it'll pick both of us up no problem So this saved me about £100 seeing as I don't need a Coral compute module (OK I could still get one, but I'm happy for now) And just to top all of this off, Frigate and Reolink cameras generally don't play too nicely mqtt: enabled: false record: enabled: true retain: days: 30 mode: all birdseye: mode: continuous detect: width: 2560 height: 1920 objects: track: - person - bicycle - car - motorcycle - bird - cat - dog detectors: ov: type: openvino device: AUTO model: path: /openvino-model/ssdlite_mobilenet_v2.xml model: width: 300 height: 300 input_tensor: nhwc input_pixel_format: bgr labelmap_path: /openvino-model/coco_91cl_bkgr.txt cameras: c1-side: ffmpeg: inputs: - path: http://10.10.8.11/flv?port=1935&app=bcs&stream=cha nnel0_main.bcs&user=admin&password={FRIGATE_C1_PASS} input_args: preset-http-reolink roles: - record - path: http://10.10.8.11/flv?port=1935&app=bcs&stream=cha nnel0_sub.bcs&user=admin&password={FRIGATE_C1_PASS} input_args: preset-http-reolink roles: - detect output_args: record: preset-record-generic-audio-copy c2-garden: ffmpeg: inputs: - path: http://10.10.8.12/flv?port=1935&app=bcs&stream=cha nnel0_main.bcs&user=admin&password={FRIGATE_C2_PASS} input_args: preset-http-reolink roles: - record - path: http://10.10.8.12/flv?port=1935&app=bcs&stream=cha nnel0_sub.bcs&user=admin&password={FRIGATE_C2_PASS} input_args: preset-http-reolink roles: - detect output_args: record: preset-record-generic-audio-copy c3-garage: ffmpeg: inputs: - path: http://10.10.8.13/flv?port=1935&app=bcs&stream=cha nnel0_main.bcs&user=admin&password={FRIGATE_C3_PASS} input_args: preset-http-reolink roles: - record - path: http://10.10.8.13/flv?port=1935&app=bcs&stream=cha nnel0_sub.bcs&user=admin&password={FRIGATE_C3_PASS} input_args: preset-http-reolink roles: - detect output_args: record: preset-record-generic-audio-copy c4-front: ffmpeg: inputs: - path: http://10.10.8.14/flv?port=1935&app=bcs&stream=cha nnel0_main.bcs&user=admin&password={FRIGATE_C4_PASS} input_args: preset-http-reolink roles: - record - path: http://10.10.8.14/flv?port=1935&app=bcs&stream=cha nnel0_sub.bcs&user=admin&password={FRIGATE_C4_PASS} input_args: preset-http-reolink roles: - detect output_args: record: preset-record-generic-audio-copy ---------------------------------------------------------------------- Tha_Reaper · 2023-11-18 14:47 you could further improve performance and reduce CPU load by applying masks where possible. Frigate doesnt need to analyze what is happeling when a bush at the end of your garden decides to swing a bit in the wind. It only needs processing power if movement is detected in areas that may actually pose a threat to your property. ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 14:49 That's my next step - just need to draw some masks out and apply them ---------------------------------------------------------------------- Do_TheEvolution · 2023-11-18 15:24 Can you post the compose? Also I thought that frigate is only usable through home assistant, or that only means android app I guess. Anyway, I am actually in process of picking few cameras, likely going with some tplink vigi and see whats up. ---------------------------------------------------------------------- ParticularCod6 · 2023-11-18 15:39 I am planning a similar setup. Do you record in h.265 or h.264? ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 16:09 Sure thing > Also I thought that frigate is only usable through home assistant, but that only means android app I guess. Nope, Home Assistant is just a nice integration with it The web UI is fast and responsive - even on mobile in Chrome You can easily view object detections and recordings by day and hour through the web UI too It's extremely well done > Anyway, I am actually in process of picking few cameras, likely going with tplink vigi, like C340 and see if it will play nicely. Frigate have docs on recommended cameras https://docs.frigate.video/frigate/hardware Regardless of what cameras you choose, please ensure you VLAN and firewall them off - these cameras effectively run a Linux distro and should not be trusted or accessible For example, my Reolink cameras can access NTP and DNS just so their clocks are correct They can't access anything else on the network The CCTV VM sits on the same network as the cameras and has host firewall rules to deny access from the cameras Frigate just connects to each camera's stream and does its magic from there --- version: "3.9" services: frigate: container_name: frigate privileged: true # this may not be necessary for all setups restart: unless-stopped image: ghcr.io/blakeblackshear/frigate:stable shm_size: "512mb" # update for your cameras based on calculation above volumes: - /etc/localtime:/etc/localtime:ro - /opt/dockervolumes/frigate/config/config.yml:/config/config.yml - /mnt/cctv/frigate:/media/frigate - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear target: /tmp/cache tmpfs: size: 1000000000 ports: - "8554:8554" # RTSP feeds - "8555:8555/tcp" # WebRTC over tcp - "8555:8555/udp" # WebRTC over udp environment: FRIGATE_C1_PASS: ${FRIGATE_C1_PASS} FRIGATE_C2_PASS: ${FRIGATE_C2_PASS} FRIGATE_C3_PASS: ${FRIGATE_C3_PASS} FRIGATE_C4_PASS: ${FRIGATE_C4_PASS} labels: - traefik.enable=true - traefik.http.routers.cctv.rule=Host(`cctv.${DOMAIN}`) - traefik.http.routers.cctv.entrypoints=websecure - traefik.http.routers.cctv.tls.certresolver=cloudflare - traefik.http.services.cctv.loadbalancer.server.port=5000 networks: - proxy networks: proxy: external: true ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 16:13 I believe the RTMP stream uses H264 cause these cameras are older If you have the hardware, go for H265 ---------------------------------------------------------------------- LoPanDidNothingWrong · 2023-11-18 16:40 Yeah. I used shinobi before and Frigate is a lot better and easier to configure. I need to figure out how to get notifications when recording fails and stuff like that. ---------------------------------------------------------------------- pusillanimouslist · 2023-11-18 16:46 Eh, I’d advise the opposite. I have some H265 cameras and compatibility with frigate is kind of a pain. I had to do a lot of per camera fiddling to make detection work _and_ to get the live stream to work faster than 5fps. Per the documentation there do seem to be some H265 cameras that work smoothly out of the box. But they’re more expensive and require research beforehand. ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 17:45 Log tail with Zabbix trigger could work ---------------------------------------------------------------------- pm_something_u_love · 2023-11-18 18:07 One thing that Shinobi could do was integrate well with the detectors on cam, so if your cam had person/vehicle detection or line crossing etc you could use that. That worked well. But I too went from Shinobi to Frigate and I love it. The integration with HA is very good. ---------------------------------------------------------------------- nickm_27 · 2023-11-18 18:24 One thing to mention is that you're currently running detection on 2560x1920 but your reolink ext stream is going to be something like 896x672 so you're using cpu to scale that stream up. You may find lower cpu usage by running detect at that streams specific resolution ---------------------------------------------------------------------- sirrush7 · 2023-11-18 19:03 Oh this is fantastic, exactly what I will be moving to shortly! Thanks so much for sharing OP! ---------------------------------------------------------------------- stoneobscurity · 2023-11-18 19:16 you'll want to add a coral tpu. ---------------------------------------------------------------------- ndnihil · 2023-11-18 19:30 Have been running my own NVR for decades, most of it with the motion project. Recently started switching things over to Frigate and I am impressed with it as well. The Corals are worth the money. I run two of them on my setup (6 to 8 1080 cams at any given time) and quite pleased with it. The default models are great at detecting humans, but not so much cars/wildlife. I definitely plan to try and expand on that in the near future. ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 19:45 I think I will in future - need to compare it to open vino really ---------------------------------------------------------------------- geek_at · 2023-11-18 19:51 Nobody here using AgentDVR? The docker works great and has GPU and AI support and can be integrated in Homeassistant. Only downside is that you can't use https with the free version (unless you use it via homeassistant) ---------------------------------------------------------------------- Tha_Reaper · 2023-11-18 19:54 He is using the sub stream for detection according to his config right? ---------------------------------------------------------------------- nickm_27 · 2023-11-18 19:55 Yes, using a sub stream but configuring detect at main stream resolution ---------------------------------------------------------------------- stoneobscurity · 2023-11-18 19:59 it kicks the ass of anything CPU based. ---------------------------------------------------------------------- Tha_Reaper · 2023-11-18 19:59 Did not catch that! ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 20:28 I'm noticing that not every object is captured at the moment I'll buy one and see how much better it is ---------------------------------------------------------------------- cryptopoes · 2023-11-18 20:38 Get a Google Coral TPU for frigate ---------------------------------------------------------------------- muoshuu · 2023-11-18 21:00 A coral won’t increase accuracy since the same model is used either way, but that 50% CPU usage should easily drop by an order of magnitude alongside power usage. ---------------------------------------------------------------------- muoshuu · 2023-11-18 21:04 Did you have any specific issues running just one coral? I’m only using one with 5 cameras and inference speeds are still around 10ms. ---------------------------------------------------------------------- GodJami · 2023-11-18 21:10 What is your review about Reolink? Thinking of switching from Netatmo to something better so any recommendations are welcome 🙏 ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 21:49 Sounds like it'll pay for itself ---------------------------------------------------------------------- ndnihil · 2023-11-18 21:49 Never even tried running just one. I ordered two when I decided to switch over knowing that whatever cameras I use are only going to get more resource intensive over time. I'm a big fan of overspec'ing things from the start so there are larger gaps between hardware upgrades/refresh down the road. ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-18 21:50 They're cheap and good - their app is good as well and doesn't require any sign up - you just add each camera in ---------------------------------------------------------------------- LoPanDidNothingWrong · 2023-11-18 22:31 My cameras have on-camera detection I just don’t use it. I have a Coral passed through to the docker. ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-19 01:25 Ooh that's a schoolboy error Corrected it - should have been 640x480 ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-19 01:32 Wow, I was averaging 60% CPU before Now the resolution is correct it's averaging 35% ---------------------------------------------------------------------- nickm_27 · 2023-11-19 01:35 The sub stream is 640x480, typically reolink ext streams are a bit higher resolution which may help with your object detection performance ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-19 08:45 I think I need to wait for my Coral to arrive before I switch to that I gave that stream a try and it ate far more CPU than I wanted it to ---------------------------------------------------------------------- Elle221LL · 2023-11-19 09:04 "And it worked—it did the job, recorded stuff, and was fairly okay at motion detection. However, it consumed a significant amount of CPU and drew a lot of electricity for no real reason. You didn't optimize it. For me, with 4 4k Cameras + more 1080p cameras, it uses 1.5% to 3% when nobody is viewing the cameras. Of course, it will go up if somebody is viewing the cameras, as it will need to transcode to view it on the web. I wanted to try other alternatives as well on Linux, but I still preferred Blue Iris at the end. You can find information on optimizing Blue Iris's CPU usage in this link: Optimizing Blue Iris's CPU Usage. https://ipcamtalk.com/wiki/optimizing-blue-iris-s-cpu-usage/ ---------------------------------------------------------------------- bebopblues · 2023-11-19 10:07 Blue Iris user here, I heard good things about Frigate before, but like you, I never tried it because it seems hard to set up and configure. But since I also have Reolink cameras and with your docker compose.yml file, I might give it a shot. >First I gave Blue Iris a try which meant I needed a full Windows VM to run it by the way, [using wine, Blue Iris can be run in docker](https://hub.docker.com/r/jshridha/blueiris) as well. I never tried it, but it exists. >it eat the CPU and draw a lot of electricity for no real reason Starting with version 5, BI can use substreams for detection as well, so CPU usage is way down, like at 10-20% on my 12 year old intel i7. ---------------------------------------------------------------------- 5c044 · 2023-11-19 10:29 There is also tensorRT if you have an old nvidia gpu spare, and that gpu can also do hardware accelerated ffmpeg stream decode, support from compute capability 5.0 and up which is maxwell era hardware. If not, older cards can be picked up cheap https://deploy-preview-6262--frigate-docs.netlify.app/frigate/hardware - docs for the current beta version ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-19 10:29 Oh wow that's a hell of an improvement It's been about 4 years since I last used it so I'm happy to see they're still actively improving it ---------------------------------------------------------------------- Eboettn · 2023-11-20 02:23 RemindMe! 12 hours ---------------------------------------------------------------------- RemindMeBot · 2023-11-20 02:24 I will be messaging you in 12 hours on [**2023-11-20 14:23:39 UTC**](h ttp://www.wolframalpha.com/input/?i=2023-11- 20%2014:23:39%20UTC%20To%20Local%20Time) to remind you of [**this link **](https://www.reddit.com/r/selfhosted/comments/17y7bbw/frigate_cctv_ is_absolutely_amazing/k9yvs31/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=Remin dMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2F selfhosted%2Fcomments%2F17y7bbw%2Ffrigate_cctv_is_absolutely_amazing%2 Fk9yvs31%2F%5D%0A%0ARemindMe%21%202023-11-20%2014%3A23%3A39%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)] (https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete %20Comment&message=Delete%21%2017y7bbw) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remind mebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?t o=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside %20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Yo ur Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot& subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](ht tps://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot %20Feedback)| |-|-|-|-| ---------------------------------------------------------------------- Intel · 2023-11-21 22:13 I've been closely following your discussion on integrating Frigate with OpenVINO. It's really impressive, and your detailed configuration share is highly beneficial for the community. On a related note, in a recent personal project, where we monitored the freshness of perishables, leveraging OpenVINO's asynchronous inference and the SSD\_Mobilenet model led to a notable 30% boost in performance on an Intel Core CPU. This capability could similarly enhance the efficiency of your dual-stream setup. Additionally, the latest OpenVINO 2023.2 release simplifies model downloading and conversion, which might be advantageous for any future system updates or model explorations.Your initiative in sharing and applying AI in real world usecase is commendable. It's inspiring to witness innovative AI applications in real-life scenarios like yours! --Anisha U, AI Software Evangelist (APJ) @ Intel ---------------------------------------------------------------------- SpongederpSquarefap · 2023-11-23 00:11 Shit you weren't kidding Check this out https://i.imgur.com/b9nrc3U.png The day on the left is before the Coral The day on the right is today Compare the lowest parts of them - significant improvement in the day Sadly at night (probably because night vision making it harder to detect) the CPU usage jumps up