From eba8ddd5506fe077d20f9ba45b95343cdd571fce Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 16:35:25 +0000 Subject: [PATCH] Fix sunrise overlay vertical text and test-sunrise.sh pipeline bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Overlay text was showing characters run together (e.g. '1n2n') because inside ffmpeg single-quoted filter text, \n is consumed as just 'n'. Fix: use \\\\n in bash double-quotes which stores \\n in the variable, which ffmpeg then parses as \n, which drawtext renders as a newline. Applied to both test-sunrise.sh (MID_VERT) and daily_sunrise_video.sh (SR_VERT, replacing the awk one-liner with the same bash approach). - test-sunrise.sh concat list was missing per-frame duration entries, causing 12 frames to encode as 0.48s (25fps default) and then slow down instead of compress. Fixed by writing 'duration INTERVAL' per frame so 12 frames × 10s = 120s raw → 12× compression to 10s. - Removed 2>/dev/null from audio ffmpeg call in test-sunrise.sh so capture failures are visible for diagnosis. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- daily_sunrise_video.sh | 2 +- test-sunrise.sh | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/daily_sunrise_video.sh b/daily_sunrise_video.sh index d262b1f..1118685 100644 --- a/daily_sunrise_video.sh +++ b/daily_sunrise_video.sh @@ -143,7 +143,7 @@ echo "Speed-adjusted: ${sped_dur}s (saved — overlay still pending)" SR_TIME=$(echo "$sunrise_time_local" | cut -d'-' -f1,2 | tr '-' ':') DT="" if [ "${SUNRISE_OVERLAY_ENABLED:-true}" = "true" ]; then - SR_VERT=$(echo "$SR_TIME" | awk 'BEGIN{FS=""}{for(i=1;i<=NF;i++){printf "%s",$i; if(i/dev/null || true; } trap cleanup EXIT -printf "file '%s'\n" "${frames[@]}" > "$TMP_LIST" +# Write concat list with explicit duration per frame so raw video represents +# real elapsed time: 12 frames × CAPTURE_INTERVAL seconds = ~2 minutes. +# The final entry needs a duplicate without duration (ffmpeg concat requirement). +for f in "${frames[@]}"; do + printf "file '%s'\nduration %s\n" "$f" "${CAPTURE_INTERVAL:-10}" +done >> "$TMP_LIST" +printf "file '%s'\n" "${frames[-1]}" >> "$TMP_LIST" # ── Step 1: raw video from frames ───────────────────────────────────────────── echo "" @@ -111,7 +120,7 @@ if [ -n "$RTSP_URL" ]; then -i "$RTSP_URL" \ -t "$SUNRISE_TARGET_SECS" \ -vn -c:a aac -b:a 64k \ - -y "$TMP_AUDIO" 2>/dev/null; then + -y "$TMP_AUDIO"; then HAS_AUDIO=true echo " Audio: captured OK" else