Add stream scripts

master
Thomas Lynch 2 years ago
parent 391c8deedc
commit d78d04dcf7
  1. 17
      anime.sh
  2. 21
      music.sh

@ -0,0 +1,17 @@
STREAM_NAME=""
STREAM_KEY=""
while true;
do
rm ~/anime/list.*
for f in ~/anime/*.mp4 ; do
echo file "$f" >> ~/anime/list.txt;
#echo file "$f" >> ~/anime/list.tmp;
done
#shuf ~/anime/list.tmp > ~/anime/list.txt
ffmpeg \
-re -f concat -safe 0 -i ~/anime/list.txt \
-c:a copy -c:v copy \
-f flv "rtmp://stream.loki/live/${STREAM_NAME}?key=${STREAM_KEY}"
sleep 15
done

@ -0,0 +1,21 @@
STREAM_NAME=""
STREAM_KEY=""
while true;
do
rm ~/music/list.*
for f in ~/music/*.opus ; do
echo file "$f" >> ~/music/list.tmp;
done
shuf ~/music/list.tmp > ~/music/list.txt
#NOTE: creates 2x2 dummy video stream to make nginx happy, or else it will not show in the stream list.
#NOTE: timeout kills after 12 hours, because nginx is shite. it will loop, shuffle and run again.
timeout --foreground --kill-after=10 43200 ffmpeg \
-re -f lavfi -i "color=size=2x2:rate=1:color=black" \
-re -f concat -safe 0 -thread_queue_size 512 -i ~/music/list.txt \
-map 0:v:0 -map 1:a:0 \
-c:v libx264 -pix_fmt yuv420p -preset superfast -r 2 -g 2 -b:v 1k \
-c:a aac -b:a 128k -bufsize 512k \
-f flv "rtmp://stream.loki/live/${STREAM_NAME}?key=${STREAM_KEY}"
sleep 15
done
Loading…
Cancel
Save