Encoding: H.265 final montages, slow preset, sunrise retention

- sky-cam.conf: add ENCODE_PRESET=slow (applied to all encodes);
  split CRF_MONTAGE (intermediates, H.264) from CRF_MONTAGE_FINAL=22
  (archive montage, H.265); add SUNRISE_RETENTION_DAYS=10; improve
  CAPTURE_INTERVAL comment with storage/density table
- montage-mvt.sh: steps 1+2 use preset; step 3 final switches to
  libx265 + CRF_MONTAGE_FINAL + -tag:v hvc1 for broad compatibility
- 4-seasons.sh: both encode steps use ENCODE_PRESET
- daily_sunrise_video.sh: all encode steps use ENCODE_PRESET; rolling
  retention deletes sunrise videos older than SUNRISE_RETENTION_DAYS

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-20 17:27:57 +00:00
parent ab06c1cc2b
commit a395f9baba
4 changed files with 42 additions and 20 deletions
+13 -3
View File
@@ -110,7 +110,7 @@ raw_video=$(mktemp --suffix=.mp4)
echo "Step 1/3: encoding raw video..."
if ! ffmpeg -loglevel warning \
-f concat -safe 0 -i "$temp_list" \
-c:v libx264 -pix_fmt yuv420p -crf "$CRF_SUNRISE" -vsync 2 -an \
-c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SUNRISE" -vsync 2 -an \
-y "$raw_video"; then
"$SCRIPT_DIR/notify.sh" "FAILED: sunrise step 1/3 (encode) $current_date" \
"ffmpeg raw encode from images failed — check: journalctl -u sky-cam-sunrise.service" || true
@@ -128,7 +128,7 @@ echo "Step 2/3: speed-adjust → $sped_video"
if ! ffmpeg -loglevel warning \
-i "$raw_video" \
-vf "setpts=PTS/${speed_factor}" \
-c:v libx264 -pix_fmt yuv420p -crf "$CRF_SUNRISE" -an \
-c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SUNRISE" -an \
-y "$sped_video"; then
rm -f "$sped_video"
"$SCRIPT_DIR/notify.sh" "FAILED: sunrise step 2/3 (speed) $current_date" \
@@ -223,7 +223,7 @@ if [ -n "$DT" ]; then
if ffmpeg -loglevel warning \
-i "$work_video" \
-vf "${DT}" \
-c:v libx264 -pix_fmt yuv420p -crf "$CRF_SUNRISE" \
-c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SUNRISE" \
"${audio_out_flags[@]}" \
-y "$final_video"; then
step3b_ok=true
@@ -253,4 +253,14 @@ if $step3b_ok; then
[ -f "$cam_audio" ] && rm -f "$cam_audio"
"$SCRIPT_DIR/notify.sh" "Sunrise ready: $current_date" \
"$(basename "$final_video")${actual_dur}s, sunrise at ${SR_TIME}" || true
# ── Rolling retention: delete sunrise videos older than SUNRISE_RETENTION_DAYS ─
retain="${SUNRISE_RETENTION_DAYS:-10}"
if [ "$retain" -gt 0 ]; then
deleted_old=$(find "$MOVIES_DIR/$CAM_NAME" \
-path "*/sunrise-only/*-daily-sunrise.mp4" \
-mtime +"$retain" -print -delete 2>/dev/null | wc -l)
[ "$deleted_old" -gt 0 ] && \
echo "Retention: deleted $deleted_old sunrise video(s) older than ${retain} days"
fi
fi