4-seasons: add progress reporting during validation and encoding
- 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
This commit is contained in:
+14
-3
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user