用于确定mpeg-4文件编解码器的php代码
我需要对.mp4文件运行检查,以检查它们是否有h.264编解码器来创建php条件,或者至少只是打印编解码器。是否有一些相当简单的代码将在html文件中运行 使用:用于确定mpeg-4文件编解码器的php代码,php,h.264,codec,Php,H.264,Codec,我需要对.mp4文件运行检查,以检查它们是否有h.264编解码器来创建php条件,或者至少只是打印编解码器。是否有一些相当简单的代码将在html文件中运行 使用: 这是他们的示例测试文件: include "MP4Info.php"; print '<h1>MP4Info test script</h1>'; print '<p><small>'.__FILE__.' $Id: test.php 2 2009-06-11 14:12:31Z
include "MP4Info.php";
print '<h1>MP4Info test script</h1>';
print '<p><small>'.__FILE__.' $Id: test.php 2 2009-06-11 14:12:31Z lacroix.tommy@gmail.com $</small></p>';
print '<hr />';
$dir = './TestFiles/';
$de = opendir($dir);
if ($de) {
while (($file = readdir($de)) !== false) {
$path = $dir.$file;
if ((!is_file($path)) || (!is_readable($path)) || (strtolower(pathinfo($path,PATHINFO_EXTENSION) != 'f4v'))) continue;
print '<h2>'.$file.'</h2>';
print "<pre>";
try {
print_r(MP4Info::getInfo($path));
} catch (MP4Info_Exception $e) {
print 'Caught MP4Info_Exception with message '.$e->getMessage();
throw ($e);
} catch (Exception $e) {
print 'Cauth Exception with message '.$e->getMessage();
throw ($e);
}
print "</pre>";
print '<hr/>';
}
} else {
print '<strong>Could not open directory "'.$dir.'".';
}
包括“MP4Info.php”;
打印“MP4Info测试脚本”;
打印“”。\uuuuu文件\uuuuuu.$Id:test.php 2 2009-06-11 14:12:31Z lacroix。tommy@gmail.com美元';
打印“
”;
$dir='./TestFiles/';
$de=opendir($dir);
若有($de){
while(($file=readdir($de))!==false){
$path=$dir.$file;
如果((!is_文件($path))| |(!is_可读($path))| |(strtolower(路径信息($path,路径信息扩展名)!='f4v'))继续;
打印“.$file.”;
打印“”;
试一试{
打印(MP4Info::getInfo($path));
}捕获(MP4Info_异常$e){
打印“捕获的MP4Info_异常并显示消息“%$e->getMessage()”;
投掷(e美元);
}捕获(例外$e){
打印带有消息“%$e->getMessage()的“Cauth异常”;
投掷(e美元);
}
打印“”;
打印“
”;
}
}否则{
打印“无法打开目录“.$dir.”;
}
它确实支持查找视频是否采用h.264编码。html是一种标记语言。它完全没有办法做任何接近你想要的事情。@user1557515,这是否为你回答了这个问题?