Per-camera capture interval; ambient recorder; fix 4-seasons one-frame bug

Per-camera capture interval:
  CAPTURE_INTERVAL_<cam> in sky-cam.conf overrides the global value for
  a specific camera.  capture.sh and 4-seasons.sh both respect it.
  Example: south at 30s saves storage; north at 5s gives smoother motion.

4-seasons.sh one-frame bug fix:
  Same root cause as the sunrise scripts — concat list had no 'duration'
  entries, collapsing all JPEG frames to timestamp 0.  Fixed by writing
  'duration INTERVAL' per frame.  Added fps=25 to the speed-adjust step
  so the VFR source resamples to a standard frame rate.

ambient-record.sh (new):
  Continuous AAC recorder for natural sounds (birds, rain, wind).
  Saves AMBIENT_CHUNK_SECS chunks to AMBIENT_DIR/<cam>/YYYY-MM-DD/HH-MM-SS.m4a.
  Reconnects automatically on stream failure.  Rolling retention via
  AMBIENT_RETENTION_DAYS.  Enabled by setting AMBIENT_ENABLED=true and
  listing cameras in AMBIENT_CAMS in sky-cam.conf, then re-running install.sh.

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-21 21:08:10 +00:00
parent cdaca67d31
commit dbdd59677f
5 changed files with 145 additions and 6 deletions
+21
View File
@@ -287,8 +287,16 @@ MONTAGE_MUSIC_LOOPS_Spring_2=2
# CAPTURE_STALE_SECS should always be at least 2× CAPTURE_INTERVAL.
CAPTURE_INTERVAL=10
# Per-camera overrides — uncomment and set to override the global value above.
# Useful when cameras serve different purposes (e.g. south records ambient audio
# so fewer frames is fine; north faces a busy scene and benefits from 5s).
#CAPTURE_INTERVAL_east=10
#CAPTURE_INTERVAL_north=10
#CAPTURE_INTERVAL_south=30
# Seconds without a new frame before the watchdog sends a stall notification.
# A recovery notification fires automatically when capture resumes.
# Must always be at least 2× the effective CAPTURE_INTERVAL for that camera.
CAPTURE_STALE_SECS=30
# ── Sunrise audio capture ──────────────────────────────────────────────────────
@@ -302,6 +310,19 @@ CAPTURE_AUDIO_BITRATE=96k # bitrate for the sunrise audio recording
# Audio is recorded for exactly SUNRISE_TARGET_SECS, centred on actual sunrise:
# floor(TARGET/2) seconds before, ceil(TARGET/2) after (odd second → post-sunrise).
# ── Ambient audio library ──────────────────────────────────────────────────────
# Continuously records natural sounds (birds, rain, wind) from AMBIENT_CAMS to
# build a reusable audio library. Runs as a permanent systemd service alongside
# capture.sh. Camera audio is 8 kHz mono (phone quality) — enough for nature
# sounds and white-noise style playback.
#
AMBIENT_ENABLED=false
AMBIENT_CAMS=(south) # cameras to record from
AMBIENT_DIR="${BASE_DIR}/ambient" # root storage directory
AMBIENT_CHUNK_SECS=1800 # seconds per file (default 30 min)
AMBIENT_BITRATE=96k # AAC bitrate; 6496k is plenty at 8 kHz
AMBIENT_RETENTION_DAYS=30 # delete files older than this; 0 = keep forever
# ── Mattermost — daily sunrise upload ─────────────────────────────────────────
# mattermost_url, access_token, channel_id go in .env (see bottom of this file).