I can see where that would have disadvantages if the file does not
complete. It's definitely set up for infinite loopiness. :P
You could also plug in a timeout.
<?PHP
function getTime()
{
list($usec, $sec) = explode(" ", microtime());
return (((float)$usec + (float)$sec) * 10000);
}
$limit = 1000;
$otime = getTime();
echo "Starting script.";
exec(FFMPEG_BINARY.' -i '.$file, $output, $return);
while(!is_file($output))
{
$ntime = getTime();
if($ntime >= $otime + $limit)
{
$timeout = 1;
break;
}
}
echo "Finished script.";
?>