From d0399fb72df40141c49418f213a8f79950315d0b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 18:29:58 +0000 Subject: [PATCH] =?UTF-8?q?4-seasons:=20restore=20original=20concat=20appr?= =?UTF-8?q?oach=20=E2=80=94=20no=20duration=20per=20frame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit duration=INTERVAL in the concat file made a 0.1fps raw video, which x264 couldn't speed up 4000x cleanly and produced 20s of the last frame instead. The original script used plain 'file path' entries with no duration, letting ffmpeg default to 25fps internally. The speed_factor calculation against raw_duration compensates correctly either way, but only the standard-fps raw video survives the extreme setpts transform. Also removed the coverage_pct check which was based on images*INTERVAL and became meaningless without duration. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- 4-seasons.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/4-seasons.sh b/4-seasons.sh index f480596..43bdf36 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -129,12 +129,11 @@ if [ "${#images[@]}" -eq 0 ]; then fi for img in "${images[@]}"; do - printf "file '%s'\nduration %s\n" "$img" "$INTERVAL" + printf "file '%s'\n" "$img" 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 ($(( ${#images[@]} * INTERVAL / 3600 ))h coverage)..." +echo "Step 1/2: encoding raw video from ${#images[@]} frames..." 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 \ @@ -142,14 +141,6 @@ ffmpeg -loglevel warning \ raw_duration=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$temp_video") echo "Raw duration: $raw_duration s" -# Warn if raw video covers less than 50% of expected image count (big gap or camera outage) -expected_dur=$(echo "scale=0; ${#images[@]} * $INTERVAL" | bc) -coverage_pct=$(echo "scale=0; $raw_duration * 100 / $expected_dur" | bc 2>/dev/null || echo "?") -if [ "$coverage_pct" != "?" ] && [ "$coverage_pct" -lt 50 ]; then - echo "WARNING: raw video is ${coverage_pct}% of expected ${expected_dur}s — significant image gap detected" - "$SCRIPT_DIR/notify.sh" "WARNING: [$CAM_NAME] $SEASON Mvt$MVT_NUM Day$DAY_OF_MVT — only ${coverage_pct}% coverage ($yesterday)" \ - "Raw video ${raw_duration}s of expected ${expected_dur}s — check camera logs for gaps" || true -fi # ── Step 2: Speed-adjust to target clip duration ────────────────────────────── speed_factor=$(echo "scale=6; $raw_duration / $target_per_clip" | bc)