Fix afade: bc omits leading zero for values < 1 (.850 → 0.850)

fade_dur = SUNRISE_TARGET_SECS * 0.085 = 0.850 at the default 10s target.
bc outputs .850 without a leading zero, which ffmpeg's afade filter rejects
with "Unable to parse option value .850 as duration". Pipe bc output through
sed to prepend the zero when the value starts with '.'.

https://claude.ai/code/session_01DANuzLCLhhQ7Li12RTcswY
This commit is contained in:
Claude
2026-05-01 05:09:57 +00:00
parent 61e9e4d0be
commit ed8982da0e
+2 -2
View File
@@ -440,8 +440,8 @@ if $TEST_MODE; then
else
final_video="$output_dir/$CAM_NAME-$current_date-daily-sunrise.mp4"
fi
fade_dur=$(echo "scale=3; $SUNRISE_TARGET_SECS * 0.085" | bc)
fade_out=$(echo "scale=3; $SUNRISE_TARGET_SECS - $fade_dur" | bc)
fade_dur=$(echo "scale=3; $SUNRISE_TARGET_SECS * 0.085" | bc | sed 's/^\./0./')
fade_out=$(echo "scale=3; $SUNRISE_TARGET_SECS - $fade_dur" | bc | sed 's/^\./0./')
# ── Step 3a: mix audio (video copied, not re-encoded) ────────────────────────
work_video="$sped_video"