Local realtime person detection for RTSP cameras

Stop frigate and delete the db file. You can also delete everything in the recordings folder. There is likely a message at the start of the logs you posted with an error that caused the follow on errors you are seeing.

1 Like

Like I said @tmjpugh clips are captured and played nicely with Frigate UI and also this one camera clips are visible in Lovelace frigate card. Here is my config.yml and docker-compose.

detectors:
  coral:
    type: edgetpu
    device: usb

mqtt:
  host: 192.168.1.60
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: mqtt
  password: xxx

  birdseye:
    enabled: True
    width: 1280
    height: 720
    quality: 8    
    mode: objects

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

record:
  enabled: true
  retain_days: 10
  events:
    retain:
      default: 14

snapshots:
  enabled: True
  bounding_box: True
  crop: false
  retain:
    default: 14
      
cameras:
  etupiha:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/1
          roles:
            - rtmp
            - detect
            - record
    detect:    
      width: 1920
      height: 1080
      fps: 5
    motion:
      mask:
        - 357,387,179,0,659,0,673,128
    rtmp:
      enabled: True    
    objects:
      track:
        - person
        - dog
        - cat
        - car
      filters:
        car:
          mask:
            - 197,698,57,1080,421,1080,530,1016,714,743,718,596,640,526,489,482,385,469,308,558


  Takapiha2:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    rtmp:
      enabled: True
    objects:
      track:
        - person
        - dog
        - cat

  Mokkitienpuoli:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxx@xxx:1111/cam/realmonitor?channel=1&subtype=0
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    motion:
      mask:
        - 1237,537,1550,559,1567,465,1246,430
        - 1141,429,1337,447,1349,357,1130,352
    rtmp:
      enabled: True
    objects:
      track:
        - person
        - dog
        - cat
        - car
        - bird

  Mokkiranta:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxx@xxx:554//h264Preview_01_main
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 640
      height: 480
      fps: 5
    rtmp:
      enabled: True
    objects:
      track:
        - person
        - dog
        - cat

version: '3.9'
services:
  frigate:
    shm_size: '128m'
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:0.9.1-amd64
    devices:
      - /dev/bus/usb:/dev/bus/usb
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/docker/hassio/homeassistant/config.yml:/config/config.yml:ro
      - /mnt/videovalvonta:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        # target: /mnt/ramdisk
        # tmpfs:
        #  size: 1000000000
    ports:
      - '5000:5000'
      - '1935:1935' # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: 'xxx'

Never mind. Solved.

Hi, it seems to have something to do with time? Some recordings just do not play. I have recording glabally enabled, not per cam. Some play, some donā€™t (from same cam).

Copy your whole config here, blakeblackshear helped me with pointers and i have been able to figure it out.
Let me help you

Hi Ryan, Iā€™m trying to set up my frigate docker instance inside a VirtualBox Ubuntu VM, Could you tell me which hardware acceleterators have you set up in your frigate yaml file?.

Iā€™m trying to configure six cameras and lag is horrible!!. And I think itā€™s because Iā€™m not using any hardware accelerator.

For anybody here struggling with lag, Iā€™m on a RPi 4B with a Coral with 4 cameras and my performance is pretty darn good. I can tell sometimes that Iā€™m right up against the systemā€™s limits, but I generally have smooth capture and playback. Any choppiness generally seems to be related to the platform Iā€™m viewing on, because watching a camera from my PC is completely smooth.

On another note, Iā€™d like to start fresh with my Frigate recordings/clips because Iā€™ve restructured my detection quite a bit in the past couple of days after upgrading. If I just shutdown Frigate, delete the contents of the media folder and the db, and then start back up will that work?

I havenā€™t been very active with this lately, but I see some newer releases are coming out.
Iā€™m a bit confused when I go to look at the addon Iā€™m using now and donā€™t see any updates available.

Did the addon support get dropped?
I sure hope not, but Iā€™m not seeing any mention of it anywhere anymore so Iā€™m thinking I may have missed something.

Thanks

----------------------------EDIT--------------------------------------------------
It seems that somewhere along the upgrading path the URL for the addons (ALL of the non official ones) got deleted from my install. After adding it back it now shows an update available.

birdseye:
  enabled: True
  width: 1280
  height: 720
  quality: 8
  mode: objects

