2012-12-16 56 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,這是否回答你的問題? –