2012-12-16 53 views
0

我需要对.mp4文件运行检查,以检查它们是否具有h.264编解码器来创建php条件或至少仅打印编解码器。有一些相当简单的代码将运行在HTML文件中吗?用于确定mpeg-4文件编解码器的php代码

+0

html是标记语言。它完全绝对地**无任何接近你想要的东西的方式。 –

回答

2

使用:

这是他们的榜样测试文件:

include "MP4Info.php"; 

print '<h1>MP4Info test script</h1>'; 
print '<p><small>'.__FILE__.' $Id: test.php 2 2009-06-11 14:12:31Z [email protected] $</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.'".'; 
} 

它支持查不到,如果视频具有H.264编码。

+0

谢谢,这很棒 – user1557515

+0

@ user1557515,这是否回答你的问题? –