我试图在用PHP上传之前检测任何视频文件的持续时间,
所以如果它不到一分钟,例如我将拒绝上传它.
如果不可能,我怎么能在上传视频后呢?
Bab*_*aba 14
你可以video duration使用ffmpeg 或getID3
例
$getID3 = new getID3;
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");
Run Code Online (Sandbox Code Playgroud)
要么
ob_start();
passthru("ffmpeg -i working_copy.flv 2>&1");
$duration = ob_get_contents();
$full = ob_get_contents();
ob_end_clean();
$search = "/duration.*?([0-9]{1,})/";
print_r($duration);
$duration = preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3);
print_r('<pre>');
print_r($matches[1][0]);
print_r($full);
Run Code Online (Sandbox Code Playgroud)
请参阅
http://getid3.sourceforge.net/
谢谢
:d