#!/bin/sh
echo "🎬 Démarrage du stream HLS optimisé (segments 2s)..."

ffmpeg -re -stream_loop -1 -i /video.mp4 \
  -c:v libx264 -preset veryfast -b:v 1500k -maxrate 1500k -bufsize 3000k \
  -c:a aac -b:a 128k -ar 44100 \
  -force_key_frames "expr:gte(t,n_forced*2)" \
  -f hls -hls_time 2 -hls_list_size 5 \
  /usr/share/nginx/html/hls/stream.m3u8 &

echo "🌐 Nginx prêt sur le port 80"
exec nginx -g "daemon off;"
