From d776fad0cb974255267b8b27f2c26d96a22ecefa Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Apr 2026 14:21:50 +0000 Subject: [PATCH] 4-seasons: add progress reporting during validation and encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Print "Validating N frames..." before the loop, including active filter thresholds when grey-checking is on - Print "X / N frames checked..." every 500 frames so the user can see the loop is alive during the long ImageMagick pass - Print "Validation done: N valid frames" after the loop - Note "(may take several minutes)" on the Step 1 encode echo - Show the speed factor and target together: "28.8x → 11.08s target" https://claude.ai/code/session_01U29A8NpgJ41tboiggZNmk8 --- 4-seasons.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/4-seasons.sh b/4-seasons.sh index 0cad26f..1d4450e 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -103,8 +103,18 @@ mapfile -t all_images < <(find "$image_dir" -type f -name "*.jpg" | sort) GREY_MIN="${SEASONS_GREY_STDDEV_MIN:-0}" GREY_DARK_FLOOR="${SEASONS_GREY_DARK_FLOOR:-30}" LARGE_BYTES="${SEASONS_LARGE_FRAME_BYTES:-1048576}" # files above this skip content check -images=(); bad=0; grey=0 +total_frames=${#all_images[@]} +images=(); bad=0; grey=0; checked=0 +if [ "$GREY_MIN" != "0" ]; then + echo "Validating $total_frames frames (grey-filter active: stddev<${GREY_MIN}, mean>${GREY_DARK_FLOOR})..." +else + echo "Validating $total_frames frames..." +fi for img in "${all_images[@]}"; do + ((checked++)) || true + if (( checked % 500 == 0 || checked == total_frames )); then + echo " $checked / $total_frames frames checked..." + fi # Skip empty or unreadable files (0-byte writes from camera reconnects) if [ ! -r "$img" ] || [ ! -s "$img" ]; then echo "WARNING: skipping empty/missing frame: $(basename "$img")" @@ -133,6 +143,7 @@ if [ "${#images[@]}" -eq 0 ]; then echo "ERROR: no valid images remain after filtering — skipping $yesterday." exit 0 fi +echo "Validation done: ${#images[@]} valid frames" for img in "${images[@]}"; do printf "file '%s'\nduration 0.04\n" "$img" @@ -141,7 +152,7 @@ done > "$temp_file" printf "file '%s'\n" "${images[-1]}" >> "$temp_file" # ── Step 1: Build raw video ─────────────────────────────────────────────────── -echo "Step 1/2: encoding raw video from ${#images[@]} frames..." +echo "Step 1/2: encoding raw video from ${#images[@]} frames (may take several minutes)..." ffmpeg -loglevel warning \ -f concat -safe 0 -i "$temp_file" \ -c:v libx264 -pix_fmt yuv420p -preset "$ENCODE_PRESET" -crf "$CRF_SEASONS_RAW" -vsync 2 -an \ @@ -152,7 +163,7 @@ echo "Raw duration: $raw_duration s" # ── Step 2: Speed-adjust to target clip duration ────────────────────────────── speed_factor=$(echo "scale=6; $raw_duration / $target_per_clip" | bc) -echo "Step 2/2: speed factor $speed_factor..." +echo "Step 2/2: speed factor ${speed_factor}x → ${target_per_clip}s target..." final_file="$output_dir/${CAM_NAME}-${yesterday}_Mvt${MVT_NUM}-Day${DAY_OF_MVT}of${DAYS_IN_MVT}-final.mp4" if ! ffmpeg -loglevel warning \