Local realtime person detection for RTSP cameras

Sorry, I also update and got erros… and I don’t know where to start…

cameras -> schuurachter -> ffmpeg -> inputs -> 0 -> roles -> 1
  value is not a valid enumeration member; permitted: 'record', 'rtmp', 'detect' (type=type_error.enum; enum_values=[<CameraRoleEnum.record: 'record'>, <CameraRoleEnum.rtmp: 'rtmp'>, <CameraRoleEnum.detect: 'detect'>])
cameras -> schuurachter -> clips
  extra fields not permitted (type=value_error.extra)
cameras -> schuurachter -> fps
  extra fields not permitted (type=value_error.extra)
cameras -> schuurachter -> height
  extra fields not permitted (type=value_error.extra)
cameras -> schuurachter -> width
  extra fields not permitted (type=value_error.extra)
cameras -> parkeerplaats -> ffmpeg -> inputs -> 0 -> roles -> 1
  value is not a valid enumeration member; permitted: 'record', 'rtmp', 'detect' (type=type_error.enum; enum_values=[<CameraRoleEnum.record: 'record'>, <CameraRoleEnum.rtmp: 'rtmp'>, <CameraRoleEnum.detect: 'detect'>])
cameras -> parkeerplaats -> clips
  extra fields not permitted (type=value_error.extra)
cameras -> parkeerplaats -> fps
  extra fields not permitted (type=value_error.extra)
cameras -> parkeerplaats -> height
  extra fields not permitted (type=value_error.extra)
cameras -> parkeerplaats -> width
  extra fields not permitted (type=value_error.extra)
cameras -> voortuin -> ffmpeg -> inputs -> 0 -> roles -> 1
  value is not a valid enumeration member; permitted: 'record', 'rtmp', 'detect' (type=type_error.enum; enum_values=[<CameraRoleEnum.record: 'record'>, <CameraRoleEnum.rtmp: 'rtmp'>, <CameraRoleEnum.detect: 'detect'>])
cameras -> voortuin -> clips
  extra fields not permitted (type=value_error.extra)
cameras -> voortuin -> fps
  extra fields not permitted (type=value_error.extra)
cameras -> voortuin -> height
  extra fields not permitted (type=value_error.extra)
cameras -> voortuin -> width
  extra fields not permitted (type=value_error.extra)
cameras -> terras -> ffmpeg -> inputs -> 0 -> roles -> 1
  value is not a valid enumeration member; permitted: 'record', 'rtmp', 'detect' (type=type_error.enum; enum_values=[<CameraRoleEnum.record: 'record'>, <CameraRoleEnum.rtmp: 'rtmp'>, <CameraRoleEnum.detect: 'detect'>])
cameras -> terras -> clips
  extra fields not permitted (type=value_error.extra)
cameras -> terras -> fps
  extra fields not permitted (type=value_error.extra)
cameras -> terras -> height
  extra fields not permitted (type=value_error.extra)
cameras -> terras -> width
  extra fields not permitted (type=value_error.extra)
[cmd] python3 exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

those are easy, you need to rewrite your config, move as per documentation. I was also shocked at first but after 30minutes all fixed.
Remove all mention on clips.
Add record True with retention false (if you don’t use 24/7 recording) and move your settings frrom clips to record

clips is no longer a valid role and should be removed

FPS not needed

This is an example of 1-5 cams:


cameras:
# FRONT Camera ########################################################################################################
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
#            - rtmp
    width: 2560
    height: 1440
    fps: 6
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - dog
        - cat
    motion:
      mask:
        - '1090,81,1216,0,1382,34,1532,99,1518,259,1426,363,1123,247'
        - '1766,498,1753,669,1778,722,1829,773,1863,825,1906,884,1924,955,1953,1065,2237,1169,2255,1128,2295,1046,2338,946,2378,841,2410,743,2215,647,2190,582,2138,512,2010,402,1859,351'
    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 2
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 2
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - person
        - dog
        - cat
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
      required_zones: []
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 10
        # Optional: Per object retention days
        objects:
          person: 200
          dog: 20
          cat: 200

What should I do with the “clips” section then?

Frigate Integration will not connect after update and followed the new config based on item 3 in new document.

`Frigate
URL you use to access Frigate (ie. http://frigate:5000/)

If you are using HassOS with the addon, the URL should be http://ccab4aaf-frigate:5000/

Home Assistant needs access to port 5000 (api) and 1935 (rtmp) for all features.

The integration will setup sensors, cameras, and media browser functionality.

Sensors:

Stats to monitor frigate performance
Object counts for all zones and cameras
Cameras:

Cameras for image of the last detected object for each camera
Camera entities with stream support (requires RTMP)
Media Browser:

Rich UI with thumbnails for browsing event clips
Rich UI for browsing 24/7 recordings by month, day, camera, time
API:

Notification API with public facing endpoints for images in notifications
Failed to connect
 
URL
http://ccab4aaf-frigate:5000
`
New  Config.yml Frigate

URL you use to access Frigate (ie. `http://frigate:5000/`)

If you are using HassOS with the addon, the URL should be `http://ccab4aaf-frigate:5000/`

Home Assistant needs access to port 5000 (api) and 1935 (rtmp) for all features.

The integration will setup sensors, cameras, and media browser functionality.

