Fix bufsize
Enhance readme
This commit is contained in:
parent
00cffa7b06
commit
040f6caab3
@ -4,7 +4,10 @@
|
|||||||
## Install
|
## Install
|
||||||
* Prepare a Linux server, set its timezone to the users' timezone
|
* Prepare a Linux server, set its timezone to the users' timezone
|
||||||
(on deb-based systems: `dpkg-reconfigure tzdata`).
|
(on deb-based systems: `dpkg-reconfigure tzdata`).
|
||||||
* On the server, `cd` to the place where you want the files.
|
* On the server, `cd` to the place where you want the files (make sure that
|
||||||
|
the webserver user (often `www-data`) has access to the location!).
|
||||||
|
* Make sure the packages `git php-fpm ffmpeg` are installed (on deb-based
|
||||||
|
systems: `apt install git php-fpm ffmpeg`).
|
||||||
* Clone repo: `git clone https://gitlab.com/pepa65/streamupload`.
|
* Clone repo: `git clone https://gitlab.com/pepa65/streamupload`.
|
||||||
* `cd streamupload`. Now the output of `pwd` is the value for `$repopath`.
|
* `cd streamupload`. Now the output of `pwd` is the value for `$repopath`.
|
||||||
* Copy `_mailvars` to `mailvars` and set the variables
|
* Copy `_mailvars` to `mailvars` and set the variables
|
||||||
|
|||||||
10
encode
10
encode
@ -37,7 +37,7 @@ Mail(){ # 1:kind(0:done, 1:wrong type, 2:encoding error) 2:logline I:email,name,
|
|||||||
# Rename upload and check type
|
# Rename upload and check type
|
||||||
file=${upload%.upload} video=$file.mp4 name=${file##*/} key=${name%%.*}
|
file=${upload%.upload} video=$file.mp4 name=${file##*/} key=${name%%.*}
|
||||||
rest=${name#*.} date=${rest:0:15} _=${rest:15} email=${_%@*}
|
rest=${name#*.} date=${rest:0:15} _=${rest:15} email=${_%@*}
|
||||||
# If email embedded, strip the '='
|
# If email embedded, strip the '_'
|
||||||
[[ $email ]] && email=${email:1}
|
[[ $email ]] && email=${email:1}
|
||||||
/usr/bin/mv "$upload" "$file"
|
/usr/bin/mv "$upload" "$file"
|
||||||
|
|
||||||
@ -45,15 +45,15 @@ type=$(file -bL --mime-type "$file")
|
|||||||
[[ ! ${type:0:5} = video ]] && Mail 1 "File $name is of type $type"
|
[[ ! ${type:0:5} = video ]] && Mail 1 "File $name is of type $type"
|
||||||
|
|
||||||
# Encode video
|
# Encode video
|
||||||
start=$(date +'%Y-%m-%d at %H:%M') error=0
|
start=$(date +'%Y-%m-%d at %H:%M:%S') error=0
|
||||||
## Single pass
|
## Single pass
|
||||||
#/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -force_key_frames 'expr:gte(t,n_forced*2)' -c:a copy -tune zerolatency -f mp4 "$video" ||
|
#/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -force_key_frames 'expr:gte(t,n_forced*2)' -c:a copy -tune zerolatency -f mp4 "$video" ||
|
||||||
# Double pass
|
# Double pass
|
||||||
/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -maxrate 6M -bufsize 1M -force_key_frames 'expr:gte(t,n_forced*2)' -movflags faststart -c:a copy -tune zerolatency -pass 1 -f mp4 "$video" &&
|
/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -maxrate 6M -bufsize 12M -force_key_frames 'expr:gte(t,n_forced*2)' -movflags faststart -c:a copy -tune zerolatency -pass 1 -f mp4 "$video" &&
|
||||||
/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -maxrate 6M -bufsize 1M -force_key_frames 'expr:gte(t,n_forced*2)' -movflags faststart -c:a copy -tune zerolatency -pass 2 -f mp4 "$video" ||
|
/usr/bin/ffmpeg -y -i "$file" -c:v libx264 -x264opts no-scenecut -b:v 6M -maxrate 6M -bufsize 12M -force_key_frames 'expr:gte(t,n_forced*2)' -movflags faststart -c:a copy -tune zerolatency -pass 2 -f mp4 "$video" ||
|
||||||
error=1
|
error=1
|
||||||
|
|
||||||
finish=$(date +'%Y-%m-%d at %H:%M')
|
finish=$(date +'%Y-%m-%d at %H:%M:%S')
|
||||||
((error)) && Mail 2 "Error encoding $name"
|
((error)) && Mail 2 "Error encoding $name"
|
||||||
|
|
||||||
# Schedule cron job
|
# Schedule cron job
|
||||||
|
|||||||
0
uploadpage/streams/.gitkeep
Normal file
0
uploadpage/streams/.gitkeep
Normal file
@ -19,7 +19,7 @@ $key=$_POST['streamkey'];
|
|||||||
$datetime=$_POST['datetime'];
|
$datetime=$_POST['datetime'];
|
||||||
$email=$_POST['email'];
|
$email=$_POST['email'];
|
||||||
if($email){
|
if($email){
|
||||||
$email='='.$email;
|
$email='_'.$email;
|
||||||
}
|
}
|
||||||
$date=substr($datetime, 0, 10);
|
$date=substr($datetime, 0, 10);
|
||||||
$hour=substr($datetime, 11, 2);
|
$hour=substr($datetime, 11, 2);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user