diff --git a/cron.php b/cron.php index 429f6f1..3128921 100755 --- a/cron.php +++ b/cron.php @@ -3,9 +3,14 @@ ini_set('include_path',"/home/tuve/include/"); include("site.inc"); include_once('FLV/FLV.php'); + + if (file_exists("/tmp/cron.php.lock")) + exit(0); + + system("/usr/bin/touch /tmp/cron.php.lock"); - $query = "SELECT vid,file,length,width,height,thumb,thumbFrame,mType FROM videos ORDER BY vid"; + $query = "SELECT vid,file,length,width,height,thumb,thumbFrame,mType,status FROM videos WHERE status != 6 ORDER BY vid"; $result = mysql_query($query); for ($i=0;$i diff --git a/cron2.php b/cron2.php index c7663d3..349e6a3 100644 --- a/cron2.php +++ b/cron2.php @@ -87,12 +87,16 @@ $nW = 400; } - $encode = "/usr/local/bin/ffmpeg -i \"/usr/web/uploads/$file\" -an $pad_str -deinterlace -g 250 -qcomp 0.6 -qblur 0.9 -qdiff 4 -i_qfactor 0.71 -bt 200k -b 360k -r 25 -f flv -s " . $nW . "x" . $nH . " -pass 1 -passlogfile /tmp/pass_monkey -y \"/media/tmp/$file.flv\""; +#old -g 250 -i_qfactor 0.71 -gblur 0.9 +#$vidParams "-deinterlace -g 250 -qcomp 0.6 -qdiff 4 -i_qfactor 0.71428572 -b_qfactor 0.76923078 -bt 200k -b 360k -r 25"; +$vidParams = "-deinterlace -g 250 -qcomp 0.6 -qdiff 4 -i_qfactor 0.71 -umv -aic -sc_threshold 10000 -bt 200k -b 360k -r 25"; + + $encode = "/usr/local/bin/ffmpeg -i \"/usr/web/uploads/$file\" -an $pad_str $vidParams -f flv -s " . $nW . "x" . $nH . " -pass 1 -passlogfile /tmp/pass_monkey -y \"/media/tmp/$file.flv\""; print("[$encode]"); $res = system($encode,&$retVal); if ($retVal == 1) doExit($encode,$vid); - $encode = "/usr/local/bin/ffmpeg -i \"/usr/web/uploads/$file\" -ar 44100 -ac 2 -ab 128k $pad_str -deinterlace -g 250 -qcomp 0.6 -qblur 0.9 -qdiff 4 -i_qfactor 0.71 -bt 200k -b 360k -r 25 -f flv -s " . $nW . "x" . $nH . " -pass 2 -passlogfile /tmp/pass_monkey -y \"/media/tmp/$file.flv\""; + $encode = "/usr/local/bin/ffmpeg -i \"/usr/web/uploads/$file\" -ar 44100 -ac 2 -ab 128k $pad_str $vidParams -f flv -s " . $nW . "x" . $nH . " -pass 2 -passlogfile /tmp/pass_monkey -y \"/media/tmp/$file.flv\""; print("[$encode]"); $res = system($encode,&$retVal); if ($retVal == 1) @@ -105,13 +109,15 @@ /* Move The File To The Mirrors */ system("/usr/bin/scp \"/media/streams/$file.flv\" www@utopia.ubixonline.com:."); + system("/usr/bin/scp \"/media/streams/$file.flv\" tuploads@tuve.ubixonline.com:."); /* Update The videos_pending Table */ $query = "UPDATE videos_pending SET encoded = 1 WHERE vid = $vid"; mysql_query($query); /* Insert The Video Into The System */ - $query = "INSERT INTO videos (artist,title,genre,file,rating,classification,oid,mType,length,width,height) VALUES(\"$artist\",\"$title\",\"$genre\",\"$file.flv\",$rid,$cid,$oid,$mType,$oLen,400,300)"; + $uDate = time(); + $query = "INSERT INTO videos (artist,title,genre,file,rating,classification,oid,mType,length,width,height,added) VALUES(\"$artist\",\"$title\",\"$genre\",\"$file.flv\",$rid,$cid,$oid,$mType,$oLen,400,300,$uDate)"; print "[$query]"; $res = mysql_query($query); if (!$res) {