playlist_stream.sh 372 B

1234567891011121314
  1. #!/bin/sh -e
  2. PLAYLIST="$1" # Playlist directory
  3. SERVER="$2" # Target RTMP server
  4. while true; do
  5. for i in $PLAYLIST/*.{mp4,mkv}; do
  6. BASENAME="${i%.*}"
  7. ffmpeg -i "$i" \
  8. -c:v mpeg2video -b:v 9000k -f mpegts -
  9. #-vf "ass=$BASENAME.enUS.ass"\
  10. done
  11. done | mbuffer -q -m 100M | ffmpeg -re -i pipe:0 -f flv -b:v 9000k "$SERVER"