4-seasons: protect night frames from grey filter with brightness floor

A stddev-only filter would wrongly drop near-black night frames.
Now only skips a frame when BOTH stddev < GREY_MIN AND mean brightness
> GREY_DARK_FLOOR (default 30/255).  Night frames are dark so they
always pass; bad-signal grey frames are mid-bright so they are caught.

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-22 16:17:22 +00:00
parent 4aeee6b3d5
commit ec8eb7aebf
2 changed files with 20 additions and 7 deletions
+12 -4
View File
@@ -257,13 +257,21 @@ AUDIO_BITRATE=192k # montage-mvt.sh — music track on movement
# ── Frame validation (4-seasons.sh) ──────────────────────────────────────────
# Corrupt or empty frames (e.g. first frame after a camera reconnect) are always
# skipped automatically via ffprobe.
# skipped automatically via ffprobe. No config needed.
#
# SEASONS_GREY_STDDEV_MIN: also skip uniform-grey frames caused by a bad RTSP
# signal. These are valid JPEGs but contain a near-solid grey image.
# Value is the minimum pixel standard deviation on a 0255 scale.
# 0 = disabled (default). Try 510 if your camera produces grey frames on reconnect.
# signal (valid JPEGs, but near-solid grey — no real image content).
# A frame is only skipped when BOTH conditions hold:
# 1. pixel standard deviation (0255) is below SEASONS_GREY_STDDEV_MIN
# 2. mean brightness (0255) is above SEASONS_GREY_DARK_FLOOR
# This keeps genuine night frames (dark + low stddev) while dropping
# bad-signal grey frames (mid-bright + low stddev).
#
# SEASONS_GREY_STDDEV_MIN=0 disables the filter entirely (default).
# Try 510 if your camera produces solid-grey frames on reconnect.
# Requires ImageMagick (convert) to be installed.
SEASONS_GREY_STDDEV_MIN=0
SEASONS_GREY_DARK_FLOOR=30 # frames with mean brightness below this are always kept
# ── Montage attribution overlay ───────────────────────────────────────────────
# A translucent bar across the top of each movement montage, naming the