database:
  path: /media/frigate/db/frigate.db

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

record:
  enabled: true
  retain_days: 10
  events:
    retain:
      default: 14


# MQTT Config ##########################################################################################################
mqtt:
  host: 192.168.1.142
  port: 1883
  topic_prefix: frigate112
  client_id: frigate112
  user: mqtt
  password: mqtt
  stats_interval: 60

# Cameras Config ######################################################################################################
cameras:
# FRONT Camera ########################################################################################################
  front:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      enabled: True
      max_disappeared: 2
      width: 2560
      height: 1440
      fps: 6
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - dog
        - cat
    motion:
      mask:
        - '1090,81,1216,0,1382,34,1532,99,1518,259,1426,363,1123,247'
        - '1766,498,1753,669,1778,722,1829,773,1863,825,1906,884,1924,955,1953,1065,2237,1169,2255,1128,2295,1046,2338,946,2378,841,2410,743,2215,647,2190,582,2138,512,2010,402,1859,351'

# Back Camera ########################################################################################################
  back:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      enabled: True
      max_disappeared: 2
      width: 2048
      height: 1536
      fps: 4
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - car
        - dog
        - bicycle
        - cat
      filters:
        car:
          min_score: 0.5
          threshold: 0.7
          mask:
            - '276,374,440,126,467,0,808,0,781,103,697,367'
            - '1723,199,2048,354,2048,585,1128,396,1086,128,1115,27'

# PARKING Camera ########################################################################################################
  parkeing:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      enabled: True
      max_disappeared: 2
      width: 3840
      height: 2160
      fps: 6
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - car
        - dog
        - bicycle
    motion:
      mask:
        - '2868,0,2839,240,2812,276,2775,329,2740,783,3840,1037,3840,0'
        - '2261,174,2190,154,2140,142,2096,133,2053,124,2002,122,1968,101,1914,71,1868,58,1817,56,1768,58,1716,69,1689,99,1642,100,1596,117,1566,137,1471,135,1419,162,1378,217,1364,278,1402,344,1474,393,1582,391,1652,347,1710,350,1786,361,1879,347,1991,328,2022,307,2046,289,2046,205,2074,189,2157,201,2154,330,2249,282'
        - '0,1896,153,2081,298,2049,403,1941,436,1839,439,1685,326,1492,142,1419,0,1531'
        - '1130,217,1265,271,519,597,1122,744,1104,990,1016,1049,464,838,426,620,415,564,412,494'
        - '398,490,483,455,605,416,730,372,754,339,751,233,744,167,695,122,645,105,569,99,497,110,441,119,365,189'
    zones:  
        parkeerplaats_voortuin_zone:
            coordinates: 297,2160,3840,2160,3840,1074,2754,786,2768,451,2128,325,1298,258,428,614,515,1002,620,1335,372,1573

# FRONT2 Camera ########################################################################################################
  front2:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - record

    detect:
      enabled: True
      max_disappeared: 25
      width: 3840
      height: 2160
      fps: 6
    
    snapshots:
      enabled: true
      crop: false
      bounding_box: True
    objects:
      track:
        - person
        - car
        - dog
        - bicycle
        - cat
        - truck
    motion:
      mask:
        - '3840,751,3840,386,3560,283,3482,341,3275,293,3150,302,3102,481,2948,460,2937,541,2978,714,3306,1422,3714,1413,3840,1647'
        - '1961,892,1907,871,1876,878,1844,867,1787,874,1689,914,1569,896,1486,881,1417,829,1413,736,1374,606,1345,415,1456,293,2344,337,2319,507,2199,499,2194,610,2244,655,2249,786,2213,881,2160,900,2111,921,2024,928'
        - '553,1714,670,1791,726,1866,747,1950,1879,2160,548,2160,466,1880'
        - '265,1437,428,1486,496,1568,426,1728,351,1672,190,1571,222,1502'
        - '1508,0,1586,77,1587,194,1561,229,1493,268,1416,312,1342,304,1225,276,1182,201,1196,86,1274,0'
        - '560,1410,658,1426,739,1490,832,1590,872,1716,879,1823,839,1901,726,1889,661,1816,588,1744,510,1691,506,1539'
        - '499,1508,584,1357,683,1222,682,1155,665,1066,627,987,566,889,491,821,389,803,270,829,176,872,64,966,0,1055,21,1190,63,1323,151,1413,194,1449'

