Repository: blakeblackshear/frigate

Issue:
[Support]: WARNING : Unable to keep up with recording segments in cache for ... Keeping the 5 most recent segments out of 6 and discarding the rest...
### Describe the problem you are having

I have log flooded with this warning: frigate.record.maintainer WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
Apart from that, events are actually missing parts of recording. Like person walks and all of a sudden disappears.
Write times are in range of 0.1 - 0.05 s.

I had this issue in Frigate 12.1, then read in some post here that it is addressed in Beta version, so I migrated to Beta - still have this issue.

I very much look forward to getting help.

Other than this issue Frigate is fantastic. Thank you very much for your efforts!

### Version

0.13.0-AA93D4F

### Frigate config file

```yaml
mqtt:
  # Required: host name
  host: 192.168.*.*
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  #topic_prefix: homeassistant
  topic_prefix: frigate  
  # Optional: client id (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: ***
  # Optional: password
  # NOTE: MQTT password can be specified with an environment variables that must begin with 'FRIGATE_'.
  #       e.g. password: '{FRIGATE_MQTT_PASSWORD}'
  password: ***

# Optional: logger verbosity settings
logger:
  # Optional: Default log verbosity (default: shown below)
  default: info
  # Optional: Component specific logger overrides
  logs:
    # frigate.event: debug
    frigate.record: debug
    frigate.record.maintainer: debug

# detectors:
#   coral:
#     type: edgetpu
#     device: usb

detectors:
  cpu:
    type: cpu
    num_threads: 4

# Optional: Database configuration
database:
  # The path to store the SQLite DB (default: shown below)
  path: /config/frigate.db

ffmpeg:
  hwaccel_args: preset-vaapi   

# Optional: Detect configuration
# NOTE: Can be overridden at the camera level
detect:
  # Optional: width of the frame for the input with the detect role (default: use native stream resolution)
  width: 1280
  # Optional: height of the frame for the input with the detect role (default: use native stream resolution)
  height: 720
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  enabled: True
  # Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate)
  min_initialized: 2
  # Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for confirming stationary objects (default: same as threshold)
    # When set to 1, object detection will run to confirm the object still exists on every frame.
    # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
    interval: 50
    # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
    threshold: 50
    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
    # car at the default.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
      default: 3000
      # Optional: Object specific values
      objects:
        person: 1000

# Optional: Object configuration
# NOTE: Can be overridden at the camera level
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - car
    # - bicycle
    - bird
    - cat
    - dog
  # Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
  # Checks based on the bottom center of the bounding box of the object.
  # NOTE: This mask is COMBINED with the object type specific mask below
  # mask: 0,0,1000,0,1000,200,0,200
  # Optional: filters to reduce false positives for specific object types
  filters:
    person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
      min_area: 50
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      # max_area: 100000
      # Optional: minimum width/height of the bounding box for the detected object (default: 0)
      min_ratio: 0.5
      # Optional: maximum width/height of the bounding box for the detected object (default: 24000000)
      max_ratio: 2.0
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.5
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.7
      # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
      # Checks based on the bottom center of the bounding box of the object
      # mask: 0,0,1000,0,1000,200,0,200

# Optional: Motion configuration
# NOTE: Can be overridden at the camera level
motion:
  # Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
  # Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
  # The value should be between 1 and 255.
  threshold: 25
  # Optional: Minimum size in pixels in the resized motion image that counts as motion (default: 30)
  # Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
  # make motion detection more sensitive to smaller moving objects.
  # As a rule of thumb:
  #  - 15 - high sensitivity
  #  - 30 - medium sensitivity
  #  - 50 - low sensitivity
  contour_area: 30
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging the motion delta across multiple frames (default: shown below)
  # Higher values mean the current frame impacts the delta a lot, and a single raindrop may register as motion.
  # Too low and a fast moving person wont be detected as motion.
  delta_alpha: 0.2
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging frames to determine the background (default: shown below)
  # Higher values mean the current frame impacts the average a lot, and a new object will be averaged into the background faster.
  # Low values will cause things like moving shadows to be detected as motion for longer.
  # https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
  frame_alpha: 0.2
  # Optional: Height of the resized motion frame  (default: 50)
  # This operates as an efficient blur alternative. Higher values will result in more granular motion detection at the expense
  # of higher CPU usage. Lower values result in less CPU, but small changes may not register as motion.
  frame_height: 50
  # Optional: motion mask
  # NOTE: see docs for more detailed info on creating masks
  # mask: 0,900,1080,900,1080,1920,0,1920
  # Optional: improve contrast (default: shown below)
  # Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive
  # for daytime.
  improve_contrast: False
  # Optional: Delay when updating camera motion through MQTT from ON -> OFF (default: shown below).
  # mqtt_off_delay: 30

# # Optional: Record configuration
# # NOTE: Can be overridden at the camera level
record:
  # Optional: Enable recording (default: shown below)
  # WARNING: If recording is disabled in the config, turning it on via
  #          the UI or MQTT later will have no effect.
  # WARNING: Frigate does not currently support limiting recordings based
  #          on available disk space automatically. If using recordings,
  #          you must specify retention settings for a number of days that
  #          will fit within the available disk space of your drive or Frigate
  #          will crash.
  enabled: true
  # Optional: Number of minutes to wait between cleanup runs (default: shown below)
  # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o
  expire_interval: 60
  # Optional: Retention settings for recording
  retain:
    # Optional: Number of days to retain recordings regardless of events (default: shown below)
    # NOTE: This should be set to 0 and retention should be defined in events section below
    #       if you only want to retain recordings of events.
    days: 0
    # Optional: Mode for retention. Available options are: all, motion, and active_objects
    #   all - save all recording segments regardless of activity
    #   motion - save all recordings segments with any detected motion
    #   active_objects - save all recording segments with active/moving objects
    # NOTE: this mode only applies when the days setting above is greater than 0
    mode: motion
  # Optional: Event recording settings
  events:
    # Optional: Number of seconds before the event to include (default: shown below)
    pre_capture: 120
    # Optional: Number of seconds after the event to include (default: shown below)
    post_capture: 120
    # Optional: Objects to save recordings for. (default: all tracked objects)
    objects:
      - person
      - car
      # - bicycle
      - bird
      - cat
      - dog
    # Optional: Restrict recordings to objects that entered any of the listed zones (default: no required zones)
    required_zones: []
    # Optional: Retention settings for recordings of events
    retain:
      # Required: Default retention days (default: shown below)
      default: 7
      # Optional: Mode for retention. (default: shown below)
      #   all - save all recording segments for events regardless of activity
      #   motion - save all recordings segments for events with any detected motion
      #   active_objects - save all recording segments for event with active/moving objects
      #
      # NOTE: If the retain mode for the camera is more restrictive than the mode configured
      #       here, the segments will already be gone by the time this mode is applied.
      #       For example, if the camera retain mode is "motion", the segments without motion are
      #       never stored, so setting the mode to "all" here won't bring them back.
      mode: motion
      # Optional: Per object retention days
      objects:
        person: 14
        car: 14
        bicycle: 14
        bird: 14
        cat: 14
        dog: 14
# Optional: Configuration for the jpg snapshots written to the clips directory for each event
# NOTE: Can be overridden at the camera level
snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: save a clean PNG copy of the snapshot image (default: shown below)
  clean_copy: True
  # Optional: print a timestamp on the snapshots (default: shown below)
  timestamp: False
  # Optional: draw bounding box on the snapshots (default: shown below)
  bounding_box: True
  # Optional: crop the snapshot (default: shown below)
  crop: False
  # Optional: height to resize the snapshot to (default: original size)
  # height: 768
  # Optional: Restrict snapshots to objects that entered any of the listed zones (default: no required zones)
  required_zones: []
  # Optional: Camera override for retention settings (default: global values)
  retain:
    # Required: Default retention days (default: shown below)
    default: 14
    # Optional: Per object retention days
    # objects:
    #   person: 2
    #   car: 2
    #   dog: 2
    #   bike: 2
    #   cat: 2

go2rtc:
  streams:
    salon-e1pro-main:
      - rtsp://admin:Interneta5@192.168.1.118:554/h264Preview_01_main
    salon-e1pro-sub:
      - rtsp://admin:Interneta5@192.168.1.118:554/h264Preview_01_sub     
    mainhallway-e1pro-main:
      - rtsp://admin:Interneta5@192.168.1.240:554/h264Preview_01_main
    mainhallway-e1pro-sub:
      - rtsp://admin:Interneta5@192.168.1.240:554/h264Preview_01_sub        

cameras:
 salon-e1pro:
    enabled: True
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/salon-e1pro-main
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/salon-e1pro-sub
          input_args: preset-rtsp-restream
          roles:
            - detect            
    detect:
      width: 640
      height: 352
      fps: 7
      stationary:
        interval: 50
        threshold: 100
 mainhallway-e1pro:
    enabled: True
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/mainhallway-e1pro-main
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/mainhallway-e1pro-sub
          input_args: preset-rtsp-restream
          roles:
            - detect            
    detect:
      width: 640
      height: 352
      fps: 7
      stationary:
        interval: 50
        threshold: 50
```


