前几篇文章介绍了各种摄像头的接入。是时候介绍 NVR(Network video recorder)即网络视频录像机了,它可以实现将视频内容存储到文件中,之前介绍的 motionEye 应该就算是 NVR 的一种了,它可以实现根据运动触发拍照或者摄像,那么更高级一点儿的,比如通过 OpenCV 或 Tensorflow 进行物体检测就可以选择开源的 Frigate 来实现了
官网:https://frigate.video/
使用本地处理的 AI 监控您的安全摄像头
它有如下特点:
https://github.com/blakeblackshear/frigate
参考:https://docs.frigate.video/frigate/installation
创建 docker-compose.yml
[root@cn-tx-bj7-c8 frigate]# cat docker-compose.yml
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: "256mb" # update for your cameras based on calculation above
devices:
- /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
# - /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
# - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/config
- ./debug:/media/frigate
- /dev/bus/usb:/dev/bus/usb
#- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
# target: /tmp/cache
# tmpfs:
# size: 1000000000
ports:
- "5000:5000"
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "password"
拉取镜像
[root@cn-tx-bj7-c8 frigate]# docker-compose pull
[+] Running 8/8
⠿ frigate Pulled 123.6s
⠿ f03b40093957 Already exists 0.0s
⠿ 29bc41a1e07f Pull complete 109.0s
⠿ f033030a404f Pull complete 116.4s
⠿ b8030797c27a Pull complete 117.0s
⠿ de3b92b8f5d5 Pull complete 117.0s
⠿ b5811a51986a Pull complete 117.1s
⠿ bf844d7f2ba4 Pull complete
创建配置文件 frigate.yml
[root@cn-tx-bj7-c8 config]# cat config.yml
mqtt:
# host: mqtt
enabled: False
cameras:
test:
ffmpeg:
inputs:
- path: rtsp://192.168.2.161:8554/mjpeg/1
roles:
- detect
detect:
enabled: False
height: 240
width: 240
fps: 5
启动
[root@cn-tx-bj7-c8 frigate]# docker-compose up
可访问 5000 端口查看 Web 界面
Frigate 是强大的 NVR 系统,虽然这篇文章介绍了基础的接入,但它还有更多功能比如 Detectors、Masks & Recording 等等可按需使用
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。