4-seasons: restore original concat approach — no duration per frame
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
This commit is contained in:
+2
-11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user