Frigate + go2rtc + RTSPtoWebRTC?

Hi all,

I’ll try to expose my problem clearly while English is not my natural language nor I’m not sure if I would be able to explain it clearly, even in French !!

Since I updated Frigate, I have issues with it. Here is an extract of my log :

2023-04-24 16:56:43.051594391  [2023-04-24 18:56:43] watchdog.Front_Door            ERROR   : Ffmpeg process crashed unexpectedly for Front_Door.
2023-04-24 16:56:43.051861540  [2023-04-24 18:56:43] watchdog.Front_Door            ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-04-24 16:56:43.052107336  [2023-04-24 18:56:43] ffmpeg.Front_Door.detect       ERROR   : [segment @ 0x565167846f00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2023-04-24 16:56:43.052276833  [2023-04-24 18:56:43] ffmpeg.Front_Door.detect       ERROR   : More than 1000 frames duplicated
2023-04-24 16:57:53.070256074  [2023-04-24 18:57:53] watchdog.Front_Door            INFO    : Front_Door exceeded fps limit. Exiting ffmpeg...
2023-04-24 16:57:53.070510707  [2023-04-24 18:57:53] watchdog.Front_Door            INFO    : Waiting for ffmpeg to exit gracefully...
2023-04-24 16:57:53.654846727  [2023-04-24 18:57:53] frigate.video                  ERROR   : Front_Door: Unable to read frames from ffmpeg process.
2023-04-24 16:57:53.655048030  [2023-04-24 18:57:53] frigate.video                  ERROR   : Front_Door: ffmpeg process is not running. exiting capture thread...

And the same pattern keeps on repeating every minute.

I took a look at the frigate documentation and I saw a new way of restreaming : using go2rtc.

Then, I try to understand what is the use of go2rtc. Trying to find information in this forum, I found it is often quoted with RTSPtoWebRTC. So, I try to understand what RTSPtoWebRTC is too !!

And, that’s where I decided to ask the community before making any mistake.

Here is my frigate config (it worked until the update) :

mqtt:
  host: 192.168.X.X
  user: XXXXXXXXX
  password: XXXXXXXXXXXX
  
detectors:
  coral:
    type: edgetpu
    device: usb

ffmpeg:
  hwaccel_args: -c:v h264_qsv
  
objects:
  track:
    - person
    - dog
    - cat
    
cameras:
  Front_Door:
    ffmpeg:
      inputs:
        - path: rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - rtmp
            - detect
            - record
            
    detect:
        width: 1920 # <---- update for your camera's resolution
        height: 1080 # <---- update for your camera's resolution
        fps: 5
    
    snapshots:
      enabled: True
  
  Salon: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: rtsp://USER:[email protected]:443/videoMain
          roles:
            - rtmp
            - detect
        - path: rtsp://USer:[email protected]:443/videoSub
          roles:
            - record
    detect:
        width: 1280 # <---- update for your camera's resolution
        height: 720 # <---- update for your camera's resolution
        fps: 5
    
    snapshots:
      enabled: True
    
    motion:
      mask:
        - 1588,450,1804,497,1846,364,1606,322
        
  Jardin: # <------ Name the camera
    rtmp:
        enabled: False
    ffmpeg:
      inputs:
        - path: rtsp://User:[email protected]:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - rtmp
            - detect
        - path: rtsp://User:[email protected]:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - record

    detect:
        width: 640 # <---- update for your camera's resolution
        height: 480 # <---- update for your camera's resolution
        fps: 5
    
    snapshots:
      enabled: True
        
record:
  enabled: True
  retain:
    days: 0
    mode: motion
  events:
    objects:
      - person
      - dog
    retain:
        default: 5
        mode: motion

I would really appreciate if someone could help me link all the part of the puzzle.

Thx

I think the docs explain it well: Configuring go2rtc | Frigate

Use of the bundled go2rtc is optional. You can still configure FFmpeg to connect directly to your cameras. However, adding go2rtc to your configuration is required for the following features:

  • WebRTC or MSE for live viewing with higher resolutions and frame rates than the jsmpeg stream which is limited to the detect stream
  • RTSP (instead of RTMP) relay for use with Home Assistant or other consumers to reduce the number of connections to your camera streams

If you want to restream from Frigate , here is more information.
Restream | Frigate .
The entities for other app to uses is already created, you have to look in the frigate integration entities and find anything that start with camera.xxxxxx
image

I found this question in my search for “Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly” as it is part of your log too. I don’t think this was addressed unless it’s somehow part of go2rtc. I’m actually having trouble setting that up too so if it is I’ll persevere at trying that - but it does say it’s optional. Might have something to do with where I put it in my yml. Tried at the beginning (actually just after MQTT) and then right before cameras. Copied the rtsp from each camera path - maybe that’s not correct either.