* improve keyframes messages

* don't pad the labelmap with unknown

`load_labels()` prefilled 91 `unknown` entries before reading the label file, so any model with fewer than 91 classes kept that padding in `merged_labelmap` and `unknown` showed up as a selectable object type in the objects settings UI. The padding only existed so `RemoteObjectDetector.detect` could index the labelmap without a KeyError, and it didn't even cover the empty-file case or Frigate+, which never had a prefill. Both lookups now skip class ids the labelmap doesn't name and warn once per id.
This commit is contained in:
Josh Hawkins
2026-09-12 07:30:04 -06:00
committed by Nicolas Mowen
parent 853840dfd4
commit 396a2156b2
8 changed files with 160 additions and 21 deletions
+4 -2
View File
@@ -184,8 +184,10 @@
"gap": "Keyframe gap (min / avg / max):",
"segmentLength": "Recording segment length:",
"ok": "Keyframes every ~{{seconds}}s, good for recording and playback.",
"warning": "Sparse or variable keyframes (longest gap ~{{seconds}}s), likely a smart codec (H.264+/H.265+), this is not recommended.",
"error": "Keyframe gap (~{{seconds}}s) exceeds the recording segment length ({{segmentTime}}s). Some segments may have no keyframe, which breaks playback. Disable the smart/+ codec on the camera or shorten its keyframe interval.",
"warningFixed": "Keyframes are evenly spaced but sparse (every ~{{seconds}}s). Recording still works, but live playback and seeking start more slowly. Set the camera's I-frame (keyframe) interval to match its frame rate.",
"warningVariable": "Keyframe spacing is inconsistent ({{minSeconds}}s to {{maxSeconds}}s), which usually means a smart codec (H.264+/H.265+) is enabled. This is not recommended.",
"errorFixed": "Keyframes every ~{{seconds}}s is longer than the recording segment length ({{segmentTime}}s), so some segments have no keyframe and will not play back. Shorten the camera's I-frame (keyframe) interval to match its frame rate.",
"errorVariable": "Keyframe gaps reach ~{{seconds}}s, longer than the recording segment length ({{segmentTime}}s). Some segments will have no keyframe, which breaks playback. Disable the smart/+ codec on the camera or shorten its keyframe interval.",
"unknown": "Couldn't determine keyframe spacing.",
"recordDisabled": "Recording is disabled for this camera."
}
@@ -89,17 +89,29 @@ export default function KeyframeAnalysisSection({
case "warning":
summary = (
<Row icon="warning">
{t("cameras.info.keyframes.warning", { seconds: analysis.max_gap })}
{analysis.pattern === "fixed"
? t("cameras.info.keyframes.warningFixed", {
seconds: analysis.mean_gap,
})
: t("cameras.info.keyframes.warningVariable", {
minSeconds: analysis.min_gap,
maxSeconds: analysis.max_gap,
})}
</Row>
);
break;
case "error":
summary = (
<Row icon="error">
{t("cameras.info.keyframes.error", {
seconds: analysis.max_gap,
segmentTime: analysis.segment_time,
})}
{analysis.pattern === "fixed"
? t("cameras.info.keyframes.errorFixed", {
seconds: analysis.mean_gap,
segmentTime: analysis.segment_time,
})
: t("cameras.info.keyframes.errorVariable", {
seconds: analysis.max_gap,
segmentTime: analysis.segment_time,
})}
</Row>
);
break;
+3
View File
@@ -161,6 +161,8 @@ export type KeyframeSeverity =
| "unknown"
| "record_disabled";
export type KeyframeGapPattern = "fixed" | "variable";
export type KeyframeAnalysis = {
severity: KeyframeSeverity;
stream_index?: number;
@@ -168,6 +170,7 @@ export type KeyframeAnalysis = {
max_gap?: number | null;
mean_gap?: number | null;
min_gap?: number | null;
pattern?: KeyframeGapPattern | null;
duration_observed?: number | null;
segment_time?: number;
thresholds?: { warning: number; error: number };