Remove files after successul encoding & streaming
This commit is contained in:
parent
ccf1d7aee0
commit
df64174631
@ -1,8 +1,8 @@
|
||||
# Build image:
|
||||
# docker build -t streamupload .
|
||||
# Run container, one of:
|
||||
# docker run -d --name stream -p 8080:80 -v uploadpage:/var/www/uploadpage streamupload
|
||||
# docker run -d --name stream -p 443:443 -v uploadpage:/var/www/uploadpage streamupload
|
||||
# docker run -d --name stream -p 8080:80 -v $PWD/uploadpage:/var/www/uploadpage streamupload
|
||||
# docker run -d --name stream -p 443:443 -v $PWD/uploadpage:/var/www/uploadpage streamupload
|
||||
# Access shell in container:
|
||||
# docker exec -ti stream /bin/bash
|
||||
# Destroy container and image:
|
||||
|
||||
5
encode
5
encode
@ -69,8 +69,9 @@ ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -maxrate 6M -buf
|
||||
rm "$file"-*
|
||||
finish=$(date +'%Y-%m-%d at %H:%M:%S')
|
||||
((error)) && Mail 2 "Error encoding $name"
|
||||
# Remove tailfiles if no errors
|
||||
rm "$file".?log
|
||||
|
||||
# Remove tailfiles and upload if no errors
|
||||
rm -- "$file".?log "$file"
|
||||
|
||||
# Schedule cron job
|
||||
m=${date:13:2} m=${m#0} h=${date:11:2} h=${h#0}
|
||||
|
||||
6
stream
6
stream
@ -19,6 +19,6 @@ RestreamSG) rtmp=rtmp://singapore.restream.io/live/$key ;;
|
||||
esac
|
||||
|
||||
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" &&
|
||||
echo "Error while streaming $1" >>"$log" ||
|
||||
rm "$in.log" # Remove tailfile if no errors
|
||||
ffmpeg -re -y -i "$in" -c:v copy -c:a copy -f flv "$rtmp" |tail -n 20 >"$in.log" &&
|
||||
rm "$in.log" "$in" ||
|
||||
echo "Error while streaming $1" >>"$log"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user