diff options
| author | Luke Hoersten <[email protected]> | 2026-06-20 09:49:36 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-20 09:49:36 -0500 |
| commit | d8d9a662f045aca6b0bf1f0e0494f9034ec54a80 (patch) | |
| tree | 0e0d07e63766dbaa0ba98b5b9d008e14530ff72e | |
| parent | 7a0bec79023dd6c2922ade360b3d024a7d0447bc (diff) | |
scrypted: drop frame_interval_ms, brightness default 80 → 100
Two settings cleanups now that streaming has landed:
- frame_interval_ms removed entirely. Under the TCP streaming data
plane ffmpeg emits at the camera's native rate and TCP backpressure
naturally caps us when the firmware can't keep up. The setting,
the getter, the UI field, and the -vf "fps=N" filter argument all
go away. Net: a few fewer questions to answer on every viewport,
and one fewer place for the user to misconfigure latency. Existing
storage values are silently ignored on next render.
- Default brightness 80 → 100. The panel is dim enough at 80 that
the change in ambient lighting can wash it out; 100 is a better
default. Users who want lower can still set it in the UI; this
only affects newly-created viewports (existing ones keep whatever
was last saved).
| -rw-r--r-- | scrypted/scrypted-viewport.ts | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/scrypted/scrypted-viewport.ts b/scrypted/scrypted-viewport.ts index 8bd4e1d..229254c 100644 --- a/scrypted/scrypted-viewport.ts +++ b/scrypted/scrypted-viewport.ts @@ -6,7 +6,7 @@ // short git hash of the commit that added this constant — if the // hash in the log doesn't match the HEAD this file came from, the // Scrypted Script editor is still on stale code. -const SCRIPT_VERSION = "b97c250"; +const SCRIPT_VERSION = "pending"; // // Architecture // ------------ @@ -85,7 +85,10 @@ type SettingValue = any; // Tuning constants. Frame interval is also exposed on the parent's // Settings page so it can be tweaked without editing the script. -const DEFAULT_FRAME_INTERVAL_MS = 500; // ~2 fps — snapshot-based; cameras typically can't sustain faster +// (frame_interval_ms removed in b97c250 — under the TCP streaming +// data plane ffmpeg emits at the camera's native rate and TCP back- +// pressure naturally caps us when the firmware can't keep up. The +// fps filter was only ever useful as a max-fps safety under HTTP.) const REREGISTER_INTERVAL_MS = 5 * 60_000; // 5s gives /state + /config posts enough headroom to slip in between // /frame POSTs when the device is mid-stream. The firmware's single @@ -95,7 +98,7 @@ const REREGISTER_INTERVAL_MS = 5 * 60_000; // back-to-back startStream calls. const HTTP_TIMEOUT_MS = 5_000; const DEFAULT_IDLE_TIMEOUT_MS = 60_000; -const DEFAULT_BRIGHTNESS = 80; +const DEFAULT_BRIGHTNESS = 100; // ============================================================================ // Child: one viewport binding @@ -120,11 +123,6 @@ class Viewport extends ScryptedDeviceBase implements Settings { const v = this.storage.getItem("brightness"); return v ? Math.max(0, Math.min(100, parseInt(v, 10) || 0)) : DEFAULT_BRIGHTNESS; } - get frameIntervalMs(): number { - const v = this.storage.getItem("frame_interval_ms"); - const parsed = v ? parseInt(v, 10) : NaN; - return Number.isFinite(parsed) ? Math.max(33, parsed) : DEFAULT_FRAME_INTERVAL_MS; - } // ffmpeg mjpeg encoder -q:v. Valid range 1..31, lower = higher // quality + bigger JPEG (1 ≈ visually lossless, 31 ≈ very lossy). // Default 1 — with HTTP keep-alive + NODELAY we have plenty of @@ -199,14 +197,6 @@ class Viewport extends ScryptedDeviceBase implements Settings { } as any, { group: "Display", - key: "frame_interval_ms", - title: "Frame push interval (ms)", - description: `How often a JPEG snapshot is POSTed during an active stream. Lower = smoother but more network + CPU; clamped to ≥ 33 ms (~30 fps max). Default ${DEFAULT_FRAME_INTERVAL_MS}.`, - type: "number", - value: this.frameIntervalMs, - } as any, - { - group: "Display", key: "jpeg_quality", title: "JPEG quality (1–31, lower = better)", description: "ffmpeg mjpeg encoder -q:v. 1 ≈ visually lossless (~140KB at panel-native), 5 ≈ good (~70KB), 10+ noticeably lossy. Default 1.", @@ -761,7 +751,6 @@ class ScryptedViewportProvider extends ScryptedDeviceBase const vf = v.orientation === "portrait" ? `transpose=1,scale=${panelW}:${panelH}:flags=lanczos,setsar=1` : `scale=${panelW}:${panelH}:flags=lanczos,setsar=1`; - const fps = Math.max(1, Math.round(1000 / v.frameIntervalMs)); const qv = String(v.jpegQuality); // Diagnostic — confirms which filter chain the *currently loaded* // script is actually using. If you don't see this line in the @@ -892,7 +881,7 @@ class ScryptedViewportProvider extends ScryptedDeviceBase "-analyzeduration", "0", ...(ffmpegInput.inputArguments || []), "-an", "-sn", - "-vf", `${vf},fps=${fps}`, + "-vf", vf, // -fps_mode drop: when the decoder is behind, throw the // late frame on the floor instead of queueing it. Without // this, ffmpeg's output queue fills up and the displayed |
