This commit is contained in:
root committed 2022-10-11 07:44:28 +07:00
1 parent ab642d9c51
commit 9abad2f998
13 files changed
+57 -41

No files matched your search

+3 -3
View File
@@ -2,7 +2,7 @@
# stream - Stream video when called from crontab
# Usage: stream <tag>
# The tag refers to video files in ./uploadpage/streams without the
# The tag refers to video files in ./web/streams without the
# '.mp4', that should have been re-encoded by `encode`. The tag has no path
# information, has the "streamkey" at the start before the first dot (there
# has to be a dot!) and the "target" at the very end, after the last '@'.
@@ -11,7 +11,7 @@
_=$(readlink -f -- "${BASH_SOURCE:-$0}") repopath=${_%/*}
log=$repopath/process.log
in=$repopath/uploadpage/streams/$1.mp4 key=${1%%.*} target=${1##*@}
in=$repopath/web/streams/$1.mp4 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 ;;
@@ -25,7 +25,7 @@ set -o pipefail # to get ffmpeg's returncode
if ffmpeg -re -y -i "$in" -c:v copy -c:a copy -f flv "$rtmp" 2>&1 |tail -n 20 >"$in.log"
then
rm "$in.log" "${in%.mp4}"
[[ $savedir && -f $savedir ]] && mv "$in" "$savedir" || rm "$in"
[[ $savedir && -d $savedir ]] && mv "$in" "$savedir" || rm "$in"
else
echo "Error while streaming $1" >>"$log"
fi