### Relevant log output

```shell
2023-11-18 15:33:23.817374519  [INFO] Preparing Frigate...
2023-11-18 15:33:23.844652983  [INFO] Starting Frigate...
2023-11-18 15:33:25.670389199  [2023-11-18 15:33:25] frigate.app                    INFO    : Starting Frigate (0.13.0-aa93d4f)
2023-11-18 15:33:25.724731924  [2023-11-18 15:33:25] peewee_migrate.logs            INFO    : Starting migrations
2023-11-18 15:33:25.730551702  [2023-11-18 15:33:25] peewee_migrate.logs            INFO    : There is nothing to migrate
2023-11-18 15:33:25.739890286  [2023-11-18 15:33:25] frigate.app                    INFO    : Recording process started: 429
2023-11-18 15:33:25.743247137  [2023-11-18 15:33:25] frigate.app                    INFO    : go2rtc process pid: 89
2023-11-18 15:33:25.773880197  [2023-11-18 15:33:25] detector.cpu                   INFO    : Starting detection process: 439
2023-11-18 15:33:25.781233022  [2023-11-18 15:33:25] frigate.detectors              WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
2023-11-18 15:33:25.783279045  [2023-11-18 15:33:25] frigate.app                    INFO    : Output process started: 441
2023-11-18 15:33:25.811423750  [2023-11-18 15:33:25] frigate.app                    INFO    : Camera processor started for salon-e1pro: 445
2023-11-18 15:33:25.820644422  [2023-11-18 15:33:25] frigate.app                    INFO    : Camera processor started for mainhallway-e1pro: 447
2023-11-18 15:33:25.829267970  [2023-11-18 15:33:25] frigate.app                    INFO    : Capture process started for salon-e1pro: 449
2023-11-18 15:33:25.838505243  [2023-11-18 15:33:25] frigate.app                    INFO    : Capture process started for mainhallway-e1pro: 453
2023-11-18 15:33:40.747541417  [2023-11-18 15:33:40] frigate.record.maintainer      DEBUG   : Found 1 old frames.
2023-11-18 15:34:10.912616015  [2023-11-18 15:34:10] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/33.29.mp4 in 0.15671086311340332 seconds.
2023-11-18 15:34:10.913937383  [2023-11-18 15:34:10] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/33.38.mp4 in 0.14011597633361816 seconds.
2023-11-18 15:34:10.940971246  [2023-11-18 15:34:10] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/33.58.mp4 in 0.0983579158782959 seconds.
2023-11-18 15:34:15.845046921  [2023-11-18 15:34:15] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/mainhallway-e1pro/33.28.mp4 in 0.08932685852050781 seconds.
2023-11-18 15:34:20.913899202  [2023-11-18 15:34:20] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/mainhallway-e1pro/34.08.mp4 in 0.108367919921875 seconds.
2023-11-18 15:34:25.988751089  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Start expire recordings.
2023-11-18 15:34:25.988887315  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Start deleted cameras.
2023-11-18 15:34:25.990640366  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Expiring 0 recordings
2023-11-18 15:34:25.990755613  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : End deleted cameras.
2023-11-18 15:34:25.991136781  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Start all cameras.
2023-11-18 15:34:25.991268920  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Start camera: salon-e1pro.
2023-11-18 15:34:25.995113599  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Expiring 0 recordings
2023-11-18 15:34:25.995218467  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : End camera: salon-e1pro.
2023-11-18 15:34:25.995780184  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Start camera: mainhallway-e1pro.
2023-11-18 15:34:25.996857543  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : Expiring 0 recordings
2023-11-18 15:34:25.996962120  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : End camera: mainhallway-e1pro.
2023-11-18 15:34:25.997367353  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : End all cameras.
2023-11-18 15:34:25.997492529  [2023-11-18 15:34:25] frigate.record.cleanup         DEBUG   : End expire recordings.
2023-11-18 15:34:30.929511038  [2023-11-18 15:34:30] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/34.18.mp4 in 0.0861659049987793 seconds.
2023-11-18 15:34:40.878251869  [2023-11-18 15:34:40] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/34.27.mp4 in 0.07831478118896484 seconds.
2023-11-18 15:35:30.891312822  [2023-11-18 15:35:30] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/35.18.mp4 in 0.08650994300842285 seconds.
2023-11-18 15:35:50.880503548  [2023-11-18 15:35:50] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/mainhallway-e1pro/35.38.mp4 in 0.08202099800109863 seconds.
2023-11-18 15:36:00.923925670  [2023-11-18 15:36:00] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/mainhallway-e1pro/35.47.mp4 in 0.07889795303344727 seconds.
2023-11-18 15:36:45.852452873  [2023-11-18 15:36:45] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/36.28.mp4 in 0.09096407890319824 seconds.
2023-11-18 15:36:50.876313075  [2023-11-18 15:36:50] frigate.record.maintainer      DEBUG   : Copied /media/frigate/recordings/2023-11-18/13/salon-e1pro/36.38.mp4 in 0.07429003715515137 seconds.
2023-11-18 15:37:30.759834310  [2023-11-18 15:37:30] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:37:40.760159492  [2023-11-18 15:37:40] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:37:50.760305216  [2023-11-18 15:37:50] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:38:00.759585230  [2023-11-18 15:38:00] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:38:10.759887028  [2023-11-18 15:38:10] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:38:20.761028107  [2023-11-18 15:38:20] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
2023-11-18 15:38:30.760921817  [2023-11-18 15:38:30] frigate.record.maintainer      WARNING : Unable to keep up with recording segments in cache for mainhallway-e1pro. Keeping the 5 most recent segments out of 6 and discarding the rest...
```


