20 lines
673 B
Bash
Executable File
20 lines
673 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# stream - Stream video when called from crontab
|
|
# Usage: stream <video>
|
|
# The video should have been re-encoded by `encode` first,
|
|
# and have the streamkey at the start of the filename.
|
|
|
|
repopath=/var/www
|
|
log=$repopath/process.log
|
|
in=$repopath/uploadpage/streams/$1 key=${1%%.*} target=${1##*@}
|
|
case $target in
|
|
Facebook) rtmp=rtmps://live-api-s.facebook.com:443/rtmp/$key ;;
|
|
YouTube) rtmp=rtmp://a.rtmp.youtube.com/live2/$key ;;
|
|
RestreamSG) rtmp=rtmp://singapore.restream.io/live/$key ;;
|
|
*) rtmp=rtmp://live.restream.io/live/$key
|
|
esac
|
|
|
|
/usr/bin/ffmpeg -re -y -i $in -c:v copy -c:a copy -f flv "$rtmp" ||
|
|
echo "Error while streaming $1" >>"$log"
|