src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/http_api.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-15 06:52:43 -0500
committerLuke Hoersten <[email protected]>2026-06-15 06:52:43 -0500
commit96778b37aa6ebe999fcb894a7ae8d0151a2def28 (patch)
tree05a2ac16d9806d15862da0f8320408e5be393666 /main/http_api.c
parent80defa7ee6815984477030464e3587b54e0e9f51 (diff)
scrypted: live ffmpeg streaming replaces snapshot polling
Replace the setInterval(cam.takePicture) loop with a single ffmpeg child per active stream that: 1. pulls the camera's video stream via getVideoStream + converts to ffmpeg input args via ScryptedMimeTypes.FFmpegInput, 2. transcodes inline: scale=W:H:flags=lanczos, fps=N, c:v=mjpeg q:v=2, -f image2pipe to stdout, 3. demuxes JPEG frames from stdout (FFD8…FFD9 boundaries), 4. POSTs each frame to the firmware's existing /frame endpoint with the same single-flight semantics as before — surplus frames are dropped silently and counted for a periodic skip-rate log so the operator can dial frame_interval_ms to where the firmware sustains. Wins vs. the snapshot path: - The camera's main H.264 encoder is producing keyframes for free; we pay near-zero on the source side instead of triggering a full snapshot fetch per frame (the cost that capped us at ~2 fps). - ffmpeg sustains the requested fps as long as the firmware can decode + paint at that rate. Measured ceiling is the firmware, not the source, so the actual fps lands near the panel's true limit. - Lanczos + q:v 2 keeps the picture sharp end-to-end. stopStream now SIGTERMs the ffmpeg child alongside aborting outstanding fetches. Each successful paint also nudges the Scrypted-side idle timer so a healthy stream stays open as long as frames are landing. Drop the now-unused pushFrame + resizeJpegHQ + the old setInterval machinery.
Diffstat (limited to 'main/http_api.c')
0 files changed, 0 insertions, 0 deletions