Hi everyone.
I have Frigate set up for 2 cameras:
- Amcrest AD410
- Dahua wired turret camera (DH-IPC-HDW3466EMP-S-AUS-BLK)
My frigate config is below. I have two streams for each camera - one high res for recordings, one lower res for detection. I’ve configured it using go2rtc and have a third camera which uses one of the high res feeds for object detection, with most of the feed masked against motion (there is a particular part of the feed I want to detect people in but in the low res feed people aren’t clear enough).
All has been working fine, but a couple of days ago I can no longer view clips for two of the cameras - front_gate and driveway_camera. The garden_gate_camera is working fine (this is the one which uses the high res feed for object detction).
I upgraded to Frigate 0.13.1 the other day - I’m not sure if this is the point at which the clips stoppped working.
The Frigate logs show “database disk image is malformed”. I tried to fix this by:
- Stopping the Frigate addon
- Moving /config/frigate.db to a back-up folder
- Restarting the Frigate addon
The addon recreated the database but the problem has persisted - only clips from garden_gate_camera are working.
Accessing Home Assistant using samba share, I’m able to open the video files in VLC so the files themselves are fine, the problem seems to be with Frigate accessing its database to piece the videos back together.
Does anyone have any ideas how I can fix this?
Error log
2024-02-14 09:39:31.054114840 Traceback (most recent call last):
2024-02-14 09:39:31.054117044 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2190, in wsgi_app
2024-02-14 09:39:31.054118692 response = self.full_dispatch_request()
2024-02-14 09:39:31.054121081 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1486, in full_dispatch_request
2024-02-14 09:39:31.054122673 rv = self.handle_user_exception(e)
2024-02-14 09:39:31.054125081 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request
2024-02-14 09:39:31.054126562 rv = self.dispatch_request()
2024-02-14 09:39:31.054128951 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, in dispatch_request
2024-02-14 09:39:31.054131062 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2024-02-14 09:39:31.054132951 File "/opt/frigate/frigate/http.py", line 1897, in vod_event
2024-02-14 09:39:31.054134914 vod_response = vod_ts(event.camera, event.start_time, end_ts)
2024-02-14 09:39:31.054136766 File "/opt/frigate/frigate/http.py", line 1785, in vod_ts
2024-02-14 09:39:31.054138914 Recordings.select(Recordings.path, Recordings.duration, Recordings.end_time)
2024-02-14 09:39:31.054141080 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 2049, in iterator
2024-02-14 09:39:31.054142802 return iter(self.execute(database).iterator())
2024-02-14 09:39:31.054144914 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 1972, in inner
2024-02-14 09:39:31.054146654 return method(self, database, *args, **kwargs)
2024-02-14 09:39:31.054148802 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 2043, in execute
2024-02-14 09:39:31.054150284 return self._execute(database)
2024-02-14 09:39:31.054152450 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 2216, in _execute
2024-02-14 09:39:31.054153969 cursor = database.execute(self)
2024-02-14 09:39:31.054156117 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3260, in execute
2024-02-14 09:39:31.054157691 return self.execute_sql(sql, params)
2024-02-14 09:39:31.054160061 File "/usr/local/lib/python3.9/dist-packages/playhouse/sqliteq.py", line 247, in execute_sql
2024-02-14 09:39:31.054161598 return self._execute(sql, params)
2024-02-14 09:39:31.054163802 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3252, in execute_sql
2024-02-14 09:39:31.054165339 cursor.execute(sql, params or ())
2024-02-14 09:39:31.054167506 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3020, in __exit__
2024-02-14 09:39:31.054169413 reraise(new_type, new_type(exc_value, *exc_args), traceback)
2024-02-14 09:39:31.054171561 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 192, in reraise
2024-02-14 09:39:31.054173043 raise value.with_traceback(tb)
2024-02-14 09:39:31.054175246 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3252, in execute_sql
2024-02-14 09:39:31.054176783 cursor.execute(sql, params or ())
2024-02-14 09:39:31.054178561 peewee.DatabaseError: database disk image is malformed
Frigate config file
mqtt:
host: 192.168.1.44
user: mqttuser
password: xxxxxxxxxxxxx
detectors:
coral:
type: edgetpu
device: usb
birdseye:
enabled: false
ffmpeg:
hwaccel_args: preset-rpi-64-h264
go2rtc:
streams:
front_gate:
- rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true
front_gate_sub:
- rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1&unicast=true
driveway_camera:
- rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
driveway_camera_sub:
- rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=2&unicast=true&proto=Onvif
cameras:
front_gate:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/front_gate
roles:
- record
- path: rtsp://127.0.0.1:8554/front_gate_sub
roles:
- detect
detect:
width: 720
height: 576
fps: 4
enabled: true
objects:
track:
- person
- car
- bicycle
filters:
car:
mask: 132,303,132,276,0,295,0,329
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 178
required_zones:
- front_driveway
- neighbours_driveway
record:
enabled: true
retain:
days: 7
mode: motion
events:
pre_capture: 10
post_capture: 10
retain:
default: 28
mode: active_objects
required_zones:
- front_driveway
- neighbours_driveway
motion:
mask:
- 0,329,0,0,720,0,720,246,120,254,108,308
zones:
front_driveway:
coordinates: 0,393,248,436,253,229,720,256,720,576,0,576
neighbours_driveway:
coordinates: 244,233,161,248,148,366,21,399,252,429
front_driveway_left:
coordinates: 246,576,0,576,0,393,253,434
front_driveway_centre:
coordinates: 509,576,493,229,250,229,245,576
front_driveway_right:
coordinates: 720,576,720,258,510,233,509,576
driveway_camera:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/driveway_camera
roles:
- record
- path: rtsp://127.0.0.1:8554/driveway_camera_sub
roles:
- detect
detect:
width: 1280
height: 720
fps: 4
enabled: true
objects:
track:
- person
- car
- dog
filters:
car:
mask:
- 1280,720,0,720,0,0,220,0,246,489,665,475,734,0,1280,0
person:
threshold: 0.6
mask:
- 672,207,683,272,604,272,605,209
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 178
record:
enabled: true
retain:
days: 14
mode: motion
events:
pre_capture: 10
post_capture: 10
retain:
default: 28
mode: active_objects
motion:
mask:
- 0,0,1280,0,1280,720,320,720,477,456,970,462,1074,76,404,49,325,49,294,231,259,344,294,486,226,485,99,720,0,720
contour_area: 20
zones:
garden_gate:
coordinates: 419,154,379,159,383,58,421,55
front_door:
coordinates: 978,478,728,417,785,0,1076,0
garden_gate_camera:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/driveway_camera
roles:
- record
- path: rtsp://127.0.0.1:8554/driveway_camera
roles:
- detect
detect:
width: 2688
height: 1520
fps: 4
enabled: true
objects:
track:
- person
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 178
record:
enabled: true
retain:
days: 0
events:
pre_capture: 10
post_capture: 10
retain:
default: 28
mode: active_objects
motion:
mask:
- 754,0,0,0,0,1520,2688,1520,2688,0,752,0,752,103,896,113,900,324,762,334
contour_area: 20