0

我需要对 .mp4 文件进行检查,以检查它们是否有 h.264 编解码器来创建 php 条件,或者至少只是打印编解码器。是否有一些相当简单的代码可以在 html 文件中运行?

4

1 回答 1

2

使用:

这是他们的示例测试文件:

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.'".';
}

它确实支持找出视频是否具有 h.264 编码。

于 2012-12-16T05:40:17.727 回答