Clearer logs
This commit is contained in:
parent
127daec5a6
commit
4d98850643
17
encode
17
encode
@ -31,13 +31,12 @@ Mail(){ # 1:kind(0:done, 1:wrong type, 2:encoding error) 2:logline I:repopath,em
|
|||||||
if [[ $to && $user && $password && $smtp && $port ]]
|
if [[ $to && $user && $password && $smtp && $port ]]
|
||||||
then
|
then
|
||||||
mailer -m "$(echo -e "${msg[$1]}")" -t "$to" -s "${sbj[$1]}" -u "$user" -p "$password" -S "$smtp" -P "$port" -f "$from" &&
|
mailer -m "$(echo -e "${msg[$1]}")" -t "$to" -s "${sbj[$1]}" -u "$user" -p "$password" -S "$smtp" -P "$port" -f "$from" &&
|
||||||
Log "Mail with subject '${sbj[$1]}' sent to $to" ||
|
Log "== Mail with subject '${sbj[$1]}' sent to $to" ||
|
||||||
Log "Mail with subject '${sbj[$1]}' failed to send"
|
Log "== Mail with subject '${sbj[$1]}' failed to send"
|
||||||
Log "-- Start encoding on $start, finished on $finish"
|
Log "Start encoding on $start, finished on $finish"
|
||||||
else
|
else
|
||||||
Log "Mail with subject '${sbj[$1]}' could not be sent"
|
Log "== Mail with subject '${sbj[$1]}' could not be sent"
|
||||||
(($1==1)) && Log "-- File of type $type"
|
(($1==2)) && Log "Start encoding on $start, error on $finish"
|
||||||
(($1==2)) && Log "-- Start encoding on $start, error on $finish"
|
|
||||||
fi
|
fi
|
||||||
Log "$2" $1
|
Log "$2" $1
|
||||||
}
|
}
|
||||||
@ -56,14 +55,16 @@ start=$(date +'%Y-%m-%d at %H:%M:%S') error=0
|
|||||||
#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" ||
|
#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
|
||||||
set -o pipefail # to get ffmpeg's returncode
|
set -o pipefail # to get ffmpeg's returncode
|
||||||
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 -passlogfile "$file" -f mp4 "$video" 2>&1 |tail >"$file.1log" &&
|
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 -passlogfile "$file" -f mp4 "$video" 2>&1 |tail -n 20 >"$file.1log" &&
|
||||||
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 -passlogfile "$file" -f mp4 "$video" 2>&1 |tail >"$file.2log" ||
|
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 -passlogfile "$file" -f mp4 "$video" 2>&1 |tail -n 20 >"$file.2log" ||
|
||||||
error=1
|
error=1
|
||||||
|
|
||||||
# Remove logfiles
|
# Remove logfiles
|
||||||
rm "$file-*"
|
rm "$file-*"
|
||||||
finish=$(date +'%Y-%m-%d at %H:%M:%S')
|
finish=$(date +'%Y-%m-%d at %H:%M:%S')
|
||||||
((error)) && Mail 2 "Error encoding $name"
|
((error)) && Mail 2 "Error encoding $name"
|
||||||
|
# Remove tailfiles if no errors
|
||||||
|
rm "$file".?log
|
||||||
|
|
||||||
# Schedule cron job
|
# Schedule cron job
|
||||||
m=${date:13:2} m=${m#0} h=${date:11:2} h=${h#0}
|
m=${date:13:2} m=${m#0} h=${date:11:2} h=${h#0}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
//set_time_limit(0);
|
$headers=getallheaders();
|
||||||
|
$authuser=$headers['X-User'];
|
||||||
if($_SERVER['REQUEST_METHOD']!=='POST'){
|
if($_SERVER['REQUEST_METHOD']!=='POST'){
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
}
|
}
|
||||||
@ -36,6 +37,7 @@ print('<!DOCTYPE html>
|
|||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Encoding</h1>
|
<h1>Encoding</h1>
|
||||||
|
'.($authuser=="" ? "" : 'For: '.$authuser.'<br> <br>').'
|
||||||
File: '.$upload);
|
File: '.$upload);
|
||||||
if(preg_match('/20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]/', $datetime)===false){
|
if(preg_match('/20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]/', $datetime)===false){
|
||||||
Back('Date/time somehow incorrect: '.$datetime);
|
Back('Date/time somehow incorrect: '.$datetime);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user