Local realtime person detection for RTSP cameras

Reduce max_area for person:

person:
          max_area: 10000  # or something similar

Stand at different places in the screen and see what size an actual human occupies. The size is mentioned next to the % over the bounding box.

1 Like

I can’t seem to figure out why my camera.[name] created by Frigate won’t show up Live on Lovelace dashboards. Whether I’m using a generic card or the Frigate card live views never show up. Alternatively, I setup the same camera via ONVIF or RTSP and it shows up.

If I try accessing the RTMP stream via the address http://homeassistant.local:5000/live/[camera_name] I get the following

Traceback (most recent call last):
  File "/usr/lib/python3.8/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python3.8/dist-packages/ws4py/server/wsgiutils.py", line 101, in __call__
    raise HandshakeError('Header %s is not defined' % key)
ws4py.exc.HandshakeError: Header HTTP_UPGRADE is not defined
[2021-10-20 10:53:41] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:59452]

Any advice?

1 Like

Proxmox lxc install, hassOS in a vm with proxy all running lovely but internal storage is low.

can an external drive be used just for frigate storage?

Does anyone know how to calculate the total amount of clips in the frigate media library?
Frigate is reporting count of clips per cam and day in a json .

It would be nice to have a sensor showing number of clips per cam and day…
But I cant create templates for this … My knowledge in templating with json is near to zero. :frowning:

The stats is available through /api/events/summary

Thank you! That has pointed me in the right direction. After the last major update and based on what others were going, I moved a lot of my config to global settings. I see now that filters for person detection need to be tweaked on a per camera basis.

Unfortunately i am not able to help, just know that its possible doing it this way.

Hi. Ok, no problem, thanks anyway. :slight_smile:

1 Like

Bump, no advice why RTMP streaming live to Lovelace doesn’t work?

If i were you i would write issue on github.

HI,

after the upgrade to the 0.9.1-800F33E version (that contains amazing new features!!!) i started experienced some issues with the camera stream. the FPS goes to 0 and i see the following messages in the log

[2021-10-20 18:22:58] ffmpeg.camera1.record          ERROR   : [h264 @ 0x55843f0040] decode_slice_header error
[2021-10-20 18:22:58] ffmpeg.camera1.record          ERROR   : [h264 @ 0x55843f0040] no frame!
[2021-10-20 18:22:58] ffmpeg.camera1.record          ERROR   : [h264 @ 0x55843f0040] non-existing PPS 0 referenced

[2021-10-21 06:54:40] ffmpeg.camera1.record          ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
[2021-10-21 06:54:40] ffmpeg.camera1.record          ERROR   : Could not write header for output file #0 (incorrect codec parameters ?): No space left on device
[2021-10-21 06:54:40] ffmpeg.camera1.record          ERROR   : 
[2021-10-21 06:54:40] watchdog.camera1               INFO    : Terminating the existing ffmpeg process...
[2021-10-21 06:54:40] watchdog.camera1               INFO    : Waiting for ffmpeg to exit gracefully...
[2021-10-21 06:54:42] watchdog.camera2               ERROR   : FFMPEG process crashed unexpectedly for camera2.
[2021-10-21 06:54:42] watchdog.camera2               ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.

when i start the docker container i don’t see any error in the log

frigate_camera_tpu | [2021-10-21 20:59:22] frigate.app                    INFO    : Camera processor started for camera1: 224
frigate_camera_tpu | [2021-10-21 20:59:22] frigate.app                    INFO    : Camera processor started for camera2: 226
frigate_camera_tpu | [2021-10-21 20:59:22] frigate.app                    INFO    : Capture process started for camera1: 228
frigate_camera_tpu | [2021-10-21 20:59:22] frigate.app                    INFO    : Capture process started for camera2: 230
frigate_camera_tpu | [2021-10-21 20:59:22] ws4py                          INFO    : Using epoll
frigate_camera_tpu | [2021-10-21 20:59:24] frigate.edgetpu                INFO    : TPU found

any ideas?
Regards

Hi, any updates on that? I have the exact same situation.
Thanks!

I have the same issue. It runs fine for a while then I get this “no space on device”.
For all I can see I have plenty of space on host, HASS and Frigate containers

Have latest Frigate running ( 0.9.2-EF82C5C)

I had oringally installed the HA frigate integration vai HACS V1.1.0 and worked while on Frigate 0.8

Recentl updated the integration to v2.1.0 via HACS and the integration will not load on the integrations page. Advises to check logs - see below.

I have tried to delete it from the integrations page also but nothing happens.

Any advice on how to resolve?

