Remove upload and encoding after successful streaming

This commit is contained in:
gitlab.com/pepa65 2022-09-08 22:58:01 +07:00
parent df64174631
commit ab0e2818c0
2 changed files with 4 additions and 3 deletions

4
encode
View File

@ -70,8 +70,8 @@ rm "$file"-*
finish=$(date +'%Y-%m-%d at %H:%M:%S')
((error)) && Mail 2 "Error encoding $name"
# Remove tailfiles and upload if no errors
rm -- "$file".?log "$file"
# Remove tailfiles if no errors
rm -- "$file".?log
# Schedule cron job
m=${date:13:2} m=${m#0} h=${date:11:2} h=${h#0}

3
stream
View File

@ -18,7 +18,8 @@ RestreamSG) rtmp=rtmp://singapore.restream.io/live/$key ;;
*) rtmp=rtmp://live.restream.io/live/$key
esac
# Stream, log it, and remove all files if successful
set -o pipefail # to get ffmpeg's returncode
ffmpeg -re -y -i "$in" -c:v copy -c:a copy -f flv "$rtmp" |tail -n 20 >"$in.log" &&
rm "$in.log" "$in" ||
rm "$in.log" "$in" "${in%.mp4}" ||
echo "Error while streaming $1" >>"$log"