mirror of https://gitgud.io/fatchan/stream.git
The source behind http://stream.loki - minimal nginx configuration and backend code for a streaming site with streams index, thumbnails, viewcount, chat, and streamkeys.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
796 B
21 lines
796 B
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
|
|
|