Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Off Topic
    4. Showcase frigate mit esp32cam (tasmota)

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Showcase frigate mit esp32cam (tasmota)

    This topic has been deleted. Only users with topic management privileges can see it.
    • MartinP
      MartinP last edited by MartinP

      Habe mir ein Setup gebastelt, das recht gut zu funktionieren scheint

      1. Flashen von Tasmota auf die esp32cam nach dieser Anleitung
        https://cgomesu.com/blog/Esp32cam-tasmota-webcam-server/

      Wenn alles geklappt muss man erstmal direkt über den Tasmota/ESP32-CAM Webserver Zugriff nehmen - bei mir über "http://192.168.2.189"
      2c3615d5-b38f-432b-b498-abee5c498311-grafik.png

      Dann weiter tools/console

      dort eintippen:

      wcresolution 11
      wcrtsp 0
      

      Das bedeutet: Webcam Auflösung 11 = 1280x720, rtsp-stream aus(!) (Mehr Kommandos ... siehe link weiter oben)

      Ich habe mit höheren und niedrigeren Auflösungen experimentiert, und empfinde 1280 x 720 als guten Kompromiss
      Bei höheren Auflösungen erkennt man auch nicht mehr, und die Framerate geht noch weiter, als bis auf 1...3 fps in den Keller.
      Bei geringeren Auflösungen gehen doch irgendwann selbst bei der Schwachen Optik Details verloren ...

      Frigate Installation habe ich anderswo schon beschrieben ...

      https://forum.iobroker.net/topic/76003/frigate-auf-coral-usb-im-lxc-container?_=1729774465581

      Hatte lange mit dem rtsp-Stream direkt der ESP-Cam experimentiert - der ist aber wohl zu exotisch, und hat den Nachteil, dass man die Aufzeichnungen nicht direkt im Browser angucken kann... (deshalb wcrtsp 0)

      Frigate wird über die datei config.yml konfiguriert.

      die Verarbeitung des Videomaterials aus der Kamera erfolgt im frigate container in zwei Schritten.

      go2rtc übernimmt den mjpeg-Stream der Kamera und wandelt ihn in rtsp

      ...
      go2rtc:
      #  log:
      #    exec: trace
        streams:
          #----- Output ist JPEG, Video.Transkodierung in H.264, kein Audio vorhanden
          CAM-go2Stellplatz:
             - ffmpeg:http://192.168.2.189:81/cam.mjpeg#video=h264#hardware
           # - ffmpeg:rtsp://192.168.2.189:8554/mjpeg/1/#video=h264#hardware
      ...
      

      Der transkodierte Stream aus go2rtc CAM-go2Stellplatz füttert dann wiederum den Kamera-Prozess:
      Die IP-Adresse 172.18.0.2 ist die Adresse des Frigate Docker Containers ... ich weiß nicht, ob das Ganze auch mit 127.0.0.1 oder der IP-Adresse des Linux-Systems auf dem der frigate Container unter Docker läuft funktioniert ...

      ...
      cameras:
        stellplatz:
          ffmpeg:
            hwaccel_args: preset-vaapi
            input_args: preset-rtsp-generic
            inputs:
              - path:  rtsp://172.18.0.2:8554/CAM-go2Stellplatz
               ...
      

      Komplette Datei als Spoiler:

      
      # logger:
       # default: info
      #  logs:
      #    frigate.mqtt: debug
      
      birdseye: 
       enabled: false
       width: 1280
       height: 720
       # mode: continuous
        
      mqtt:
       enabled: true
       host: 192.168.2.201
       port: 1888
      
       topic_prefix: frig1
      
      go2rtc:
      #  log:
      #    exec: trace
       streams:
         #----- Output ist JPEG, Video.Transkodierung in H.264, kein Audio vorhanden
         CAM-go2Stellplatz:
            - ffmpeg:http://192.168.2.189:81/cam.mjpeg#video=h264#hardware#raw=-avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 
          #  - ffmpeg:http://192.168.2.189:81/cam.mjpeg#video=h264#hardware
          # - ffmpeg:rtsp://192.168.2.189:8554/mjpeg/1/#video=h264#hardware
      
      record:
       enabled: true
       retain:
         days: 0
         mode: all
       events:
         retain:
           default: 10
           mode: motion
      detectors:
       coral:
         type: edgetpu
         device: usb
      cameras:
       stellplatz:
         ffmpeg:
           hwaccel_args: preset-vaapi
           input_args: preset-rtsp-generic
           inputs:
             - path:  rtsp://172.18.0.2:8554/CAM-go2Stellplatz
               roles:
                 - detect
         detect:
           width: 1280
           height: 
      objects:
       # Optional: list of objects to track from labelmap.txt (default: shown below)
       track:
         - person
       # Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
       # Checks based on the bottom center of the bounding box of the object.
       # NOTE: This mask is COMBINED with the object type specific mask below
       # mask: 0,0,1000,0,1000,200,0,200
       # Optional: filters to reduce false positives for specific object types
       filters:
         person:
           # Optional: minimum width*height of the bounding box for the detected object (default: 0)
           # min_area: 1000
           min_area: 500
           # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
           # max_area: 100000
           max_area: 24000000
           # Optional: minimum width/height of the bounding box for the detected object (default: 0)
           # min_ratio: 0.5
           # Optional: maximum width/height of the bounding box for the detected object (default: 24000000)
           # max_ratio: 2.0
           # Optional: minimum score for the object to initiate tracking (default: shown below)
           # min_score: 0.5
           # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
           # threshold: 0.7
           # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
           # Checks based on the bottom center of the bounding box of the object
           # mask: 0,0,1000,0,1000,200,0,200
      
      version: 0.14
      

      EDIT: Noch ein Tipp zum Schluss: Die Kamera selber ist nicht in der Lage, mehr als einen Video Stream auszuliefert. Wenn man sich die Tasmota-Konsole aufmacht, wird die Verbindung zum frigate System so gestört, dass die beiden nicht mehr zusammen gefunden haben. Musste im Browser den Tab mit der Tasmota Oberfläche schließen. und den Frigate Container neu starten..

      MartinP 1 Reply Last reply Reply Quote 1
      • MartinP
        MartinP @MartinP last edited by MartinP

        @martinp Habe leider einen Pferdefuß entdeckt ... die Videos lassen sich mit Firefox wiedergeben, aber mit Chrome nicht ...
        Sowohl auf dem Android Smartphone, als auch auf dem Windows PC funktioniert es nicht ...

        Muss man wahrscheinlich noch Feinschliff an der go2rtc Konfiguration betreiben ...

        EDIT: go2rtc Konfiguration ergänzt... jetzt funktioniert es auch auf dem Smartphone und im Windows Chrome

        ...
        go2rtc:
        #  log:
        #    exec: trace
          streams:
            #----- Output ist JPEG, Video.Transkodierung in H.264, kein Audio vorhanden
            CAM-go2Stellplatz:
               - ffmpeg:http://192.168.2.189:81/cam.mjpeg#video=h264#hardware#raw=-avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 
             #  - ffmpeg:http://192.168.2.189:81/cam.mjpeg#video=h264#hardware
             # - ffmpeg:rtsp://192.168.2.189:8554/mjpeg/1/#video=h264#hardware
        ...
        

        Habe den Spoiler oben ausgetauscht gegen die neue Version

        MartinP 1 Reply Last reply Reply Quote 0
        • MartinP
          MartinP @MartinP last edited by MartinP

          Noch ein wenig Ergänzung, was die Anwendung der Kamera angeht ...

          Mit der internen Antenne gibt es keinen stabilen Videostream, habe auf eine externe Antenne umgebaut.
          https://www.roboter-bausatz.de/p/2.4g-antenne-bluetooth-wifi-fuer-esp32-cam-zigbee-module-uvm.?srsltid=AfmBOoqZMLEzgdNFcpcNGoPMps7w3MXdyTnEQU5xiD-osNa_nY3ocMV_

          Derzeit nutze ich noch einen experimentellen Aufbau:

          418eeba3-ea78-495c-87b1-96824aa4aae1-grafik.png

          Hier wird eine Email versandt mit dem Thumbnail-Bild des erkannten Ereignisses

          ab8fa7f0-4a0b-4b72-91f9-1593bf09028d-grafik.png

          Ich nutze den frigate Adapter NICHT, sondern habe frigate direkt in den mqtt client / broker eigebunden.

          URL des Thumbnail-Bildes

          http://192.168.2.196:5000/api/stellplatz/any/thumbnail.jpg
          

          Und hier noch die Lebensdaten des frigate LXC-Containers

          60264d9e-afaf-421b-84c6-0f97e04cd05f-grafik.png

          David G. 1 Reply Last reply Reply Quote 0
          • David G.
            David G. @MartinP last edited by

            @martinp sagte in Showcase frigate mit esp32cam (tasmota):

            Mit der internen Antenne gibt es keinen stabilen Videostream, habe auf eine externe Antenne umgebaut.

            Das Problem ist hatte ich auch mal.
            Eine Cam habe ich beim löten zerstört, dann habe ich mir im Forum weiterhelfen lassen.....

            Warum da kein kleiner Schalter ist.....

            1 Reply Last reply Reply Quote 0
            • MartinP
              MartinP last edited by MartinP

              @david-g Die Umschaltung muss HF-Technisch "glatt" sein ... 2,4 GHz ist da schon recht empfindlich ...

              Habe aber auch schon Lösungen gesehen, wo die Antennenbuchse "Huckepack" auf der Leitung sitzt, die zur Leiterplatten-Antenne geht...
              Schließt man eine Antenne an die Buchse an, besteht die Arbeit darin, mit dem Teppichmesser die Leiterbahn zur Leiterplatten-Antenne zu kappen ...

              Die Leute von Frixtender sind aber da ziemlich schmerzfrei - die lassen die interne WLAN-Antenne einfach dran .. nix Teppichmesser....

              Geht nur um den kurzen Abschnitt ab 14:23:

              https://www.youtube.com/watch?v=8CV02jPrHwc

              Beim ESP32CAM Umlöten hat meine Lötspitze auch diesen 0-Ohm Widerstand geschluckt, und gut durchgegart ...
              Habe die Brücke dann mit einem 0,1 mm Silberdraht geschlossen ...

              1 Reply Last reply Reply Quote 0
              • MartinP
                MartinP last edited by

                Neue Wasserstandsmeldung - das Setup ist auseinandergeflogen, nachdem ein neuer Kernel auf dem PVE einen Reboot erforderte

                Google Coral hat seine Firmware verluren und meldete sich wieder als "Global Unichip"

                Das habe ich behoben ...

                angelehnt an diese Anleitung:

                https://github.com/google-coral/edgetpu/issues/536#issuecomment-2378251821

                Habe ich auf dem PVE installiert und ausgeführt...

                dann

                dfu-util -D /var/lib/vz/snippets/coral-bin/apex_latest_single_ep.bin -d "1a6e:089a" -R
                
                

                Danach sah das wieder gut aus, auf dem LXC-Container, wo frigate im Docker läuft:

                frigate@ubuntu-frigate-privileged:~$ lsusb
                Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
                Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
                Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
                Bus 002 Device 002: ID 2109:711f VIA Labs, Inc. External
                Bus 002 Device 005: ID 18d1:9302 Google Inc. 
                frigate@ubuntu-frigate-privileged:~$ 
                
                

                Die UDEV-Rule scheint auch zu funktionieren ...

                frigate@ubuntu-frigate-privileged:/etc/udev$ ls -l /dev/bus/usb/010/001
                crw-rw---- 1 root root 189, 132 Jan 17 16:22 /dev/bus/usb/010/001
                
                

                Logging sieht für mich so aus, als ob Google Coral trotz obiger Maßnahmen nicht mehr gefunden würde:

                
                s6-rc: info: service s6rc-fdholder: starting
                s6-rc: info: service s6rc-oneshot-runner: starting
                s6-rc: info: service s6rc-oneshot-runner successfully started
                s6-rc: info: service fix-attrs: starting
                s6-rc: info: service s6rc-fdholder successfully started
                s6-rc: info: service fix-attrs successfully started
                s6-rc: info: service legacy-cont-init: starting
                s6-rc: info: service legacy-cont-init successfully started
                s6-rc: info: service log-prepare: starting
                s6-rc: info: service log-prepare successfully started
                s6-rc: info: service nginx-log: starting
                s6-rc: info: service go2rtc-log: starting
                s6-rc: info: service frigate-log: starting
                s6-rc: info: service certsync-log: starting
                s6-rc: info: service nginx-log successfully started
                s6-rc: info: service certsync-log successfully started
                s6-rc: info: service go2rtc-log successfully started
                s6-rc: info: service go2rtc: starting
                s6-rc: info: service frigate-log successfully started
                s6-rc: info: service go2rtc successfully started
                s6-rc: info: service go2rtc-healthcheck: starting
                s6-rc: info: service frigate: starting
                s6-rc: info: service go2rtc-healthcheck successfully started
                s6-rc: info: service frigate successfully started
                s6-rc: info: service nginx: starting
                2025-01-19 10:27:11.748976483  [INFO] Preparing Frigate...
                2025-01-19 10:27:11.764227398  [INFO] Starting NGINX...
                2025-01-19 10:27:11.773249298  [INFO] Preparing new go2rtc config...
                2025-01-19 10:27:11.812415300  [INFO] Starting Frigate...
                s6-rc: info: service nginx successfully started
                s6-rc: info: service certsync: starting
                s6-rc: info: service certsync successfully started
                s6-rc: info: service legacy-services: starting
                2025-01-19 10:27:13.178785044  [INFO] Starting certsync...
                s6-rc: info: service legacy-services successfully started
                2025-01-19 10:27:13.837117315  127.0.0.1 - - [19/Jan/2025:10:27:13 +0100] "" 400 0 "-" "-" "-"
                2025-01-19 10:27:14.001275873  [INFO] Starting go2rtc...
                2025-01-19 10:27:14.272165584  10:27:14.271 INF go2rtc platform=linux/amd64 revision=b2399f3 version=1.9.2
                2025-01-19 10:27:14.272178059  10:27:14.271 INF config path=/dev/shm/go2rtc.yaml
                2025-01-19 10:27:14.276383157  10:27:14.275 INF [rtsp] listen addr=:8554
                2025-01-19 10:27:14.276394444  10:27:14.275 INF [webrtc] listen addr=:8555/tcp
                2025-01-19 10:27:14.276398432  10:27:14.274 INF [api] listen addr=:1984
                2025-01-19 10:27:16.076779061  2025/01/19 10:27:16 [error] 158#158: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", subrequest: "/auth", upstream: "http://127.0.0.1:5001/auth", host: "127.0.0.1:5000"
                2025-01-19 10:27:16.076838662  2025/01/19 10:27:16 [error] 158#158: *2 auth request unexpected status: 502 while sending to client, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", host: "127.0.0.1:5000"
                2025-01-19 10:27:19.252867312  [2025-01-19 10:27:19] frigate.app                    INFO    : Starting Frigate (0.14.1-f4f3cfa)
                2025-01-19 10:27:19.254111635  [2025-01-19 10:27:19] frigate.util.config            INFO    : Checking if frigate config needs migration...
                2025-01-19 10:27:19.331185891  [2025-01-19 10:27:19] frigate.util.config            INFO    : frigate config does not need migration...
                2025-01-19 10:27:19.803435796  [2025-01-19 10:27:19] frigate.util.services          INFO    : Automatically detected vaapi hwaccel for video decoding
                2025-01-19 10:27:21.397657580  2025/01/19 10:27:21 [error] 159#159: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", subrequest: "/auth", upstream: "http://127.0.0.1:5001/auth", host: "127.0.0.1:5000"
                2025-01-19 10:27:21.397856819  2025/01/19 10:27:21 [error] 159#159: *4 auth request unexpected status: 502 while sending to client, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", host: "127.0.0.1:5000"
                2025-01-19 10:27:21.756460888  [INFO] Starting go2rtc healthcheck service...
                2025-01-19 10:27:25.211849921  [2025-01-19 10:27:25] peewee_migrate.logs            INFO    : Starting migrations
                2025-01-19 10:27:25.216103206  [2025-01-19 10:27:25] peewee_migrate.logs            INFO    : There is nothing to migrate
                2025-01-19 10:27:25.249528935  [2025-01-19 10:27:25] frigate.app                    INFO    : Recording process started: 319
                2025-01-19 10:27:25.283949523  [2025-01-19 10:27:25] frigate.app                    INFO    : Recording process started: 320
                2025-01-19 10:27:25.296586653  [2025-01-19 10:27:25] frigate.app                    INFO    : go2rtc process pid: 103
                2025-01-19 10:27:25.459150423  [2025-01-19 10:27:25] detector.coral                 INFO    : Starting detection process: 348
                2025-01-19 10:27:25.483009059  [2025-01-19 10:27:25] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
                2025-01-19 10:27:25.518738470  [2025-01-19 10:27:25] frigate.app                    INFO    : Output process started: 351
                2025-01-19 10:27:25.749827549  [2025-01-19 10:27:25] frigate.app                    INFO    : Camera processor started for stellplatz: 369
                2025-01-19 10:27:25.749839074  [2025-01-19 10:27:25] frigate.app                    INFO    : Capture process started for stellplatz: 375
                2025-01-19 10:27:50.866930428  [2025-01-19 10:27:50] frigate.detectors.plugins.edgetpu_tfl ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
                2025-01-19 10:27:50.867886586  Process detector:coral:
                2025-01-19 10:27:50.874699368  Traceback (most recent call last):
                2025-01-19 10:27:50.874765469    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
                2025-01-19 10:27:50.874770631      delegate = Delegate(library, options)
                2025-01-19 10:27:50.874774919    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
                2025-01-19 10:27:50.874780169      raise ValueError(capture.message)
                2025-01-19 10:27:50.874783344  ValueError
                2025-01-19 10:27:50.874806594  
                2025-01-19 10:27:50.874811306  During handling of the above exception, another exception occurred:
                2025-01-19 10:27:50.874814144  
                2025-01-19 10:27:50.874817331  Traceback (most recent call last):
                2025-01-19 10:27:50.876353757    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
                2025-01-19 10:27:50.876363707      self.run()
                2025-01-19 10:27:50.876367682    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
                2025-01-19 10:27:50.876371207      self._target(*self._args, **self._kwargs)
                2025-01-19 10:27:50.876374982    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
                2025-01-19 10:27:50.876378832      object_detector = LocalObjectDetector(detector_config=detector_config)
                2025-01-19 10:27:50.876388232    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
                2025-01-19 10:27:50.876469945      self.detect_api = create_detector(detector_config)
                2025-01-19 10:27:50.876475245    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
                2025-01-19 10:27:50.876479333      return api(detector_config)
                2025-01-19 10:27:50.876483283    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 41, in __init__
                2025-01-19 10:27:50.876563671      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
                2025-01-19 10:27:50.876569196    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
                2025-01-19 10:27:50.876622759      raise ValueError('Failed to load delegate from {}\n{}'.format(
                2025-01-19 10:27:50.876627822  ValueError: Failed to load delegate from libedgetpu.so.1.0
                2025-01-19 10:27:50.876631234  
                

                jcastro created this issue in google-coral/edgetpu

                closed Coral USB changing ID and Vendor #536

                MartinP 1 Reply Last reply Reply Quote 0
                • MartinP
                  MartinP @MartinP last edited by

                  @martinp Problem hat sich erledigt .... Mein Versuch, den USB-Coral im Container immer unter dem gleichen Pfad sichtbar zu machen scheint doch nicht zu funktionieren

                  Hatte über eine udev-Regel auf dem PVE ein Device erzeugt ... (/dev/bus/usb/010/001)

                  Je eine Regel mit und ohne geladene Firmware auf den Coral Stick

                  root@pve:/etc/udev/rules.d# ls
                  50-lxcusb.rules  60-bridge-network-interface.rules  65-apex.rules  98-coral.rules  99-intel-chmod666.rules
                  root@pve:/etc/udev/rules.d# cat 98-coral.rules 
                  SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="9302", SYMLINK+="/bus/usb/010/001"
                  SUBSYSTEM=="usb", ATTR{idVendor}=="1a6e", ATTR{idProduct}=="089a", SYMLINK+="/bus/usb/010/001"
                  root@pve:/etc/udev/rules.d# 
                  
                  

                  Das Device scheint der frigate Container nicht zu erkennen ... Vorhanden ist es ...

                  frigate@ubuntu-frigate-privileged:/dev/bus/usb$ ls -l 010
                  total 0
                  crw-rw---- 1 frigate frigate 189, 130 Jan 22 15:40 001
                  frigate@ubuntu-frigate-privileged:/dev/bus/usb$ ls -l 002
                  total 0
                  crw-rw---- 1 root root 189, 130 Jan 22 15:40 003
                  frigate@ubuntu-frigate-privileged:/dev/bus/usb$ 
                  
                  

                  erst, als ich auch ./002/003 weitergeleitet hatte, hat es funktioniert ...

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  855
                  Online

                  31.6k
                  Users

                  79.6k
                  Topics

                  1.3m
                  Posts

                  2
                  7
                  642
                  Loading More Posts
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes
                  Reply
                  • Reply as topic
                  Log in to reply
                  Community
                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                  The ioBroker Community 2014-2023
                  logo