Local realtime person detection for RTSP cameras

Sorry for the delayed response, but yepp, just enabled save clips, added the appropriate roles, and that’s it.

The problem wound up being - I had save_clips enabled, but didn’t have the cameras set up with the ‘clips’ role.

Below is my config so you can see what I needed to do to make it work. 1xReolink RLC-420, 2xReolink RLC-410

Hi! I had similar problem with Reolink NVR. This was happening when using RTSP streams. When I changed to RTMP streams issue went away.

When the stream jumps is it the actual live stream? I’ve seen an issue where the HA stream of a ‘live’ feed is actually a view of the past.

I’m getting a lot of errors in the terminal output when running frigate:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x555725053140] moov atom not found
/tmp/cache/driveway-20201216144516.mp4: Invalid data found when processing input
frigate.events                 INFO    : bad file: driveway-20201216144516.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5555881a1140] moov atom not found
/tmp/cache/backyard-20201216144514.mp4: Invalid data found when processing input
frigate.events                 INFO    : bad file: backyard-20201216144514.mp4
watchdog.driveway              INFO    : Terminating the existing ffmpeg process...
watchdog.driveway              INFO    : Waiting for ffmpeg to exit gracefully...
watchdog.backyard              INFO    : Terminating the existing ffmpeg process...
watchdog.backyard              INFO    : Waiting for ffmpeg to exit gracefully...

Any idea what that is all about??

Those are related to the process that checks the cached video files used for clips. Frigate writes 10 second segments directly from the camera to disk. Before assembling a clip from those cached segments, it uses ffprobe to check the integrity of the mp4 file. The errors you are seeing are from that ffprobe check. For some reason, those cache segments have invalid data. Most of the time, it is because the ffmpeg process saving them exited before it was finished writing the file (ie. the “Terminating the existing ffmpeg process…”).

Is it anything I can fix? Or is it normal?

It is expected to happen when ffmpeg loses connection to your camera. If you can get the camera stream to stabilize, that series of errors should go away. I would try setting to ffmpeg logs on one camera to something higher than fatal to see why ffmpeg is exiting.

Great, thanks for that. Its a camera I actually wasn’t planning on monitoring with Frigate and was just using it for testing purposes so I’ll probably just remove it from the config and be on my way. Although all my cameras are the same and that particular one was the only one giving me issues. If I have the same problem with the others I’ll do as you suggest.

Thanks for the great program (yes, I still call them that and not apps)!

Does the NVR output an RTMP stream? I’ve never seen online where it does, and I’ve got B800 camera’s so I can’t use a stream direct from the camera.

It’s live, although there’s a few seconds delay but I think that’s normal. I’ve stood outside in the camera range and saw myself while it jumped around lol. And the HA stream of the same camera stays solid.

I did start to wonder if I had too many connections to the NVR. I had setup Frigate, HA, Tiny Cam on my phone and my tv. So now I’ve spun up Neolink in an Ubuntu LXC and connecting that to the NVR. Now Frigate and Tiny Cam are both connecting to Neolink instead of direct to the NVR, and Frigate is rebroadcasting an RTMP stream that I’m using for the camera stream in HA. So far, it’s been solid this way and stayed through a reboot when I updated to 2020.12

This is the style/url which works for me;

rtmp://192.168.1.1/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=admin

Using NVR’s IP, and cameras are in format channel0, channel1 etc.

I have RLN8-410 NVR with RLC-410 and RLC-510 cameras, so not sure if it will work your camera type.

GPUs for Tensorflow processing is not supported. See earlier posts by @blakeblackshear on the topic. Only CPU or Google Gorals.

There is support for using your GPU to hardware accelerate the decoding of the MP4 streams (ffmjpeg) but that’s under a different part of the config.

Hope someone can help please, i think im getting confused with which versions I am using for integrations and addons

The addon
" Frigate NVR Beta

Current version: 1.0

(changelog)

NVR with realtime local object detection for IP cameras.
Visit Frigate NVR Beta page for details."

Its version 1 but 0.8.0 Beta 1 and the url goes to “https://github.com/blakeblackshear/frigate” but they are the old instructions? and we should be using this “https://github.com/blakeblackshear/frigate/tree/release-0.8.0#installing

and “https://github.com/blakeblackshear/frigate-hass-integration” to get the Hacs integration installed.

This is where i am struggling, I tried http://ccab4aaf-frigate:5000 , http://ccab4aaf-frigate-beta:5000 ,
http://192.168.1.246:5000 but not able to start/enable the integration with “Unable to connect to Frigate.”
The frigate addon has started but the show in sidebar link only gives me “502: Bad Gateway”

I’m running hassos on a VM on Unraid.

Any help appreciated please

You have everything right. What do the logs show for the addon?

  • Starting nginx nginx
    …done.
    frigate.app INFO : Creating directory: /tmp/cache

This is all it shows
I have in the config
logger:
default: info

  coral:
    type: cpu
mqtt:
  host: 192.168.1.201
  topic_prefix: frigatetest
  client_id: frigatetest
  user: XXXXXXX
  password: XXXXXXXX
ffmpeg: {}
cameras:
  conservatory:
    ffmpeg:
      inputs:
        - path: >-
            rtmp://192.168.1.119/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=XXXXXXXXX
          roles:
            - detect
            - rtmp
    width: 1280
    height: 720
    fps: 5
    best_image_timeout: 60
    mask: 'poly,0,7,0,446,1191,375,1969,457,2559,224,2559,0,112,2'
logger:
  default: info
save_clips:
  max_seconds: 300
  retain:
    default: 10
    objects:
      person: 15
      cat: 15
objects:
  track:
    - person
zones: null
trees:
  rtmp:
    enabled: true
  snapshots:
    show_timestamp: true
    draw_zones: true
    draw_bounding_boxes: true
    crop_to_region: true
    height: 175

For my 10th Gen processor, I’ve rebuild the ffmpeg binary in my 0.8.0-beta1 container and installed the required drivers
./configure --enable-libmfx && make -j8 && make install
As stated on https://trac.ffmpeg.org/wiki/Hardware/QuickSync

root@a2f34a690add:/opt/frigate# ffmpeg -hwaccels
ffmpeg version N-100411-g32586a42da Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --enable-libmfx
  libavutil      56. 62.100 / 56. 62.100
  libavcodec     58.115.102 / 58.115.102
  libavformat    58. 65.100 / 58. 65.100
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 93.100 /  7. 93.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
Hardware acceleration methods:
vaapi
qsv

It has now QuickSync support enabled

In the config.yml i have modified the ffmpeg params:

ffmpeg:
  global_args: -hide_banner -loglevel fatal
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128

These changes made my CPU usage drop from ~25% to 5%
Would it be possible to have qsv support enabled by default in your builds?

1 Like

Absolutely. Thanks for tracking this down.

1 Like

What if you hit the refresh button on the log output?You should have a validation error if that is your config.

1 Like

refresh didn’t make a difference but just cleared my browser cache and now finding config errors and showing as stopped

Cheers, the simplest things can catch us out :frowning:

Just wanted to check if it was on your plans to include the ability to turn on/off saving clips dynamically? For example, I don’t really care to save clips on cameras inside my house when I’m home. I saw a couple similar FRs in github, but dont think i saw this one specifically