Sensors:

* Stats to monitor frigate performance
* Object counts for all zones and cameras

Cameras:

* Cameras for image of the last detected object for each camera
* Camera entities with stream support (requires RTMP)

Media Browser:

* Rich UI with thumbnails for browsing event clips
* Rich UI for browsing 24/7 recordings by month, day, camera, time

API:

* Notification API with public facing endpoints for images in notifications

Failed to connect

URL

SUBMIT
```
mqtt:
  host: 192.168.0.74
  topic_prefix: frigate
  client_id: frigate
  user: mikey
  password: xxxxxx


detectors:
  cpu1:
    type: cpu
    num_threads: 3

cameras:
    camera1:front_driveway:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/h264Preview_01_sub
          roles:
            - detect
    width: 1280
    height: 720
````
 Any idea where i am  going wrong as  i am trying to setup agin in HASSO
  CAM_obyvak:

    ffmpeg:
      inputs:
        - path: rtsp://xxxx:xxxx@xxxx:554/cam/realmonitor?channel=1&subtype=0&authbasic=xxxxx
          roles:
            - detect



    zones:
      zone_0:
        coordinates: 0,1080,1429,1080,1855,583,1876,490,1309,380,1333,0,0,0
    detect:
      enabled: True
      max_disappeared: 25
      width: 1920
      height: 1080
      fps: 5
      #best_image_timeout: 60

    record:
      enabled: False
      retain_days: 0
      events:
        post_capture: 10
        pre_capture: 5
        objects:
          - person
        retain:
          default: 5
    rtmp:
      enabled: False
    snapshots:
      enabled: True
      timestamp: False
      bounding_box: True
      crop: False
      retain:
        default: 5
        #objects:
          #person: 15
    mqtt:
      enabled: False
      timestamp: True
      bounding_box: True
      crop: True
      height: 270
    objects:
      track:
        - person
      filters:
        person:
          min_area: 1000
          max_area: 100000
          min_score: 0.5
          threshold: 0.77

No 24/7 recording

I totally do not get this:

cameras:
# FRONT Camera ########################################################################################################
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            #- clips
#            - rtmp
    detect:
      width: 2560
      height: 1440
#    fps: 6
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - dog
        - cat
    motion:
      mask:
        - '1090,81,1216,0,1382,34,1532,99,1518,259,1426,363,1123,247'
        - '1766,498,1753,669,1778,722,1829,773,1863,825,1906,884,1924,955,1953,1065,2237,1169,2255,1128,2295,1046,2338,946,2378,841,2410,743,2215,647,2190,582,2138,512,2010,402,1859,351'
#    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
#      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
#      pre_capture: 2
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
#      post_capture: 2
      # Optional: Objects to save clips for. (default: all tracked objects)
#      objects:
#        - person
#        - dog
#        - cat
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones: []
      # Optional: Camera override for retention settings (default: global values)
#      retain:
        # Required: Default retention days (default: shown below)
#        default: 10
        # Optional: Per object retention days
#        objects:
#          person: 200
#          dog: 20
#          cat: 200

with this errors:

[services.d] starting services


[services.d] done.


[2021-10-08 16:15:28] frigate.app                    INFO    : Starting Frigate (0.9.1-800f33e)


Error parsing config: 26 validation errors for FrigateConfig


ffmpeg -> output_args -> clips


  extra fields not permitted (type=value_error.extra)


cameras -> voordeur -> ffmpeg -> inputs -> 0 -> roles -> 1


  value is not a valid enumeration member; permitted: 'record', 'rtmp', 'detect' (type=type_error.enum; enum_values=[<CameraRoleEnum.record: 'record'>, <CameraRoleEnum.rtmp: 'rtmp'>, <CameraRoleEnum.detect: 'detect'>])


cameras -> voordeur -> clips


  extra fields not permitted (type=value_error.extra)


cameras -> voordeur -> fps


  extra fields not permitted (type=value_error.extra)


cameras -> voordeur -> height


  extra fields not permitted (type=value_error.extra)


cameras -> voordeur -> width


  extra fields not permitted (type=value_error.extra)

what’s wrong there?

did you save the config before restart? maybe save and restart again

Its still saying you have clips as a role and heig tht/width/fps under FFMPEG section but above looks correct so I thinking it not saved before you try restart

I really did… Not

Another question. How do I delete all recordings? and database?

If its a one time thing just delete the db file in config and remove all the media files?

But better would be to make a retention period in settings. No need to do it manualy

I understand that. But my question is where and how :slight_smile:

Go to File editor(not manager sorry) find the db file and come back confirm and we go next

I think I have a lot of orphans

Sorry, again. Where?

1 Like

Added

          roles:
            - detect
            - record

Same error, cant play and cant download.
update i checked NAS, mp4 file was not created. Stupid me,didn’t checked that at first place.
So it is not creating video, will try to figure what changed between updates as it was working before.

I do not run the homeassistant addon. I run a docker container on a separate host. Where is the database file located?

The file edit is just a tool to get to the files.

1 Like

I think you have it right setting the detect & record roles under you camera. In order to get clips, I believe you need to enable recording globally but set your retention to zero if you do not want to do 24/7

@blakeblackshear may need to correct me on this one…

record:
enabled: true
retain_days: 0