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.
17 lines
609 B
17 lines
609 B
#!/bin/bash
|
|
# create "poster" files for an image preview if livestream before the user clicks play
|
|
|
|
# get all live streams
|
|
all_live=`ls /tmp/hls/*.m3u8 | cut -d/ -f4 | cut -d. -f1 | uniq`
|
|
|
|
# for each streamer, make a poster of their latest video chunk
|
|
while read -r streamer
|
|
do
|
|
tsfile=`bash -c "ls -t /tmp/hls/$streamer-*.ts" | head -n1`
|
|
ffmpeg -hide_banner -loglevel error -y \
|
|
-ss 00:00:00.00 -i "$tsfile" \
|
|
-frames:v 1 "/var/www/stream/public/posters/$streamer.jpg" < /dev/null;
|
|
done <<< "$all_live"
|
|
|
|
# delete old posters
|
|
bash -c 'find /var/www/stream/public/posters/*.jpg -mmin +2 -exec rm {} \;'
|
|
|