如何获取视频的持续时间,维度和大小在PHP? [英] How to get video duration, dimension and size in PHP?
问题描述
我想知道如何在PHP中获取上传的视频文件的持续时间,维度和大小。该文件可以是任何视频格式。
getID3支持视频格式。请参阅: http://getid3.sourceforge.net/
include_once('pathto / getid3.php' );
$ 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 />);
注意:你必须包含getID3类才能工作!请参阅上述链接。
编辑:如果您有能力修改服务器上的PHP安装,则为此目的的PHP扩展名为ffmpeg-php。请参阅: http://ffmpeg-php.sourceforge.net/
I want to know how to get the duration, dimension and size of uploaded video file in PHP. The file can be in any video format.
getID3 supports video formats. See: http://getid3.sourceforge.net/
Edit: So, in code format, that'd be like:
include_once('pathto/getid3.php');
$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 />");
Note: You must include the getID3 classes before this will work! See the above link.
Edit: If you have the ability to modify the PHP installation on your server, a PHP extension for this purpose is ffmpeg-php. See: http://ffmpeg-php.sourceforge.net/
这篇关于如何获取视频的持续时间,维度和大小在PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!