Mosaic is a simple script to create channel screenshots with ffmpeg and set them on Astra Dashboard using Astra API.
Channel Screenshots helps to visually evaluate quality of the channels.
Install FFmpeg with system packet manager:
apt install ffmpeg
On you server create new directory to store screenshot images:
mkdir -p /var/lib/astra/mosaic
Then open Astra Web interface -> Settings -> HTTP Play:
Turn on HTTP Play if disabled and set path to the screenshots directory. Done, HTTP Play now configured and you may save changes.
Also in the HTTP Play settings you may copy link to the playlist.m3u8
, this file contains links to all enabled channel. Link to playlist lookls like: https://example.com:8000/playlist.m3u8
If you use HTTP Authorization, set Token for administrator. Open Astra Web Interface -> Settings -> Users -> select administrator, and set any Token, for example: c6017ac9
. Append this token to the playlist URL: https://example.com:8000/playlist.m3u8?token=c6017ac9
Download script and save it on your server:
curl -Lo /usr/local/bin/mosaic.sh https://cdn.cesbo.com/astra/scripts/mosaic/mosaic.sh
chmod +x /usr/local/bin/mosaic.sh
Open script with any text editor and modify following variables:
THREADS
- number of threads to concurrently capture multiple screenshots. Fewer threads will take more time to update all images, while more threads will increase CPU usage. You may set as many threads as you have CPU coresPLAYLIST_URL
- URL to playlist.m3u8
file from previous stepSCREENSHOT_PATH
- path to store screenshots on your server: /var/lib/astra/mosaic/
API_PORT
- port to Astra APIAPI_AUTH
- admin login and password to access Astra APITo start script automatically you may append it to the systemd. Download configuration file for systemd and save it on your server:
curl -Lo /etc/systemd/system/mosaic.service https://cdn.cesbo.com/astra/scripts/mosaic/mosaic.service
Next commands could be used to manage script:
systemctl start mosaic
systemctl stop mosaic
systemctl enable mosaic
systemctl disable mosaic
After the start check that new png files are creating in the screenshots directory:
ls /var/lib/astra/mosaic