# TERRAS Camera ########################################################################################################
  terras:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      enabled: True
      max_disappeared: 25
      width: 3840
      height: 2160
      fps: 4
    snapshots:
      timestamp: False
      bounding_box: True
      enabled: true
      crop: false
    objects:
      track:
        - bird
        - dog
        - cat
    motion:
      mask:    
        - '3840,0,3840,1295,3138,1412,3034,769,2958,382,2622,0'
        - '0,652,178,384,444,137,598,303,416,496,104,819,25,777'
        - '0,161,64,242,180,248,248,264,354,178,455,92,532,0,0,0'
      threshold: 25

detectors:
  coral:
    type: edgetpu
    device: usb

Can anyone tell me how I know if hardware accelerator is working?.
I have an i5 8269U (8th generation) and I wrote this configuration for QuickSync:

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

It didnā€™t work. Camera was green.

Then I put this one:

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128

And it worked, but neither my processor is 10th generation nor my log shows anything related to hardware acceleration.

about my config:

cameras:
  test_camera:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - qsv
        - -qsv_device
        - /dev/dri/renderD128
      inputs:
        - path: <RTSP_STREAM_PATH>
          roles:
            - detect
            - rtmp
    detect:
      width: 1920
      height: 1080
      fps: 5 

As you see is quite simple, due to Iā€™m testing frigate.

Thanks in advance.

So turn off frigate addon.
remove all db files of frigate, should be 2-3 files.
Remove all files from recording and clips.
Start addon and check logs if no errors.
And should work.Let me know

Please, I have no addon! :-).

The problem is recordings not all availabe.

I donā€™t check this thread often and itā€™s nearly impossible to provide support in this mega thread. I would suggest opening an issue on github if you want my help.

3 Likes

Great update! Iā€™ve upgraded and everything appears to be working like I had it before. Only question that I feel dumb about asking: What the heck is Birdseye? Sometimes I see just a black screen with a white bird thingy. Sometimes itā€™s a camera with motion. What is going on in Birdseye?

Release notes

A question for all you out thereā€¦ :slight_smile:
Would it be possible to make a telegram notification with a interaction so that it can play the related video clip inside telegram? As it is today im sending a https link to my frigate and open the clip in a new web pageā€¦ Would like to skip that and show the video clip inside telegramā€¦

Is this doable?

Same problem as @sender
Solution worked flawless for me

My inference times were off until I realised I needed and actual USB 3.1 USB-A to USB-C cable

Maybe useful for someone who is looking for coral
Bought this combo PCIe M.2 Coral + PCI-E x1 adapter for my hp prodesk 800 g1 ubuntu server, works great with frigate docker.

coral Mini PCIe M.2
https://lv.rsdelivers.com/product/coral/g650-04527-01/coral-google-mini-pcie-m2-accelerator-a-e/2017825

international site:
https://export.rsdelivers.com/product/coral/g650-04527-01/coral-google-mini-pcie-m2-accelerator-a/e-development-kit-g650-04527-01/2017825

Adapter M.2 NGFF Key A A+E (PCENGFF-NA1)
https://capital.lv/Produkti/Katalogs/Datoru-komponentes/Citas-komponentes/Adaptera-karte-PCI-E-for-Intel-AX200-M.2-NGFF-Key-A-AE-to-Mini-PCI-E-Adapter-Wireless-WiFi-Bluetooth-Network-Card-Converter-PCI-Express-1X-M2-NGFF-Support-2230-2242?

international site: https://www.amazon.com/Adapter-PCENGFF-NA1-Wireless-Network-Expansion/dp/B087RDYYBW
1 Like

I was having the same issues so I deleted the files you suggested. On restart I have the same two errors for each of my cameras. I had the same errors before deleting files.
WARNING : Camera back_yard has record enabled, but record is not assigned to an input.
WARNING : Camera back_yard has rtmp enabled, but rtmp is not assigned to an input.
Clips are being saved but not recordings.
I have the following in my config.

record:
  enabled: True
  retain_days: 0
  events:
    retain:
      default: 10

I removed the clips: and record: section for the individual cameras.

I clearly screwed something up with what to add and what to remove from where. Any direction would be appreciated.