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 ]]
|
||||
then
|
||||
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]}' failed to send"
|
||||
Log "-- Start encoding on $start, finished on $finish"
|
||||
Log "== Mail with subject '${sbj[$1]}' sent to $to" ||
|
||||
Log "== Mail with subject '${sbj[$1]}' failed to send"
|
||||
Log "Start encoding on $start, finished on $finish"
|
||||
else
|
||||
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"
|
||||
Log "== Mail with subject '${sbj[$1]}' could not be sent"
|
||||
(($1==2)) && Log "Start encoding on $start, error on $finish"
|
||||
fi
|
||||
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" ||
|
||||
# Double pass
|
||||
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 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 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 -n 20 >"$file.2log" ||
|
||||
error=1
|
||||
|
||||
# Remove logfiles
|
||||
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
|
||||
|
||||
# Schedule cron job
|
||||
m=${date:13:2} m=${m#0} h=${date:11:2} h=${h#0}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
//set_time_limit(0);
|
||||
$headers=getallheaders();
|
||||
$authuser=$headers['X-User'];
|
||||
if($_SERVER['REQUEST_METHOD']!=='POST'){
|
||||
header('Location: /');
|
||||
}
|
||||
@ -36,6 +37,7 @@ print('<!DOCTYPE html>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<div class="container">
|
||||
<h1>Encoding</h1>
|
||||
'.($authuser=="" ? "" : 'For: '.$authuser.'<br> <br>').'
|
||||
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){
|
||||
Back('Date/time somehow incorrect: '.$datetime);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user