Local realtime person detection for RTSP cameras

i have BlueIris in the middle.
C800 ->BI-> Frigate … this works as well for view clips

streaming with the new C800 directly to frigate works but as already explained the browser ist not able to decode it.

@TobiasGJ

Good to know! I actually have a computer with BI that I don’t use. Does this workaround introduce any significant delay to the stream? How many cameras are you running this way?

@akifbayram

Just like Tobias said the new version only has h.265(+). A benefit of this version is that it also includes a microphone, which in my use case, is an improvement. The design is different, but apart from that, it seems to have the same specs as the previous version.

@paulstronaut

Do you know what the args would be like? I’ve been digging around on the ffmpeg website without getting any wiser.

It would be convenient if everything could be done using the same machine, without a separate windows machine for BI.

1 Like

Hi,

I’m trying to do the same but just get the frigate error “ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures”… the zm streams work fine in my browser but suspect its my ffmpeg settings… can you share yours please?

I just upgraded from 0.6.0 to 0.8.1 and have everything up and running (after redoing my config based on the docs). Everything is working properly (thank you for the great component!) but I can’t seem to get snapshot notifications to work. I have tried the example in the docs but no snapshot ever gets sent. I am running hass & frigate in docker. I checked the frigate/events and i see the messages. I also checked the clips folder, and there are jpg’s in there, so I am not sure where the hang up is. I use Duckdns and LE for my public hass address. Any thoughts on where I could start to look.

I would suggest opening an issue on GH and including your notification yaml.

The default args are listed here.

These output_args may work:

  output_args:
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an
    # Optional: output args for clips streams (default: shown below)
    clips: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an
    # Optional: output args for rtmp streams (default: shown below)
    rtmp: -c:v libx264 -f flv

There are tons of options around quality, etc that can impact performance of the re-encode.

These are the input_args I use on Frigate 0.7.3 for the mjpeg Zoneminder cameras:

      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer
        - -flags
        - low_delay
        - -strict
        - experimental
        - -fflags
        - +genpts+discardcorrupt
        - -r
        - '3'
        - -use_wallclock_as_timestamps
        - '1'

You will need to adjust them for the other roles that are included in 0.8.x as well.

1 Like

Many many thanks for this, no idea how you figured out those params but its working a treat.

I wonder, have you noticed that in the frigate config the fps param no longer limits the frames when your taking the stream from zoneminder? I had it set to 5 and it worked when I was streaming from the camera but not when streaming from zoneminder

That worked, but my 10th gen i5 NUC CPU usage rose to 97% (normally around 4%).
It gave significant compression artefacts along lines in the image and when I’m checking the properties for the clips it suggests they are 50fps. And also, the clips seem to be out of time, and filmed prior to me entering the “scene”.

I don’t wanna take your time, you are already giving us more support than expected, but do you think it is reasonable to acheive what I’m trying here? Eventually I would like to have five or so of these cameras.

Yeah, it’s likely because it’s an mjpeg stream without keyframing or any of the nice things that RTSP has. If you limit the framerate via the ZM url (as I do with &maxfps=3) and in the Frigate config as well, everything seems to play nicely in my experience.

1 Like

If it was me I would just get cameras that support h264 instead. You can probably tune the conversion to reduce load and may even be able to get hwaccel to work for encoding again. That should lower the CPU required, but it’s just unnecessary overhead. I’m not sure how low you can get it, but I’m sure you can do much much better. You can use the generated ffmpeg command from frigate and run it anywhere for quicker testing of different options.

1 Like

ah I’d not thought of that cheers… the only other thing I’ve noticed is the clips frigate now writes don’t seem to be playable… guessing I’ve got to figure out some new output_args now too

Yeah, just make sure that everything is being converted to h264 and Frigate should work as intended. You can also get a shell into the Frigate Docker container and run ffmpeg directly to try various arguments. I’ve found that’s easier to debug and figure out what works than restarting Frigate with new args every time I want to try one.

Help me. Instance only one.

On connect called


    main()


  File "detect_objects.py", line 196, in main


    ffmpeg_input = get_ffmpeg_input(ffmpeg['input'])


KeyError: 'input'
mqtt:
  host: 192.168.88.37
cameras:
  frontdoor:
    ffmpeg:
      inputs:
        - path: http://192.168.88.37:8585/zm/cgi-bin/nph-zms?mode=jpeg&monitor=2&scale=0&maxfps=5
          roles:
            - detect
            - rtmp
    width: 704
    height: 576
    fps: 5

Looks like you are using an old version of Frigate. Your config file is for 0.8.x. Upgrade Frigate to 0.8.x and your config should work.

1 Like

docker version 0.8.1-amd64

Cooldown Period:
Question: is it possible to configure a cooldown period in the config?

Means if a motion was happened, the system wait e.g. for 1 minute to accept new motions.

Hi,
I recently started seeing this error with frigate failing to start:

 * Starting nginx nginx
   ...done.
Error parsing config: 'mqtt'

even when i try it with following config:

detectors:
  coral:
    type: edgetpu
    device: 'usb:0'
mqtt:
  host: 192.168.86.99
  topic_prefix: frigate
  user: mqtt_username
  password: pwd
ffmpeg: {}
cameras: {}

Im on frigate beta v 1.8 and HA 2021.1.5

It worked fine and suddenly stopped working without me touching it and started throwing the above error. Just wonder if anyone had similar issues or can point out in direction of fixing it please?

Thanks,
Alex

I’m assuming you’re running Home Assistant OS/Supervised. If so, this is a known issue. HA made some underlying supervisor changes that broke Frigate and other integrations. You need to upgrade Frigate and the integration to the latest version for the fixes (the stable branch is more up-to-date than the beta). After you upgrade, your Frigate config file will have to be named frigate.yml and placed in the HA config directory.

I achieve this right now with Home Assistant so that I’m not notified of new objects every time Frigate sends new info about a detection. You can set a 00:01:00 delay at the end of your automation (in automation mode Single) so that it only runs once per minute.