Files

27 lines
629 B
Bash
Executable File

#!/usr/bin/env bash
# Record an RTSP stream to a file so FCP and the recounter can analyse the
# same footage. The recounter is file-based by design.
#
# Usage: tools/record_rtsp.sh <rtsp-url> <out-file> [seconds]
set -euo pipefail
URL="${1:?rtsp url required}"
OUT="${2:?output file required}"
SECONDS_TO_RECORD="${3:-300}"
if ! command -v ffmpeg >/dev/null 2>&1; then
echo "ffmpeg not found in PATH" >&2
exit 1
fi
mkdir -p "$(dirname "$OUT")"
ffmpeg -hide_banner -loglevel warning \
-rtsp_transport tcp \
-i "$URL" \
-t "$SECONDS_TO_RECORD" \
-c copy \
-y "$OUT"
echo "Recorded $SECONDS_TO_RECORD s -> $OUT"