[Bug]: Preview generation fails after Frigate restart when camera name is a prefix of another camera name (e.g. patio_lower / patio_lower_thermal) #22579
Replies: 2 comments
-
|
This is a valid bug report identifying a prefix-matching issue in The root cause analysis is accurate: the code uses The proposed fix—appending # Before
if not file.startswith(file_start):
# After
if not file.startswith(file_start + "-"):This ensures exact camera name matching:
A similar issue with preview frame cache restoration across filesystem boundaries was discussed in a GitHub discussion, where the This bug affects any deployment using Frigate's 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
This has been improved in #22594 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checklist
Describe the problem you are having
PreviewRecorder.__init__usesfile.startswith(file_start)to scan cached previewframe files on startup. Because
file_startis built from the camera name without atrailing dash (e.g.
"preview_patio_lower"), it incorrectly matches files belonging tocameras whose names share that prefix (e.g.
"preview_patio_lower_thermal-xxx.webp").This causes phantom timestamps from the wrong camera to be loaded into
output_frames.When
FFMpegConverterruns at the next hour boundary, it builds a concat playlist usingthe correct camera's file paths for those timestamps — but those files don't exist (only
the other camera's files exist at those timestamps). FFmpeg fails with:
Error opening input: Invalid data found when processing input
Error opening input file /dev/stdin.
Error opening input files: Invalid data found when processing input
The missing preview is then skipped entirely (no
.mp4written for that hour).This is triggered every time Frigate restarts (process restart via s6, not full container
restart) when:
/tmp/cache/preview_frames/) is not cleared on restart(i.e. cache is a Docker tmpfs that persists across s6 restarts)
Frigate's own
_thermalnaming convention)Steps to reproduce
Steps to Reproduce
patio_lower(regular camera)patio_lower_thermal(thermal channel of the same physical camera)(This also affects
front_door/front_door_thermal,compost_bin/compost_bin_thermal, etc.)docker execor ans6-triggered restart due to a crash
Result:
frigate.output.previewlogsError saving preview for <camera>and nopreview MP4 is written for that hour segment.
Expected: Preview generation succeeds using only frames belonging to the named camera.
Root Cause
File:
frigate/output/preview.py,PreviewRecorder.__init__, approximately line 218:docker-compose file or Docker CLI command
Relevant Frigate log output
Relevant go2rtc log output
Operating system
Debian
Install method
Docker Compose
Network connection
Wired
Camera make and model
Hikvision
Screenshots of the Frigate UI's System metrics pages
na
Any other information that may be helpful
Environment
cleared on full Docker container restart)
commonly the built-in _thermal naming convention (e.g. patio_lower +
patio_lower_thermal)
libx264 regardless of hwaccel config)
Beta Was this translation helpful? Give feedback.
All reactions