this post was submitted on 19 Feb 2024
27 points (100.0% liked)

homeassistant

12102 readers
14 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

If you use Reolink wifi cams via the Frigate integration in homeassistant, you may be used to seeing tons of "ffmpeg has crashed unexpectedly" in your frigate logs. I have 3 older reolink wifi cams in frigate (510WA, 511WA) which most in the community seems to advise against and indeed since I've been running frigate, while they worked, they have been problematic since Frigate 0.12 and the arrival of go2rtc

Cutting down to the chase, when I was using the standard common configuration with these cameras:

go2rtc:
  streams:
    driveway:
      - "http://192.168.x.y/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=USER&password=PASSWORD#video=copy"
    driveway_sub:
      - "http://192.168.x.y/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=USER&password=PASSWORD"

... frigate would generally work with them however in the logs I could see that the ffmpeg process that frigate creates for each re-stream would crash every few minutes, accumulating thousands of crashes over time. I assume that the crashes would also cause event detection to be unavailable for a brief period each time they happened.

With Frigate 0.13, it got even worse, as with each crash, the HA dashboard would show a black image with a "No frames received" message that would only go away after a manual dashboard refresh.

I believe the issue is that go2rtc was unable to properly handle the streams from these old cams, while in the past, ffmpeg directly in frigate could do it, adding some ffmpeg parameter.

The solution I found a few days ago that ALMOST COMPLETELY eliminated all the "ffmpeg crashed unexpectedly" situations (I went from THOUSANDS of errors to just one or two errors after a few days) is to change the go2rtc configuration so that it uses ffmpeg instead of it's own code to connect to the cams:

go2rtc:
  streams:
    driveway:
      - "ffmpeg:http://192.168.x.y/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=USER&password=PASSWORD#video=copy"
    driveway_sub:
      - "ffmpeg:http://192.168.x.y/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=USER&password=PASSWORD"

I also have the following global ffmpeg configuration in frigate's config file, not sure if it helps or not:

ffmpeg:
  global_args: -hide_banner -loglevel error
  hwaccel_args: preset-vaapi
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000

This go2rtc configuration decreased CPU utilization significantly (frigate 0.13 itself also helped apparently). Hoping this will help others in the same situation, as the cams themselves are not bad, it's just their software that sucks, but that can be worked around quite nicely with ffmpeg.

you are viewing a single comment's thread
view the rest of the comments
[–] ari_verse@lemm.ee 1 points 9 months ago

Note - another helpful tip for 510WA cams: in this github listing: Reolink Firmware Archive, you can find a link to version 3.1.0.1387 which I have been running for a week, this version is much newer than the latest official release (.764), it adds two useful new options in t he Stream configuration section (which is only accessible via the Web interface of the cam),

  • interframe space: set it to 1X
  • frame rate mode: set it to fixed