diff --git a/cron2.php b/cron2.php index 3e6beb6..c7663d3 100644 --- a/cron2.php +++ b/cron2.php @@ -87,14 +87,18 @@ $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.log -y \"/media/tmp/$file.flv\""; + $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\""; print("[$encode]"); - $res = system($encode); - $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.log -y \"/media/tmp/$file.flv\""; + $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\""; print("[$encode]"); - $res = system($encode); + $res = system($encode,&$retVal); + if ($retVal == 1) + doExit($encode,$vid); print($res); - system("rm -fr /tmp/pass.monkey.*"); + system("rm -fr /tmp/pass_monkey*"); } system("/bin/mv \"/media/tmp/$file.flv\" \"/usr/local/apache-tomcat6.0/webapps/ROOT/streams/$file.flv\""); system("/usr/sbin/chown tuve:www \"/usr/local/apache-tomcat6.0/webapps/ROOT/streams/$file.flv\""); @@ -132,4 +136,12 @@ system("/bin/mv \"/usr/web/uploads/$file\" /media/encoded"); } system("/bin/rm /tmp/cron2.php.lock"); + +function doExit($errorStr,$vid_id) { + /* Update The videos_pending Table */ + $query = "UPDATE videos_pending SET encoded = 2 WHERE vid = $vid_id"; + mysql_query($query); + print("Error: $errorStr\n"); + exit(0); + } ?>