Anyone here who know if there is a function in PHP that will give you the width and hight, and possiby other information from a video file (.mov, .avi. wmv).
I love the [php_man]getimagesize()[/php_man] function, and i've added a function that gives me width and height from .swf files (flash). But i realy need one for videofiles as well.
Can anyone help me?
-----
Best Regards,
Jon Arne
Width And Height from video files
Moderator: General Moderators
For those of you trying to derive the dimensions of a video file (e.g. Video for Windows AVI, Quicktime MOV, MPEG MPG, Windows Media Video WMV or ASF, etc.), you will find the getid3 library to be indispensible. Found at http://getid3.sourceforge.net, here's an example of its use in a script:
You can then use your OBJECT and EMBED tags in HTML to put the video into a web page, and make the PHP template independent of the size parameters of the particular video it happens to be loading. (Just remember to add pixels to the video height to accomodate the controller of the embedded player: typically, 16 pixels for Quicktime, 46 pixels for Windows Media Player 6, and 64 pixels for Windows Media Player 7.
Code: Select all
include_once('getid3.php'); // or wherever you actually put the getid3 scripts
$file_location = './myvideo.avi';
$file_info = GetAllFileInfo($file_location) // calls getid3 function
$file_width = $file_info['video']['resolution_x'];
$file_height = $file_info['video']['resolution_y'];