Local realtime person detection for RTSP cameras

What kind of camera is it? If possible, make sure it’s sending Frigate RTSP h264 video. If it’s sending rtmp or mjpeg, you’ll need to adjust the ffmpeg args if you cannot adjust the format of the camera output.

@blakeblackshear i opened an issue on github about the addon, now i get 2 images on docker, 1.10 and 0.8.1. The addon is using 1.10 one but i am unable to delete 0.8.1 as it say that has a child images being used. Both are 845 MB so the old image is wasting space on my snapshots

Hello @hawkeye217

As I mentioned, it’s a Ubiquiti G3 Flex streaming through Unifi’s Protect packge. As I’m sure you don’t carry around every camera in your head, this is what VLC says the stream is:
Screenshot 2021-02-12 at 15.23.32

It certainly seems to be h264.

You could try changing your ffmpeg global_args to:

global_args: -hide_banner -loglevel debug

And then change the frigate log level to

logger:
  default: debug

And see what ffmpeg is telling you then.

Here is the (start of) the error stream:

frigate.edgetpu                INFO    : TPU found

frigate.app                    INFO    : Capture process started for gate: 37

frigate.mqtt                   DEBUG   : on_clips_toggle: frigate/gate/clips/set ON

frigate.mqtt                   INFO    : Turning on clips for gate via mqtt

frigate.mqtt                   DEBUG   : on_snapshots_toggle: frigate/gate/snapshots/set ON

frigate.mqtt                   INFO    : Turning on snapshots for gate via mqtt

watchdog.gate                  INFO    : No frames received from gate in 20 seconds. Exiting ffmpeg...

watchdog.gate                  INFO    : Waiting for ffmpeg to exit gracefully...

frigate.video                  INFO    : gate: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures

frigate.video                  INFO    : gate: ffmpeg sent a broken frame. read of closed file

frigate.video                  INFO    : gate: ffmpeg sent a broken frame. read of closed file

frigate.video                  INFO    : gate: ffmpeg process is not running. exiting capture thread...

ffmpeg.gate.detect             ERROR   : Error while decoding stream #0:1: Unknown error occurred

ffmpeg.gate.detect             ERROR   : cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)

ffmpeg.gate.detect             ERROR   :     Last message repeated 4 times

ffmpeg.gate.detect             ERROR   : [h264_mmal @ 0x1be7710] MMAL error 2 on control port

ffmpeg.gate.detect             ERROR   :     Last message repeated 5 times

ffmpeg.gate.detect             ERROR   : [h264_mmal @ 0x1be7710] Did not get output frame from MMAL.

ffmpeg.gate.detect             ERROR   : Error while decoding stream #0:1: Unknown error occurred

ffmpeg.gate.detect             ERROR   : cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)

ffmpeg.gate.detect             ERROR   : [h264_mmal @ 0x1be7710] MMAL error 2 on control port

ffmpeg.gate.detect             ERROR   :     Last message repeated 4 times

ffmpeg.gate.detect             ERROR   : [h264_mmal @ 0x1be7710] Did not get output frame from MMAL.

ffmpeg.gate.detect             ERROR   : Error while decoding stream #0:1: Unknown error occurred

(this is with the vanilla hwaccel_args)

Might want to try setting gpu_mem=256 in your /boot/config.txt… Other than that, not sure what the issue could be. I have Frigate running on an i7 and a Pi4 64 bit and I use the respective hwaccel options for each platform without an issue.

1 Like

Thanks @hawkeye217. I will try that and report back.

Yay, that sorted out the problem. Now no errors and no CPU being maxed out. Thanks! (One for the Troubleshooting and FAQ section, maybe?)

Any ideas on problem #2 - no clips? (I just spotted that I had set tmpfs_cache_size in config in spite of setting a temps in Docker, but it seems unlikely that was the killer issue.)

Question…
How to increase size of available size of clips directory when using docker?
Got an error. Running du -sh gives me a total size of 6.5G, while available disk space is over 100G …

The clips directory size is whatever size is available in the clips folder on the host partition. That’s not set from Frigate or Docker. Unless I’m not understanding what your issue is.

du -h tells you the size that the folder is taking up. Not the size remaining. Running df -h shows you usage and remaining sizes of all your partitions.

In case anyone else is struggling getting clips working - the trick (for me) was including - clips in the roles: for the camera. (And, of course, enabling it either in the .yml or via MQTT)

1 Like

Thank you for this post - I was just enabling clips and was getting this error:

WARNING : Camera XXXXX has clips enabled, but clips is not assigned to an input.

I added ‘- clips’ to my camera roles and the warning message cleared.

2 Likes

hello people.
is it possibl to record also sound ?

1 Like

Can anyone explain the difference between before and after in frigate events? And, an example of when to use each of them?

I have an automation that makes Alexa announce “someone is in the driveway” when a person is detected in my driveway zone. but which condition should I use, after or before? Will the before one make the announcement quicker earlier?

        conditions:
          - "{{ 'zone_front' in trigger.payload_json['after']['entered_zones'] }}"

or

        conditions:
          - "{{ 'zone_front' in trigger.payload_json['before']['entered_zones'] }}"

Messages are triggered upon a detection event’s creation, update (top score change or zone change), and end. The before/after nodes in each message’s payload convey the event’s preceding status (e.g., ‘before’)… and likewise the event’s current status (‘after’). In your case, you would want to key off of ‘after’ > current_zones, as initiating a TTS based on driveway’s showing up in ‘before’ > current_zones would cause Alexa to not broadcast the recording until a subsequent message. You’ll probably still nonetheless want to consider the output of ‘before’ > current_zones in your automation, just to ensure that you won’t be triggering duplicate TTS calls

1 Like

I’ve moved to the latest version now, and it is absolutely amazing.

I have a camera above my garage which looks out over two parked cars in the driveway and then to the street, is there anyway to not record clips when there is motion and it detects my cars which are still in the driveway? Ideally i’d like to be able to record clips of cars on the street and cars if they enter the driveway

YOU!!! are my god! Thanks will try!

when i remove -an my video is completey green… does not work then… but it’s ok :slight_smile: don’t need to hear everything :stuck_out_tongue:

Hey,

I tested the delay. Any way to improve it?

Testing Method - Turn on Tasmota light that I can see in the camera feed.

Delay
Watching light turn on in RL - instantaneous
Watching light turn on using Reolink app on Phone/windows 10 - < 1s second
Watching light turn on using Frigate UI (RTMP Stream) - 6 seconds
Difference between Reolink timestamp and Frigate UI (RTMP) timestamp - 6 seconds
Watching light turn on using the RTMP stream in VLC is 7 seconds
Watching light turn on using the RTSP stream in VLC is 1-1.5 seconds
Watching light turn on using Frigate UI (RTSP Stream) - 3 seconds

EDIT: Adding in other results just in case anyone stumbles across this and it helps them.