### FFprobe output from your camera

```shell
[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"0/0","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1440,"width":2560},{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"}]}},{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"0/0","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":352,"width":640},{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"}]}}]
```


### Frigate stats

```json
{"cameras":{"mainhallway-e1pro":{"audio_dBFS":0.0,"audio_rms":0.0,"camera_fps":7.1,"capture_pid":452,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":458,"pid":447,"process_fps":7.1,"skipped_fps":0.0},"salon-e1pro":{"audio_dBFS":0.0,"audio_rms":0.0,"camera_fps":7.1,"capture_pid":449,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":454,"pid":445,"process_fps":7.1,"skipped_fps":0.0}},"cpu_usages":{"1":{"cmdline":"/package/admin/s6/command/s6-svscan -d4 -- /run/service","cpu":"0.0","cpu_average":"0","mem":"0.0"},"15":{"cmdline":"s6-supervise s6-linux-init-shutdownd","cpu":"0.0","cpu_average":"0","mem":"0.0"},"18":{"cmdline":"/package/admin/s6-linux-init/command/s6-linux-init-shutdownd -c /run/s6/basedir -g 3000 -C -B","cpu":"0.0","cpu_average":"0","mem":"0.0"},"24":{"cmdline":"s6-supervise s6rc-fdholder","cpu":"0.0","cpu_average":"0","mem":"0.0"},"25":{"cmdline":"s6-supervise nginx-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"26":{"cmdline":"s6-supervise go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"27":{"cmdline":"s6-supervise nginx","cpu":"0.0","cpu_average":"0","mem":"0.0"},"28":{"cmdline":"s6-supervise frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"29":{"cmdline":"s6-supervise go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"30":{"cmdline":"s6-supervise go2rtc-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"31":{"cmdline":"s6-supervise frigate-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"32":{"cmdline":"s6-supervise s6rc-oneshot-runner","cpu":"0.0","cpu_average":"0","mem":"0.0"},"41":{"cmdline":"/package/admin/s6-2.11.3.2/command/s6-fdholderd -1 -i data/rules","cpu":"0.0","cpu_average":"0","mem":"0.0"},"42":{"cmdline":"/package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/admin/s6/command/s6-sudod -t 30000 -- /package/admin/s6-rc/command/s6-rc-oneshot-run -l ../.. --","cpu":"0.0","cpu_average":"0","mem":"0.0"},"80":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/nginx","cpu":"0.1","cpu_average":"0","mem":"0.0"},"81":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"82":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"89":{"cmdline":"/usr/local/go2rtc/bin/go2rtc -config=/dev/shm/go2rtc.yaml","cpu":"5.3","cpu_average":"5","mem":"0.2"},"96":{"cmdline":"python3 -u -m frigate","cpu":"1.3","cpu_average":"0","mem":"1.4"},"100":{"cmdline":"bash ./run.user go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"119":{"cmdline":"nginx: master process nginx","cpu":"0.0","cpu_average":"0","mem":"0.1"},"146":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.2"},"147":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.2"},"148":{"cmdline":"nginx: worker process","cpu":"0.2","cpu_average":"0","mem":"0.0"},"153":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.0"},"163":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"173":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.0"},"184":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.0"},"185":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"186":{"cmdline":"nginx: cache manager process","cpu":"0.0","cpu_average":"0","mem":"0.0"},"427":{"cmdline":"frigate.logger       ","cpu":"0.1","cpu_average":"0","mem":"0.6"},"429":{"cmdline":"frigate.recording_manager","cpu":"1.0","cpu_average":"1","mem":"0.8"},"438":{"cmdline":"/usr/bin/python3 -c from multiprocessing.resource_tracker import main;main(45)","cpu":"0.2","cpu_average":"0","mem":"0.1"},"439":{"cmdline":"frigate.detector.cpu ","cpu":"0.0","cpu_average":"9","mem":"0.8"},"441":{"cmdline":"frigate.output       ","cpu":"0.5","cpu_average":"0","mem":"0.7"},"445":{"cmdline":"frigate.process:salon-e1pro","cpu":"0.7","cpu_average":"0","mem":"0.8"},"447":{"cmdline":"frigate.process:mainhallway-e1pro","cpu":"0.7","cpu_average":"0","mem":"0.8"},"449":{"cmdline":"frigate.capture:salon-e1pro","cpu":"0.8","cpu_average":"0","mem":"0.7"},"452":{"cmdline":"frigate.capture:mainhallway-e1pro","cpu":"0.7","cpu_average":"0","mem":"0.7"},"454":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-aa93d4f -rtsp_transport tcp -timeout 5000000 -i rtsp://127.0.0.1:8554/salon-e1pro-sub -r 7 -vf fps=7,scale_vaapi=w=640:h=352,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"1.1","cpu_average":"1","mem":"0.5"},"457":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 640x352 -i pipe: -f mpegts -s 1309x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.1"},"458":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-aa93d4f -rtsp_transport tcp -timeout 5000000 -i rtsp://127.0.0.1:8554/mainhallway-e1pro-sub -r 7 -vf fps=7,scale_vaapi=w=640:h=352,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"1.0","cpu_average":"1","mem":"0.5"},"462":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 640x352 -i pipe: -f mpegts -s 1309x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.1"},"464":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-aa93d4f -rtsp_transport tcp -timeout 5000000 -i rtsp://127.0.0.1:8554/salon-e1pro-main -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy /tmp/cache/salon-e1pro@%Y%m%d%H%M%S%z.mp4","cpu":"0.2","cpu_average":"0","mem":"0.1"},"465":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-aa93d4f -rtsp_transport tcp -timeout 5000000 -i rtsp://127.0.0.1:8554/mainhallway-e1pro-main -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy /tmp/cache/mainhallway-e1pro@%Y%m%d%H%M%S%z.mp4","cpu":"0.4","cpu_average":"0","mem":"0.1"},"466":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1280x720 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"18065":{"cmdline":"sleep 30s","cpu":"0.0","cpu_average":"0","mem":"0.0"}},"detection_fps":0.0,"detectors":{"cpu":{"detection_start":0.0,"inference_speed":90.17,"pid":439}},"gpu_usages":{"amd-vaapi":{"gpu":"2.50%","mem":"28.71%"}},"processes":{"go2rtc":{"pid":89},"logger":{"pid":427},"recording":{"pid":429}},"service":{"last_updated":1700313960,"latest_version":"0.12.1","storage":{"/dev/shm":{"free":253.4,"mount_type":"tmpfs","total":256.0,"used":2.6},"/media/frigate/clips":{"free":57353.5,"mount_type":"ext4","total":64417.9,"used":4386.1},"/media/frigate/recordings":{"free":57353.5,"mount_type":"ext4","total":64417.9,"used":4386.1},"/tmp/cache":{"free":899.1,"mount_type":"tmpfs","total":953.7,"used":54.6}},"temperatures":{},"uptime":11944,"version":"0.13.0-aa93d4f"}}
```


