src.nth.io/

summaryrefslogtreecommitdiff
path: root/scrypted/scrypted-viewport.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scrypted/scrypted-viewport.ts')
-rw-r--r--scrypted/scrypted-viewport.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/scrypted/scrypted-viewport.ts b/scrypted/scrypted-viewport.ts
index 7b69a75..22f233a 100644
--- a/scrypted/scrypted-viewport.ts
+++ b/scrypted/scrypted-viewport.ts
@@ -614,9 +614,17 @@ class ScryptedViewportProvider extends ScryptedDeviceBase
// panel is already in the right rotation. The firmware never
// touches pixels — the hardware JPEG decoder writes BGR888
// straight into a DMA buffer that gets handed to the DSI engine.
+ // Filter order matters here. Earlier we did
+ // scale=480:800,transpose=1
+ // which intermittently produced a JPEG with a SOF marker
+ // reporting 480x800 — the firmware then rejected it with
+ // "expected 800x480, got 480x800". Rotating *first* and then
+ // scaling to an EXPLICIT panelWxpanelH (with setsar to clear
+ // any leftover aspect-ratio metadata) makes the final encoded
+ // dimensions deterministic regardless of source resolution.
const vf = v.orientation === "portrait"
- ? `scale=${panelH}:${panelW}:flags=lanczos,transpose=1` // 90° CW → panelW x panelH
- : `scale=${panelW}:${panelH}:flags=lanczos`;
+ ? `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));
// Pull the camera's video stream, convert to ffmpeg input args, and