Logger: aiohttp.server
Source: custom_components/frigate/__init__.py:23
First occurred: 12:20:14 (1 occurrences)
Last logged: 12:20:14

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 81, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 70, in delete
    result = await hass.config_entries.async_remove(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 684, in async_remove
    unload_success = await self.async_unload(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 786, in async_unload
    return await entry.async_unload(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 331, in async_unload
    component = integration.get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 477, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/frigate/__init__.py", line 23, in <module>
    from homeassistant.const import ATTR_MODEL, CONF_HOST, CONF_URL
ImportError: cannot import name 'ATTR_MODEL' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

This really is a fantastic bit of work. I’ve done away with a dedicated CCTV DVR and now have it all running in HA.
When used with the integration and frigate card even better.

I’m using a tablet to show Birdseye mode when any camera detects an object.

This works great but is there a way to set the dwell time for the camera in birdseye mode when the object is no longer being detected?

1 Like

me too, i started to reduce the retention days… let see if there is any difference

I have frigate running on docker on a pi4/4GB/SSD with coral.
Camera is Reolink RLC-820a.
Frigate is up and recognizing objects and saving images with events.
Recordings are not playable and there are errors logged. Disabling rtmp changes the error but doesn’t fix anything.
I’m using the h264 640x360 stream for detections and trying to record using the h265 3840x2160.
(help much appreciated)

playback error:
**

Error: The media could not be loaded, either because the server or network failed or because the format is not supported
**

frigate log error (repeats):

ffmpeg.garageEast.record_rtmp ERROR :
watchdog.garageEast INFO : Terminating the existing ffmpeg process…
watchdog.garageEast INFO : Waiting for ffmpeg to exit gracefully…
frigate.record WARNING : Discarding a corrupt recording segment: garageEast-20211022171904.ts
ffmpeg.garageEast.record_rtmp ERROR : [flv @ 0x1cac7c0] Video codec hevc not compatible with flv
ffmpeg.garageEast.record_rtmp ERROR : Could not write header for output file #1 (incorrect codec parameters ?): Function not implemented

With rtmp set to enabled: false, this is the error:

frigate.http ERROR : ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers

built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)

configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-omx --enable-omx-rpi --enable-mmal --enable-v4l2_m2m --enable-neon --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib

libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
pipe:: Invalid data found when processing input


Config.yml:

> mqtt:
>   host: homeassistant
>   user: nvrmqtt
>   password: djf98435sUYa
> detectors:
>   coral:
>     type: edgetpu
>     device: usb
> objects:
> # Optional: list of objects to track from labelmap.txt (default: shown below)
>   track:
>     - person
>     - squirrel
>     - car
>     - bicycle
>     - bird
>     - dog
>     - cat
>     - orange
> birdseye:
>   # Optional: Enable birdseye view (default: shown below)
>   enabled: true
>   # width: 1280
>   # height: 720
>   # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
>   quality: 8
>   #   objects - cameras are included if they have had a tracked object within the last 30 seconds
>   #   motion - cameras are included if motion was detected in the last 30 seconds
>   #   continuous - all cameras are included always
>   mode: motion
> cameras:
>   garageEast:
>     ffmpeg:
>       inputs:
>         - path: rtsp://HAaccess:Ca0l1nn111@cam_gareast:554/h264Preview_01_sub
>           roles:
>             - detect
>         - path: rtsp://HAaccess:Ca0l1nn111@cam_gareast:554/h265Preview_01_main
>           roles:
>             - rtmp
>             - record
>     motion:
>       threshold: 25
>       contour_area: 100
>       mask:
>         -  0,32,200,32,200,0,0,0
>     detect:
>       fps: 5
>       width: 640
>       height: 360
>       enabled: true
>     record:
>       enabled: True
>       retain_days: 0
>       events:
>         max_seconds: 300
>         retain:
>           default: 1
>         pre_capture: 2
>         post_capture: 5
>     # motion:
>       # mask: 2560,220,2196,220,2196,475,2560,475
>     zones:
>       alley_detect: # detect zone
>         coordinates: 757,2160, 757,921, 3840,921 ,3840,2160
>         coordinates: 640,360,242,360,242,149,640,149
>         objects:
>           - person
>           - car
>       lot_ignore: #ignore zone due to parking lot
>         objects:
>           - car
>         coordinates: 482,140,482,101,568,107,568,140
>     # Optional: Configuration for the jpg snapshots written to the clips directory for each event
>     snapshots:
>       # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
>       enabled: true
>       timestamp: true
>       bounding_box: false
>       crop: False
>         # Optional: height to resize the snapshot to (default: original size)
>       # height: 500
>       # Optional: Camera override for retention settings (default: global values)
>       retain:
>         # Required: Default retention days (default: shown below)
>         default: 7
>         # Optional: Per object retention days
>         # objects:
>           # person: 14
>     rtmp:
>       enabled: true

ffprobe output:
h264:

Input #0, rtsp, from ‘rtsp://HAaccess:Ca0l1nn111@cam_gareast:554/h264Preview_01_sub’:
Metadata:
title : Session streamed by “preview”
comment : h264Preview_01_sub
Duration: N/A, start: 0.000188, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x360, 24.92 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

h265:

Input #0, rtsp, from ‘rtsp://HAaccess:Ca0l1nn111@cam_gareast:554/h265Preview_01_main’:
Metadata:
title : Session streamed by “preview”
comment : h265Preview_01_main
Duration: N/A, start: 0.000250, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Got same error 2 days ago. This happened after I replace HDD and not move all video file (Videos were not accessible and some had incorrect user).

After I move the files and all files accessible error was gone.

1 Like

Thanks, but brand new install here - no old files or events.

My experience is these types of questions are best asked and answered on the frigate github.

are all clips and recording now saved in the clips folder? no recordings folder with latest version?

thanks