### Operating system

Proxmox

### Install method

Docker Compose

### Coral version

CPU (no coral)

### Network connection

Wired

### Camera make and model

Reolink e1Pro

### Any other information that may be helpful

I am facing the same issue with and without coral. CPU load is inm range 1-5%. 16 GB of RAM, the system only runs Frigate.


Discussion:
While this is happening it will be good to know the contents of /tmp/cache 
Also there's no reason not to use a coral, it would only help
> While this is happening it will be good to know the contents of /tmp/cache

How would I get these?
> Also there's no reason not to use a coral, it would only help

I am using coral on another machine, works like a charm, though the same issue with recording segments is there too.
You can get a shell in the container with `docker exec -it frigate /bin/bash` then run `ls /tmp/cache`
it would also be helpful to know at what time the event occurred that had missing recording segments
by the way, it looks like you kept the old motion detection values despite the release notes explaining motion detection has changed and these old values are no good. It is possible that your missing recording segments for the person walking have nothing to do with this error and are simply due to motion having not been detected. I would definitely suggest removing this config and tuning motion detection according to the docs https://deploy-preview-6262--frigate-docs.netlify.app/configuration/motion_detection
> You can get a shell in the container with `docker exec -it frigate /bin/bash` then run `ls /tmp/cache`

ls /tmp/cache
mainhallway-e1pro@20231118170246+0200.mp4  mainhallway-e1pro@20231118170314+0200.mp4  salon-e1pro@20231118170245+0200.mp4  salon-e1pro@20231118170313+0200.mp4
mainhallway-e1pro@20231118170255+0200.mp4  mainhallway-e1pro@20231118170325+0200.mp4  salon-e1pro@20231118170253+0200.mp4  salon-e1pro@20231118170323+0200.mp4
mainhallway-e1pro@20231118170305+0200.mp4  mainhallway-e1pro@20231118170335+0200.mp4  salon-e1pro@20231118170303+0200.mp4  salon-e1pro@20231118170333+0200.mp4
> by the way, it looks like you kept the old motion detection values despite the release notes explaining motion detection has changed and these old values are no good. It is possible that your missing recording segments for the person walking have nothing to do with this error and are simply due to motion having not been detected. I would definitely suggest removing this config and tuning motion detection according to the docs https://deploy-preview-6262--frigate-docs.netlify.app/configuration/motion_detection

