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
+32
View File
@@ -187,6 +187,38 @@ if [ "${AUDIO_ENABLED:-false}" = "true" ]; then
timers+=("sky-cam-audio-capture")
fi
# ── Ambient audio recording services ─────────────────────────────────────────
# One long-running service per camera in AMBIENT_CAMS.
# Enabled alongside the capture services so install.sh restarts them on update.
if [ "${AMBIENT_ENABLED:-false}" = "true" ]; then
for cam in "${AMBIENT_CAMS[@]}"; do
rtsp_var="CAM_RTSP_${cam}"
if [ -n "${!rtsp_var:-}" ]; then
cat > "$UNIT_DIR/sky-cam-ambient-${cam}.service" <<EOF
[Unit]
Description=Sky-Cam — ${cam}: ambient audio recorder
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=$SCRIPT_DIR/ambient-record.sh ${cam}
Restart=on-failure
RestartSec=30
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=default.target
EOF
echo " wrote sky-cam-ambient-${cam}.service"
capture_services+=("sky-cam-ambient-${cam}")
else
echo " WARNING: CAM_RTSP_${cam} not set — skipping ambient service for ${cam}"
fi
done
fi
# ── Per-camera Four Seasons jobs ─────────────────────────────────────────────
# Reads CAMERAS and SCHEDULE_SEASONS_<cam> from sky-cam.conf.
# Script receives the camera name as $1 so it knows which camera to process.