Merge pull request #31 from outis1one/clDemoe/seasonal-sunrise-montage-nn268

Fix sunrise overlay vertical text and test-sunrise.sh pipeline bugs
This commit is contained in:
Outis
2026-04-21 13:03:26 -04:00
committed by GitHub
2 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -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<NF)printf "\\n"}}')
SR_VERT="${SR_TIME:0:1}\\\\n${SR_TIME:1:1}\\\\n${SR_TIME:2:1}\\\\n${SR_TIME:3:1}\\\\n${SR_TIME:4:1}"
DT="drawtext"
[ -n "$FONT" ] && DT="${DT}=fontfile='${FONT}'" || DT="${DT}"
DT="${DT}:text='${SR_VERT}'"
+13 -4
View File
@@ -49,8 +49,11 @@ mid_hms=$(basename "$mid_frame" .jpg) # HH-MM-SS
MID_TIME=$(echo "$mid_hms" | cut -c1-5 | tr '-' ':') # HH:MM
echo "Mid-point frame: $mid_hms → overlay time: $MID_TIME"
# Vertical text: each character on its own line (matches daily_sunrise_video.sh)
MID_VERT="${MID_TIME:0:1}\\n${MID_TIME:1:1}\\n${MID_TIME:2:1}\\n${MID_TIME:3:1}\\n${MID_TIME:4:1}"
# Vertical text: each character on its own line.
# Inside ffmpeg single-quoted text values, \ is an escape prefix so \n → n.
# We need \\n so ffmpeg parses it as \n which drawtext renders as a newline.
# In bash double-quotes \\\\n → \\n (the value stored in the variable).
MID_VERT="${MID_TIME:0:1}\\\\n${MID_TIME:1:1}\\\\n${MID_TIME:2:1}\\\\n${MID_TIME:3:1}\\\\n${MID_TIME:4:1}"
# ── Font detection ────────────────────────────────────────────────────────────
FONT=""
@@ -74,7 +77,13 @@ TMP_AUDIO=$(mktemp --suffix=.m4a)
cleanup() { rm -f "$TMP_LIST" "$TMP_RAW" "$TMP_SPED" "$TMP_AUDIO" 2>/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