#!/bin/bash LOCK="/tmp/stream.lock" trap "rm -f $LOCK; exit" INT TERM EXIT if [ -f "$LOCK" ]; then echo "Still running, skipping" exit fi touch "$LOCK" ASSET_FILE="/root/assets.txt" ASSET_URL="https://bibletalk.tv/nebs/assets.txt" if [ ! -f "$ASSET_FILE" ] || [ $(find "$ASSET_FILE" -mmin +5) ]; then wget -q "$ASSET_URL" -O "$ASSET_FILE" fi # YouTube if ! pgrep -f "rtmp://a.rtmp.youtube.com/live2" > /dev/null; then ffmpeg -stream_loop -1 -re -f concat -safe 0 -nostdin -i "$ASSET_FILE" \ -map 0:v -map 0:a -c copy -f flv "rtmp://a.rtmp.youtube.com/live2/{YOUR_STREAM_KEY}" & fi # Twitch if ! pgrep -f "rtmp://jfk.contribute.live-video.net/app" > /dev/null; then ffmpeg -stream_loop -1 -re -f concat -safe 0 -nostdin -i "$ASSET_FILE" \ -map 0:v -map 0:a -c copy -f flv "rtmp://jfk.contribute.live-video.net/app/{YOUR_STREAM_KEY}" & fi