Somehow I missed that - thanks for pointing out.


Okay I understand what is going on here. Your pre_capture is 120 seconds which is too long for the assumptions made by the recordings maintainer. basically meaning that your segments are being kept for too long because the assumption was made that the segments would be moved immediately. We will need to figure out how to address this in a PR
> Okay I understand what is going on here. Your pre_capture is 120 seconds which is too long for the assumptions made by the recordings maintainer. basically meaning that your segments are being kept for too long because the assumption was made that the segments would be moved immediately. We will need to figure out how to address this in a PR

Okay, so at the moment there's nothing I can do on my side to fix that, right? :) 
Until the PR is ready, you could drop your pre_capture time to something below 60s to mitigate the issue.
> Until the PR is ready, you could drop your pre_capture time to something below 60s to mitigate the issue.

Alright, I have pre_capture time set to 30s. Will see how it goes.
Okay, I can confirm that after pre_capture time was set to 30, warnings stopped.

Resolving patch:
diff --git a/frigate/config.py b/frigate/config.py
--- a/frigate/config.py
+++ b/frigate/config.py
@@ -19,6 +19,7 @@
     CACHE_DIR,
     CACHE_SEGMENT_FORMAT,
     DEFAULT_DB_PATH,
+    MAX_PRE_CAPTURE,
     REGEX_CAMERA_NAME,
     YAML_EXT,
 )
