Frigate: Skirtumas tarp puslapio versijų
2 eilutė: | 2 eilutė: | ||
== Proxmox + HassOS (Home Assistant) + Frigate (Intel NUC6CAYH) == | == Proxmox + HassOS (Home Assistant) + Frigate (Intel NUC6CAYH) == | ||
− | Pigiausias (low budget) setupas, nors [[cpu]] apkrovos jaučiasi, bet puikiai veikia su 4-6 kameromis. | + | Pigiausias ('''low budget''') setupas, nors [[cpu]] apkrovos jaučiasi, bet puikiai veikia su '''4-6''' kameromis. Diegiame tuo pačiu ir [[Home Assistant]], kuris naudojamas išmaniųjų namų automatikoje. [[Frigate]] diegiamas bus kaip plugin (papildinys) '''Home Assistant'ui'''. |
Reikalinga: | Reikalinga: | ||
29 eilutė: | 29 eilutė: | ||
Sekame instrukcijas diegimo metu... | Sekame instrukcijas diegimo metu... | ||
− | Diegimui pasibaigus pasijungiame per | + | Diegimui pasibaigus pasijungiame per '''Proxmox''' konsolę prie '''mqtt lxc''' konteinerio ir pakeičiame failo '''/etc/mosquitto/conf.d/default.conf''' turinį į |
listener 1883 | listener 1883 | ||
allow_anonymous true | allow_anonymous true | ||
36 eilutė: | 36 eilutė: | ||
socket_domain ipv4 | socket_domain ipv4 | ||
− | === Įdiegiame Home Assistant OS === | + | === Įdiegiame Home Assistant OS į naują virtualią mašiną === |
* Prisijungiame prie proxmox valdymo panelio https://ip:8006/ | * Prisijungiame prie proxmox valdymo panelio https://ip:8006/ | ||
45 eilutė: | 45 eilutė: | ||
=== Įdiegiame Home Assistant Frigate pluginą === | === Įdiegiame Home Assistant Frigate pluginą === | ||
− | Einame į Home Assistant > Settings > Add-ons > ADD-ON STORE > Spaudžiame viršutiniame dešiniame kampe tris taškus ir pasirenkame Repositories, pridedame repozitorių: | + | Einame į Home Assistant > Settings > Add-ons > ADD-ON STORE > Spaudžiame viršutiniame dešiniame kampe tris taškus ir pasirenkame '''Repositories''', pridedame repozitorių: |
https://github.com/blakeblackshear/frigate-hass-addons | https://github.com/blakeblackshear/frigate-hass-addons | ||
− | Atnaujiname repozitorius ir spaudžiame įdiegti Frigate plugin'ą. | + | Atnaujiname repozitorius ir spaudžiame įdiegti '''Frigate''' plugin'ą. |
=== Įgaliname Intel iGPU Passthrough === | === Įgaliname Intel iGPU Passthrough === | ||
58 eilutė: | 58 eilutė: | ||
Paleidžiame: | Paleidžiame: | ||
update-grub | update-grub | ||
− | Paredaguojame failą /etc/modules ten įrašydami: | + | |
+ | Paredaguojame failą '''/etc/modules''' ten įrašydami: | ||
# Modules required for PCI passthrough | # Modules required for PCI passthrough | ||
vfio | vfio | ||
66 eilutė: | 67 eilutė: | ||
# Modules required for Intel GVT-g Split | # Modules required for Intel GVT-g Split | ||
kvmgt | kvmgt | ||
+ | |||
+ | Paredaguojame failą '''/etc/modprobe.d/my-blacklist.conf''' ten įrašydami: | ||
+ | blacklist btintel | ||
+ | blacklist btusb | ||
+ | blacklist btrtl | ||
+ | blacklist btmtk | ||
+ | blacklist btbcm | ||
+ | # for gpu passtrough | ||
+ | blacklist i915 | ||
+ | blacklist snd_hda_intel | ||
+ | blacklist snd_hda_codec_hdmi | ||
+ | blacklist snd_sof_pci_intel_apl | ||
+ | blacklist snd_soc_skl | ||
+ | blacklist snd_soc_avs | ||
+ | |||
Paleidžiame: | Paleidžiame: | ||
update-initramfs -u -k all | update-initramfs -u -k all | ||
reboot | reboot | ||
− | + | ||
+ | Sistemai naujai užsikrovus tikriname pasitelkę '''dmesg''' komandą ir ieškome eilutės: | ||
dmesg | grep -e DMAR -e IOMMU | dmesg | grep -e DMAR -e IOMMU | ||
[0.067203] DMAR: IOMMU enabled | [0.067203] DMAR: IOMMU enabled | ||
102 eilutė: | 119 eilutė: | ||
'''Failo turinys:''' | '''Failo turinys:''' | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
+ | environment_vars: | ||
+ | LIBVA_DRIVER_NAME: i965 | ||
+ | ffmpeg: | ||
+ | hwaccel_args: preset-vaapi | ||
+ | output_args: | ||
+ | record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac | ||
+ | input_args: | ||
+ | - '-avoid_negative_ts' | ||
+ | - make_zero | ||
+ | - '-fflags' | ||
+ | - nobuffer | ||
+ | - '-flags' | ||
+ | - low_delay | ||
+ | - '-strict' | ||
+ | - experimental | ||
+ | - '-fflags' | ||
+ | - +genpts+discardcorrupt | ||
+ | - '-use_wallclock_as_timestamps' | ||
+ | - '1' | ||
+ | detectors: | ||
+ | coral: | ||
+ | type: edgetpu | ||
+ | device: usb | ||
+ | |||
+ | mqtt: | ||
+ | enabled: True | ||
+ | host: 192.168.1.1 | ||
+ | topic_prefix: frigate | ||
+ | client_id: frigate | ||
+ | user: mqtt | ||
+ | password: mqtt | ||
+ | stats_interval: 60 | ||
+ | rtmp: | ||
+ | enabled: false | ||
+ | |||
+ | birdseye: | ||
+ | enabled: false | ||
+ | |||
+ | detect: | ||
+ | enabled: True | ||
+ | max_disappeared: 50 | ||
+ | width: 640 | ||
+ | height: 360 | ||
+ | fps: 5 | ||
+ | |||
+ | record: | ||
+ | enabled: True | ||
+ | retain: | ||
+ | days: 14 | ||
+ | mode: motion | ||
+ | events: | ||
+ | pre_capture: 10 | ||
+ | post_capture: 5 | ||
+ | objects: | ||
+ | - person | ||
+ | - car | ||
+ | - bicycle | ||
+ | - motorcycle | ||
+ | - bus | ||
+ | - dog | ||
+ | - truck | ||
+ | required_zones: [] | ||
+ | retain: | ||
+ | default: 48 | ||
+ | mode: motion | ||
+ | snapshots: | ||
+ | enabled: True | ||
+ | timestamp: True | ||
+ | bounding_box: True | ||
+ | crop: False | ||
+ | height: 1000 | ||
+ | retain: | ||
+ | default: 250 | ||
+ | |||
+ | objects: | ||
+ | track: | ||
+ | - person | ||
+ | - car | ||
+ | - cat | ||
+ | - dog | ||
+ | - bicycle | ||
+ | - truck | ||
+ | - motorcycle | ||
+ | - bus | ||
+ | - horse | ||
+ | - sheep | ||
+ | - cow | ||
+ | - bear | ||
+ | - umbrella | ||
+ | - handbag | ||
+ | - suitcase | ||
+ | - bottle | ||
+ | - apple | ||
+ | - cell phone | ||
+ | |||
+ | filters: | ||
+ | person: | ||
+ | min_score: 0.5 | ||
+ | threshold: 0.7 | ||
+ | car: | ||
+ | threshold: 0.70 | ||
+ | truck: | ||
+ | threshold: 0.70 | ||
+ | cameras: | ||
+ | Cam1: | ||
+ | ffmpeg: | ||
+ | inputs: | ||
+ | - path: rtsp://admin:admin@192.168.1.11/0/av1 # h264 MPEG-4 AVC (h264) 640x352 | ||
+ | roles: | ||
+ | - detect | ||
+ | - path: rtsp://admin:admin@192.168.1.11/0/av0 # h264 MPEG-4 AVC (h264 1920x1080 | ||
+ | roles: | ||
+ | - record | ||
+ | detect: | ||
+ | width: 640 | ||
+ | height: 352 | ||
+ | fps: 5 | ||
+ | objects: | ||
+ | track: | ||
+ | - person | ||
+ | - cat | ||
+ | - dog | ||
+ | - truck | ||
+ | mqtt: | ||
+ | height: 1080 | ||
+ | crop: False | ||
+ | timestamp_style: | ||
+ | position: "bl" | ||
+ | format: "%H:%M:%S" | ||
+ | color: | ||
+ | red: 255 | ||
+ | green: 255 | ||
+ | blue: 255 | ||
+ | thickness: 5 | ||
+ | effect: "shadow" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | Konfigūracija yra optimizuota ir gali veikti tiktai nurodytame įrenginyje, taip pat šioje konfigūracijoje yra įgalintas vaizdo įrašymas su garsu ir taip pat šioks toks ilgesnis užlaikymas, vaizdo kamerų neatsako metu (tinka prastos kokybės kiniškoms kameroms). | ||
=== Jeigu coral neatpažystamas sistemos === | === Jeigu coral neatpažystamas sistemos === | ||
124 eilutė: | 278 eilutė: | ||
[https://williamlam.com/2023/05/google-coral-usb-edge-tpu-accelerator-on-esxi.html Daugiau info] | [https://williamlam.com/2023/05/google-coral-usb-edge-tpu-accelerator-on-esxi.html Daugiau info] | ||
+ | |||
+ | === Kiti patarimai === | ||
+ | |||
+ | Kamerų rezoliuciją padavus rtsp url patogiai galima pamatyti su '''ffprobe''' (randasi ffmpeg programų pakete).. | ||
== Ubuntu 22.04.4 LTS + Frigate Docker (ThinkCentre M920q) == | == Ubuntu 22.04.4 LTS + Frigate Docker (ThinkCentre M920q) == |
21:53, 8 birželio 2024 versija
Proxmox + HassOS (Home Assistant) + Frigate (Intel NUC6CAYH)
Pigiausias (low budget) setupas, nors cpu apkrovos jaučiasi, bet puikiai veikia su 4-6 kameromis. Diegiame tuo pačiu ir Home Assistant, kuris naudojamas išmaniųjų namų automatikoje. Frigate diegiamas bus kaip plugin (papildinys) Home Assistant'ui.
Reikalinga:
- Nuc6cayh Intel NUC'as
- Coral Accelerator Coral USB AI akseleratorius, plačiau apie jį čia.
- Proxmox diegimo usb flash diskas.
Sudiegiame proxmox
FIXME
|
Kai sudiegiame proxmox..
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/post-pve-install.sh)"
Sekame instrukcijas diegimo metu...
Įdiegiame MQTT brokerį kaip LXC konteinerį
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/mqtt.sh)"
Sekame instrukcijas diegimo metu...
Diegimui pasibaigus pasijungiame per Proxmox konsolę prie mqtt lxc konteinerio ir pakeičiame failo /etc/mosquitto/conf.d/default.conf turinį į
listener 1883 allow_anonymous true listener 9001 protocol websockets socket_domain ipv4
Įdiegiame Home Assistant OS į naują virtualią mašiną
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/vm/haos-vm.sh)"
Įdiegiame Home Assistant Frigate pluginą
Einame į Home Assistant > Settings > Add-ons > ADD-ON STORE > Spaudžiame viršutiniame dešiniame kampe tris taškus ir pasirenkame Repositories, pridedame repozitorių:
https://github.com/blakeblackshear/frigate-hass-addons
Atnaujiname repozitorius ir spaudžiame įdiegti Frigate plugin'ą.
Įgaliname Intel iGPU Passthrough
/etc/default/grub pakeisti tik vieną eilutę
GRUB_CMDLINE_LINUX_DEFAULT="quiet quiet intel_iommu=on i915.enable_gvt=1 iommu=pt pcie_acs_override=downstream,multifunction video=efifb:off video=vesa:off vfio_iommu_type1.allow_unsafe_interrupts=1 kvm.ignore_msrs=1 modprobe.blacklist=radeon,nouveau,nvidia,nvidiafb,nvidia-gpu"
Paleidžiame:
update-grub
Paredaguojame failą /etc/modules ten įrašydami:
# Modules required for PCI passthrough vfio vfio_iommu_type1 vfio_pci vfio_virqfd # Modules required for Intel GVT-g Split kvmgt
Paredaguojame failą /etc/modprobe.d/my-blacklist.conf ten įrašydami:
blacklist btintel blacklist btusb blacklist btrtl blacklist btmtk blacklist btbcm # for gpu passtrough blacklist i915 blacklist snd_hda_intel blacklist snd_hda_codec_hdmi blacklist snd_sof_pci_intel_apl blacklist snd_soc_skl blacklist snd_soc_avs
Paleidžiame:
update-initramfs -u -k all reboot
Sistemai naujai užsikrovus tikriname pasitelkę dmesg komandą ir ieškome eilutės:
dmesg | grep -e DMAR -e IOMMU [0.067203] DMAR: IOMMU enabled
GPU Passthrough įgalinimas Home Assistant OS virtualioje mašinoje
Nustatymai turi atrodyti maždaug taip
Po reboot žiūrime ar pavyko:
ls -lsah /dev/dri
Turime matyti:
Frigate konfigūracija
Kad patogiau būtų redaguoti konfigūracijos failą, įdiegiame Home Assistant pluginą File Editor per Settings > Add-ons > ADD-ON STORE įdiegus pluginą pasidarome Show in sidebar. Paspaudę ant šio sidebar meniu punkto nunaviguojame ir sukuriame failą frigate.yml direktorijoje homeassistant/
Failo turinys:
environment_vars:
LIBVA_DRIVER_NAME: i965
ffmpeg:
hwaccel_args: preset-vaapi
output_args:
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
input_args:
- '-avoid_negative_ts'
- make_zero
- '-fflags'
- nobuffer
- '-flags'
- low_delay
- '-strict'
- experimental
- '-fflags'
- +genpts+discardcorrupt
- '-use_wallclock_as_timestamps'
- '1'
detectors:
coral:
type: edgetpu
device: usb
mqtt:
enabled: True
host: 192.168.1.1
topic_prefix: frigate
client_id: frigate
user: mqtt
password: mqtt
stats_interval: 60
rtmp:
enabled: false
birdseye:
enabled: false
detect:
enabled: True
max_disappeared: 50
width: 640
height: 360
fps: 5
record:
enabled: True
retain:
days: 14
mode: motion
events:
pre_capture: 10
post_capture: 5
objects:
- person
- car
- bicycle
- motorcycle
- bus
- dog
- truck
required_zones: []
retain:
default: 48
mode: motion
snapshots:
enabled: True
timestamp: True
bounding_box: True
crop: False
height: 1000
retain:
default: 250
objects:
track:
- person
- car
- cat
- dog
- bicycle
- truck
- motorcycle
- bus
- horse
- sheep
- cow
- bear
- umbrella
- handbag
- suitcase
- bottle
- apple
- cell phone
filters:
person:
min_score: 0.5
threshold: 0.7
car:
threshold: 0.70
truck:
threshold: 0.70
cameras:
Cam1:
ffmpeg:
inputs:
- path: rtsp://admin:admin@192.168.1.11/0/av1 # h264 MPEG-4 AVC (h264) 640x352
roles:
- detect
- path: rtsp://admin:admin@192.168.1.11/0/av0 # h264 MPEG-4 AVC (h264 1920x1080
roles:
- record
detect:
width: 640
height: 352
fps: 5
objects:
track:
- person
- cat
- dog
- truck
mqtt:
height: 1080
crop: False
timestamp_style:
position: "bl"
format: "%H:%M:%S"
color:
red: 255
green: 255
blue: 255
thickness: 5
effect: "shadow"
Konfigūracija yra optimizuota ir gali veikti tiktai nurodytame įrenginyje, taip pat šioje konfigūracijoje yra įgalintas vaizdo įrašymas su garsu ir taip pat šioks toks ilgesnis užlaikymas, vaizdo kamerų neatsako metu (tinka prastos kokybės kiniškoms kameroms).
Jeigu coral neatpažystamas sistemos
Jeigu lsusb komanda rodo:
1a6e:089a Global Unichip Corp.
Reikia įgalinti įrenginio atpažinimą udev taisyklėmis arba pasinaudoti df-util
apt install df-util wget https://github.com/google-coral/libedgetpu/raw/efb73cc94dac29dc590a243109d4654c223e008c/driver/usb/apex_latest_single_ep.bin dfu-util -D apex_latest_single_ep.bin -d 1a6e:089a -R
Kad kiekvieną sistemos startavimo kartą suveiktų šis pakeitimas reiktų jį įrašyti į /etc/rc.local failą
#!/bin/sh
dfu-util -D apex_latest_single_ep.bin -d 1a6e:089a -R
exit 0
Taip pat suteikiame šiam scriptui paleidimo teises
chmod +x /etc/rc.local
Dabar sistemos perkrovimo metu įrenginys bus atpažystamas teisingai.
Kiti patarimai
Kamerų rezoliuciją padavus rtsp url patogiai galima pamatyti su ffprobe (randasi ffmpeg programų pakete)..
Ubuntu 22.04.4 LTS + Frigate Docker (ThinkCentre M920q)
Reikalinga:
- ThinkCentre M920q
- Coral Accelerator Coral USB AI akseleratorius, plačiau apie jį čia.
docker-compose.yml
version: "3.9"
services:
frigate:
container_name: frigate
image: ghcr.io/blakeblackshear/frigate:stable
restart: always
privileged: true
shm_size: "256mb"
ports:
- "1935:1935"
- "5000:5000"
devices:
- /dev/bus/usb:/dev/bus/usb
- /dev/dri:/dev/dri
volumes:
- /etc/localtime:/etc/localtime:ro
- /srv/dockers/frigate/conf/config.yml:/config/config.yml:ro
- /srv/dockers/frigate/data:/media/frigate
- /srv/dockers/frigate/db:/db
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
# ports:
# - '5000:5000'
environment:
- FRIGATE_RTSP_PASSWORD=123456
networks:
- traefik
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- "traefik.http.routers.frigate.rule=Host(`frigate.domenas.lt`)"
- "traefik.http.services.frigate.loadbalancer.server.port=5000"
# resources limit
mem_limit: 6G
cpus: 3.0
cap_add:
- CAP_PERFMON
networks:
traefik:
external: true
frigate.yml
detectors:
# cpu1:
# type: cpu
# cpu2:
# type: cpu
coral:
type: edgetpu
device: usb
num_threads: 3
database:
path: /db/frigate.db
ffmpeg:
hwaccel_args: preset-vaapi
output_args:
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
logger:
# Optional: default log level (default: shown below)
default: info
# Optional: module by module log level configuration
logs:
frigate.mqtt: warning
frigate.ffmpeg: debug
mqtt:
host: 192.168.1.1
topic_prefix: frigate
client_id: frigate
stats_interval: 60
rtmp:
enabled: false
birdseye:
enabled: false
detect:
enabled: True
max_disappeared: 50
width: 640
height: 360
fps: 5
record:
enabled: True
retain:
days: 14
mode: motion
events:
pre_capture: 10
post_capture: 5
objects:
- person
- car
- bicycle
- motorcycle
- bus
- dog
- truck
required_zones: []
retain:
default: 3650
mode: active_objects
snapshots:
enabled: True
timestamp: True
bounding_box: True
crop: False
height: 1000
retain:
default: 3650
objects:
track:
- person
- car
- cat
- dog
- bicycle
- truck
- motorcycle
- bus
- horse
- sheep
- cow
- bear
- umbrella
- handbag
- suitcase
- bottle
- apple
- cell phone
filters:
person:
min_score: 0.5
threshold: 0.7
car:
threshold: 0.70
truck:
threshold: 0.70
cameras:
Cam1:
ffmpeg:
hwaccel_args: preset-intel-qsv-h264
input_args: -avoid_negative_ts auto -fflags nobuffer+genpts+discardcorrupt -flags low_delay -rtsp_transport tcp -use_wallclock_as_timestamps 1 -timeout 2000000
inputs:
- path: rtsp://admin:admin@192.168.1.10/0/av1 # h264 MPEG-4 AVC (h264) 640x352
roles:
- detect
- path: rtsp://admin:admin@192.168.1.10/0/av0 # h264 MPEG-4 AVC (h264 1920x1080
roles:
- record
detect:
width: 640
height: 352
fps: 5
objects:
track:
- person
- cat
- dog
- truck
mqtt:
height: 1080
crop: False
timestamp_style:
position: "bl"
format: "%H:%M:%S"
color:
red: 255
green: 255
blue: 255
thickness: 5
effect: "shadow"