#!/bin/sh
# Generate offline slate MP4 for MediaMTX alwaysAvailable (pausa / attesa segnale)
set -e
OUT_DIR="$(dirname "$0")/../slates"
OUT="$OUT_DIR/offline.mp4"
mkdir -p "$OUT_DIR"
docker run --rm -v "$OUT_DIR:/out" linuxserver/ffmpeg:latest \
  -f lavfi -i color=c=0x1a1a1a:s=1280x720:r=30 \
  -vf "drawtext=text='Match Live TV':fontcolor=white:fontsize=48:x=(w-text_w)/2:y=(h-text_h)/2-40,drawtext=text='Trasmissione in pausa':fontcolor=0xaaaaaa:fontsize=28:x=(w-text_w)/2:y=(h-text_h)/2+20" \
  -f lavfi -i sine=frequency=440:sample_rate=48000 \
  -t 30 -c:v libx264 -pix_fmt yuv420p -g 30 -preset fast \
  -c:a aac -b:a 128k -y /out/offline.mp4
echo "Created $OUT"
