Add per-step resilience and notifications across all video pipeline scripts
Each pipeline now saves intermediate files permanently before the step most likely to fail, so a partial failure leaves a recoverable artifact: - daily_sunrise_video.sh: speed-adjusted video (*-sped.mp4) survives if the drawtext overlay step fails; deleted automatically on success - montage-mvt.sh: speed-adjusted video (*-Sped.mp4) survives if the music-mux + attribution overlay step fails; deleted on success - 4-seasons.sh / montage-mvt.sh / year-end-join.sh: explicit ffmpeg error handling with targeted notify.sh calls naming the failed step and the surviving artifact path - montage-mvt.sh / 4-seasons.sh / year-end-join.sh: clip-duration-sum vs music-duration drift check warns when cumulative float error exceeds 2 s https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
+18
-2
@@ -90,16 +90,32 @@ speed_factor=$(echo "scale=6; $raw_duration / $target_per_clip" | bc)
|
||||
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"
|
||||
ffmpeg -loglevel warning \
|
||||
if ! ffmpeg -loglevel warning \
|
||||
-i "$temp_video" \
|
||||
-vf "setpts=PTS/$speed_factor" \
|
||||
-c:v libx264 -pix_fmt yuv420p -crf "$CRF_SEASONS_FINAL" \
|
||||
-t "$target_per_clip" -an \
|
||||
-y "$final_file"
|
||||
-y "$final_file"; then
|
||||
rm -f "$final_file"
|
||||
"$SCRIPT_DIR/notify.sh" "FAILED: $SEASON Mvt$MVT_NUM Day$DAY_OF_MVT speed-adjust ($yesterday)" \
|
||||
"ffmpeg speed-adjust failed — re-run 4-seasons.sh $CAM_NAME while JPGs exist" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
adjusted=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$final_file")
|
||||
echo "Daily clip: $final_file ($adjusted s)"
|
||||
|
||||
# Warn if clip duration deviates more than 0.5 s from target (float drift check)
|
||||
drift=$(echo "scale=3; $adjusted - $target_per_clip" | bc | sed 's/^-//')
|
||||
if awk "BEGIN{exit !($drift > 0.5)}"; then
|
||||
echo "WARNING: clip duration ${adjusted}s differs from target ${target_per_clip}s by ${drift}s"
|
||||
"$SCRIPT_DIR/notify.sh" "WARNING: $SEASON Mvt$MVT_NUM Day$DAY_OF_MVT duration drift ($yesterday)" \
|
||||
"Clip ${adjusted}s vs target ${target_per_clip}s (drift ${drift}s)" || true
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR/notify.sh" "$SEASON Mvt$MVT_NUM Day$DAY_OF_MVT/$DAYS_IN_MVT saved ($yesterday)" \
|
||||
"$(basename "$final_file") — ${adjusted}s" || true
|
||||
|
||||
# ── Auto-trigger montage on last day of movement ──────────────────────────────
|
||||
if [ "$IS_LAST_DAY" = "true" ]; then
|
||||
echo "Last day of $SEASON Mvt $MVT_NUM — triggering montage compilation..."
|
||||
|
||||
Reference in New Issue
Block a user