Record that the stream never emits ENDLIST after full time
The feed switches to a static league slate and keeps serving at full CBR bitrate. No end marker, and no stall to detect, so neither of the obvious exit conditions fires. The duration cap is the only stop condition. Observed on a live match: 116 min recorded, still running 2h04m after kickoff, stopped manually. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kyt7QHQvLJtQRuiY4wAqKB
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# Watch a live recording until its downloaders exit, and record HOW they ended.
|
||||
#
|
||||
# The question this answers: when the stream stops, does ffmpeg finish cleanly
|
||||
# on #EXT-X-ENDLIST, or does it hang until something kills it? Unattended
|
||||
# recording depends on the answer -- a job that never exits needs a hard cap.
|
||||
set -u
|
||||
cd "$(dirname "$0")"
|
||||
LOG=logs/endwatch.log
|
||||
mkdir -p logs
|
||||
|
||||
say() { echo "[$(date '+%H:%M:%S')] $*" | tee -a "$LOG"; }
|
||||
|
||||
say "endwatch start"
|
||||
LAST_TOTAL=0
|
||||
STALL=0
|
||||
|
||||
while true; do
|
||||
N=$(tasklist //FI "IMAGENAME eq ffmpeg.exe" 2>/dev/null | grep -c ffmpeg.exe)
|
||||
TOTAL=0
|
||||
for f in recordings/*; do
|
||||
[ -f "$f" ] && TOTAL=$(( TOTAL + $(stat -c%s "$f") ))
|
||||
done
|
||||
MB=$(( TOTAL / 1048576 ))
|
||||
GROW=$(( (TOTAL - LAST_TOTAL) / 1024 ))
|
||||
|
||||
if [ "$TOTAL" -eq "$LAST_TOTAL" ]; then
|
||||
STALL=$(( STALL + 1 ))
|
||||
else
|
||||
STALL=0
|
||||
fi
|
||||
LAST_TOTAL=$TOTAL
|
||||
|
||||
say "ffmpeg=$N total=${MB}MB grew=${GROW}KB stalled_ticks=$STALL"
|
||||
|
||||
if [ "$N" -eq 0 ]; then
|
||||
say "ALL DOWNLOADERS EXITED -- stream ended and ffmpeg finished on its own"
|
||||
break
|
||||
fi
|
||||
if [ "$STALL" -ge 10 ]; then
|
||||
say "STALLED: files not growing for ~5min but ffmpeg still alive"
|
||||
say " -> it does NOT self-terminate cleanly; unattended runs need a hard cap"
|
||||
break
|
||||
fi
|
||||
sleep 30
|
||||
done
|
||||
|
||||
say "final state:"
|
||||
for f in recordings/*; do
|
||||
[ -f "$f" ] || continue
|
||||
D=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$f" 2>/dev/null)
|
||||
say " $(basename "$f") $(( $(stat -c%s "$f") / 1048576 ))MB duration=${D:-unknown}s"
|
||||
done
|
||||
say "endwatch done"
|
||||
Reference in New Issue
Block a user