mirror of https://gitgud.io/fatchan/stream.git
parent
562aec2a05
commit
8bf857fc5b
4 changed files with 72 additions and 10 deletions
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,17 @@ |
||||
#!/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/posters/$streamer.jpg" < /dev/null; |
||||
done <<< "$all_live" |
||||
|
||||
# delete old posters |
||||
bash -c 'find /var/www/stream/posters/* -mmin +2 -exec rm {} \;' |
Loading…
Reference in new issue