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:
+11
-5
@@ -72,6 +72,10 @@ if [ "$total_images" -lt 1 ]; then
|
||||
fi
|
||||
echo "Images found: $total_images"
|
||||
|
||||
# ── Per-camera capture interval ───────────────────────────────────────────────
|
||||
interval_var="CAPTURE_INTERVAL_${CAM_NAME}"
|
||||
INTERVAL="${!interval_var:-${CAPTURE_INTERVAL:-10}}"
|
||||
|
||||
# ── Prepare output directory ──────────────────────────────────────────────────
|
||||
output_dir="$MOVIES_DIR/$CAM_NAME/$ASTRO_YEAR/$SEASON/Mvt$MVT_NUM"
|
||||
mkdir -p "$output_dir"
|
||||
@@ -82,12 +86,14 @@ temp_video="$output_dir/${yesterday}_Mvt${MVT_NUM}-temp.mp4"
|
||||
cleanup() { rm -f "$temp_file" "$temp_video" 2>/dev/null || true; }
|
||||
trap cleanup EXIT
|
||||
|
||||
find "$image_dir" -type f -name "*.jpg" | sort | while read -r img; do
|
||||
echo "file '$img'"
|
||||
mapfile -t images < <(find "$image_dir" -type f -name "*.jpg" | sort)
|
||||
for img in "${images[@]}"; do
|
||||
printf "file '%s'\nduration %s\n" "$img" "$INTERVAL"
|
||||
done > "$temp_file"
|
||||
printf "file '%s'\n" "${images[-1]}" >> "$temp_file"
|
||||
|
||||
# ── Step 1: Build raw video at default frame rate ─────────────────────────────
|
||||
echo "Step 1/2: encoding raw video..."
|
||||
# ── Step 1: Build raw video ───────────────────────────────────────────────────
|
||||
echo "Step 1/2: encoding raw video from ${#images[@]} frames..."
|
||||
ffmpeg -loglevel warning \
|
||||
-f concat -safe 0 -i "$temp_file" \
|
||||
-c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SEASONS_RAW" -vsync 2 -an \
|
||||
@@ -103,7 +109,7 @@ echo "Step 2/2: speed factor $speed_factor..."
|
||||
final_file="$output_dir/${yesterday}_Mvt${MVT_NUM}-Day${DAY_OF_MVT}of${DAYS_IN_MVT}-final.mp4"
|
||||
if ! ffmpeg -loglevel warning \
|
||||
-i "$temp_video" \
|
||||
-vf "setpts=PTS/$speed_factor" \
|
||||
-vf "setpts=PTS/$speed_factor,fps=25" \
|
||||
-c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SEASONS_FINAL" \
|
||||
-t "$target_per_clip" -an \
|
||||
-y "$final_file"; then
|
||||
|
||||
Reference in New Issue
Block a user