@@ -232,7 +233,9 @@ class RetainConfig(FrigateBaseModel):
 
 
 class EventsConfig(FrigateBaseModel):
-    pre_capture: int = Field(default=5, title="Seconds to retain before event starts.")
+    pre_capture: int = Field(
+        default=5, title="Seconds to retain before event starts.", le=MAX_PRE_CAPTURE
+    )
     post_capture: int = Field(default=5, title="Seconds to retain after event ends.")
     required_zones: List[str] = Field(
         default_factory=list,
diff --git a/frigate/const.py b/frigate/const.py
--- a/frigate/const.py
+++ b/frigate/const.py
@@ -51,7 +51,9 @@
 # Record Values
 
 CACHE_SEGMENT_FORMAT = "%Y%m%d%H%M%S%z"
+MAX_PRE_CAPTURE = 60
 MAX_SEGMENT_DURATION = 600
+MAX_SEGMENTS_IN_CACHE = 6
 MAX_PLAYLIST_SECONDS = 7200  # support 2 hour segments for a single playlist to account for cameras with inconsistent segment times
 
 # Internal Comms Topics
diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py
--- a/frigate/record/maintainer.py
+++ b/frigate/record/maintainer.py
@@ -23,6 +23,7 @@
     CACHE_SEGMENT_FORMAT,
     INSERT_MANY_RECORDINGS,
     MAX_SEGMENT_DURATION,
+    MAX_SEGMENTS_IN_CACHE,
     RECORD_DIR,
 )
 from frigate.models import Event, Recordings
@@ -121,8 +122,8 @@ async def move_files(self) -> None:
                 }
             )
 
-        # delete all cached files past the most recent 5
-        keep_count = 5
+        # delete all cached files past the most recent MAX_SEGMENTS_IN_CACHE
+        keep_count = MAX_SEGMENTS_IN_CACHE
         for camera in grouped_recordings.keys():
             # sort based on start time
             grouped_recordings[camera] = sorted(


Test patch: