Local realtime person detection for RTSP cameras

Hi Karl,

Question 2, it appears as though bugger all browsers support h265.
See this: HEVC/H.265 video format | Can I use... Support tables for HTML5, CSS3, etc

Question 3, see this: Camera Configuration | Frigate

check to make sure your camera feed is h264 with AAC audio. If your camera doesn’t support a compatible format for RTMP, you can use the ffmpeg args to re-encode it on the fly at the expense of increased CPU utilization.

Question 4, this sounds like your sub-stream is outputting a 4:3 image. Can you check by streaming it in VLC and see what resolution it is. VLC tools menu bar item → Codec Information.

You’re right! thank you!

So i gave up.
after adding/changing the addon.json in the frigate part

  "privileged": [
    "NET_ADMIN",
    "SYS_ADMIN",
    "SYS_RAWIO",
    "SYS_TIME",
    "SYS_NICE",
    "DAC_READ_SEARCH",
    "SYS_MODULE"
  ],

Now giving new error

root@ccab4aaf-frigate:/opt/frigate# mount -vvv -t cifs -o username=xxx,password=xxx,domain=WORKGROUP  //192.168.x.x/3_hass /opt/frigate/test
mount.cifs kernel mount options: ip=192.168.x.x,unc=\\192.168.x.x\3_hass,user=xxx,domain=WORKGROUP,pass=********
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
root@ccab4aaf-frigate:/opt/frigate# 

Hi @asherw83
Thanks for replying.

Nothing supporting h265 is really frustrating more than anything else, but I suppose I’ll just have to wait for it to be supported. I get the same error in safari, which according to the chart you linked should work, no?

I did have a look at the rtmp streams, but for the life of me couldn’t figure out how to re-encode on the fly, as I kept seeing errors, or even crashes. I’m sure it won’t make a difference, but I’m running docker in unraid. Like I said some of the cameras will only output in h265, so re-encoding might have to be the option.

The sub stream is 4:3 but I was hoping I could force the view to be 16:9, the full stream is 16:9 but being a 4k image, I don’t really want to do motion detection on that.

ffmpeg.SideGate.clips_rtmp ERROR : Guessed Channel Layout for Input Stream #0.1 : mono

ffmpeg.SideGate.clips_rtmp ERROR : [flv @ 0x55c000c74e80] Video codec hevc not compatible with flv

ffmpeg.SideGate.clips_rtmp ERROR : Could not write header for output file #1 (incorrect codec parameters ?): Function not implemented

ffmpeg.SideGate.clips_rtmp ERROR 

Thanks ukro. I am running frigate in docker on jetson nano and pointing HA frigate integration to the Nano instance. The NFS mount happens on the jetson nano (not inside frigate docker container). Here is my fstab entry. I think I had to install some additional modules on jetson nano to enable NFS on nano and may only support NFS v3 (not v4 - I had to enable v3 on my QNAP NAS). Unfortunately I didn’t remember or document what I did to make NFS work on nano. The NFS mounted directory is then passed to docker instance with -v /mynfs/media:/media/frigate

# /etc/fstab: static file system information.
#
# <file system> <mount point>             <type>          <options>                               <dump> <pass>
192.168.1.1:/FrigateData /mnt/qnap nfs rw,hard,intr,_netdev,x-systemd.after=network-online.target 0 0

1 Like

Ohh man, so you are saying that you have HASSOS? or just all the neccesary dockers on some host OS? Please please tell me one thing, how did you manage to point HA frigate integration to the nano instance? That would be a live changer if you can set the IP for that :open_mouth:
Everything else what you said i fully understood and today i can confirm,many hours waisted and yeah main thing to mount on the host afterward everybody else just take it
Unfortunately on HASSOS itself its not possible to mount…

Hi there! Really appreciate if you can share your config to get detection in sub stream and clips from the main one!

I’m trying with my new reolink 820A and still no luck wondering how to do it.

I am running HASSOS supervised installed on Intel NUC. The frigate install is completely separate on a jetson nano. When you install the frigate integration on HASS, you are asked for the IP and port of the frigate instance per the official document:

Blockquote
The best way to integrate with HomeAssistant is to use the official integration. When configuring the integration, you will be asked for the Host of your frigate instance. This value should be the url you use to access Frigate in the browser and will look like http://<host>:5000/ . If you are using HassOS with the addon, the host should be http://ccab4aaf-frigate:5000 (or http://ccab4aaf-frigate-beta:5000 if your are using the beta version of the addon). HomeAssistant needs access to port 5000 (api) and 1935 (rtmp) for all features.

1 Like

Sure happy to try and help. See the relevant bits of my config below. This running on a Raspberry Pi 4B without a coral TPU mind…

ffmpeg:
  hwaccel_args:
    - -c:v
    - h264_v4l2m2m

detectors:
  cpu1:
    type: cpu
    num_threads: 4

cameras:
  front-camera:
    ffmpeg:
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer
        - -flags
        - low_delay
        - -strict
        - experimental
        - -fflags
        - +genpts+discardcorrupt
        - -rw_timeout
        - '5000000'
        - -use_wallclock_as_timestamps
        - '1'
      inputs:
        - path: rtmp://[CAMERA_IP]/bcs/channel0_sub.bcs?channel=0&stream=0&user=[USER]&password=[PASSWORD]
          roles:
            - detect
            - record
            - rtmp
        - path: rtmp://CAMERA_IP]/bcs/channel0_main.bcs?channel=0&stream=0&user=[USER]&password=[PASSWORD]
          roles:
            - clips
    width: 640
    height: 480
    fps: 5
1 Like

OHHHH MYYY GOOOOD man!! will try it, thank you very much!!!

Yo so it seems that i’m going to do the proxmox LXC, any luck? I am just starting with it.

Using this tutorials
https://steamforge.net/wiki/index.php/How_to_mount_a_Network_Share_in_a_Linux_Container_under_Proxmox
https://www.reddit.com/r/Proxmox/comments/glog5j/lxc_gpu_passthrough/

Now i’m going install it somehow ))

I tested:

  • double-take and DeepStack on Jetson Nano 4GB
  • frigate on Raspberry Pi4 -Coral Usb.
    After a little train (you can train not-matched faces via double-take web ui), it works.
    Great.
    I only report some instability issues (Frigate rarely crashes, but it is a known issue that the author is working on).

Okay so the problem was CACHE in chrome :))) cleared, continue to setup again much thanks !

Hi hoping for some assistance - Frigate up and running in home assistant as add on
Running on VM

  • have snapshot & clips in UI
    mqtt broker all good.
    Everything seems to work properly.
    Just can not get telegram notification to work
2021-04-24 13:10:11 ERROR (MainThread) [homeassistant.components.automation.notify_of_events] Notify of events: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'payload_json'
2021-04-24 13:10:11 ERROR (MainThread) [homeassistant.components.automation.notify_of_events] Error while executing automation automation.notify_of_events: Error rendering data template: UndefinedError: 'dict object' has no attribute 'payload_json'

This what I’m seeing in the logs - the automation is from the documentation.

  - alias: Notify of events
    trigger:
      platform: mqtt
      topic: frigate/events
    action:
      - service: notify.telegram_full
        data_template:
          message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
          data:
            photo:
              # this url should work for addon users
              - url: 'http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg'
                caption: 'A {{trigger.payload_json["after"]["label"]}} was detected on {{ trigger.payload_json["after"]["camera"] }} camera'

Thanks for any assistance

Hi Karl,
What model camera do you have?

On a side note, today I connected a camera that could do h265… I couldn’t for the life of me figure out how to get ffmpeg to convert to h264… feels like I got close but just couldn’t get the right parameters…

Hi Faieka,
I just got telegram notifications setup 3 days ago. This is my automation:

alias: Frigate - Person found - Notify Asher - Telegram
description: ''
trigger:
  - platform: mqtt
    topic: frigate/events
condition: []
action:
  - service: notify.ashertelegram
    data:
      message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
      data:
        photo:
          - url: >-
              https://myexternalurl.ui.nabu.casa/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
            caption: '{{trigger.payload_json["after"]["id"]}}'
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
mode: single

edit 2:
I’ve also setup my telegram as a webhook. Eg:

telegram_bot:
  - platform: webhooks
    api_key: mysuper:secretapikey
    allowed_chat_ids:
      - 11111111

edit:
If you manually send a notification to yourself using the dev tools does it work?

1 Like

@asherw83 Hi thanks for the response - No in dev tool it doesn’t work
I don’t use Nabu casa or webhooks yet.
funny enough, when i was using deepstacks before it was fine.

I tied using Node Red as well but no success

Logger: homeassistant.helpers.template
Source: helpers/template.py:1346
First occurred: 2:03:08 PM (4 occurrences)
Last logged: 2:03:54 PM

Template variable error: 'trigger' is undefined when rendering 'automation: - alias: Notify of events trigger: platform: mqtt topic: frigate/drive_way action: - service: notify.telegram_full data_template: message: 'A {{trigger.payload_json["after"]["label"]}} was detected.' data: photo: # this url should work for addon users - url: 'http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg' caption: 'A {{trigger.payload_json["after"]["label"]}} was detected on {{ trigger.payload_json["after"]["camera"] }} camera'} camera'''
Template variable error: 'trigger' is undefined when rendering 'A {{trigger.payload_json["after"]["label"]}} was detected.'

Still the same error :roll_eyes:
Sorry - Normal message from dev tools works via notify.telegram

@ukro can you please stop spoiling this thread? You aks more questions then answering them (which is not an issue initially), but you seem to answer some (including mine) but they are not an answer at all…?