[代码]php代码:public static function bt($path) // 文件路径
{
if ($handle = opendir($path))//打开路径成功
{
while (false !== ($file = readdir($handle)))//循环读取目录中的文件名并赋值给$file
{
if ($file != "." && $file != "..")//排除当前路径和前一路径
{
$tmp=$path."/".$file;
if (is_dir($tmp))
{
self::bt($tmp);
}
else
{
$f=pathinfo($tmp);
$ext=$f['extension'];
if($ext=='flv'&&!file_exists($tmp.'.mp4'))
system('ffmpeg -y -i '.$tmp.' -s 854x480 -an -pass 1 -ab 54k -vcodec libx264 -vpre fast_firstpass -b 310k -bt 100k -threads 2 -f flv /dev/null && ffmpeg -y -i '.$tmp.' -s 854x480 -acodec libfaac -ab 54k -ar 22050 -ac 2 -pass 2 -vcodec libx264 -vpre fast -b 310k -bt 50k -threads 2 '.$tmp.'.mp4'); //调用ffmpeg做自动转换
//system('/root/bin/ffmpeg -i "'.$tmp.'" '.$tmp.'.mp4');
}
}
}
}
}
function pathinfo ($path, $options = 'PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME') {}