PHP Class – getID3
Today I was working on a media managent CMS tool and needed the ability to know what size ( screen resolution ) a video is, similar but different to using getimagesize() for an image. I came across an article on php.net and a class project on soureforge that offers a wealth of info on media files of all types. I thought I would share what I found, getID3() is a PHP script that extracts useful information (such as ID3 tags, bitrate, playtime, etc.) from MP3s & other multimedia file formats (Ogg, WMA, WMV, ASF, WAV, AVI, AAC, VQF, FLAC, MusePack, Real, QuickTime, Monkey’s Audio, MIDI and more).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php // include getID3() library (can be in a different directory if full path is specified) include_once('getid3.php'); // Initialize getID3 engine $getID3 = new getID3; // File to get info from $file_location = './your/path/to/file.mov'; // Get information from the file $fileinfo = $getID3->analyze($file_location); getid3_lib::CopyTagsToComments($fileinfo); // Output results if (!empty($fileinfo['video']['resolution_x'])) { echo '<p> video width: '.$fileinfo['video']['resolution_x'].'</p>'; } if (!empty($fileinfo['video']['resolution_y'])) { echo '<p> video height: '.$fileinfo['video']['resolution_y'].'</p>'; } ?> |
The package referenced (http://www.getid3.org/)