PHP 的模組,可以取得 mp3 或其它多媒體檔案的格式,如影片長度、格式對、標題、作者..等
官網:http://www.getid3.org/
DEMO:http://www.getid3.org/demo/
** 2013-11 到目前為止 v1.9.7 都無法取得影片拍攝角度rotation 資訊,要用另一套 ExifTool
用法大致:
<? $videofile='123.flv'; require_once("getid3/getid3.php"); $getID3 = new getID3; $fileData = $getID3->analyze($videofile); var_dump($fileData); ?>
結果:
array(17) {
["GETID3_VERSION"]=>
string(14) "1.7.9-20090308"
["filesize"]=>
int(8975327)
["avdataoffset"]=>
int(0)
["avdataend"]=>
int(8975327)
["fileformat"]=>
string(3) "flv"
["audio"]=>
array(8) {
["dataformat"]=>
string(3) "flv"
["codec"]=>
string(3) "mp3"
["sample_rate"]=>
int(22050)
["bits_per_sample"]=>
int(8)
["channels"]=>
int(1)
["lossless"]=>
bool(false)
["channelmode"]=>
string(4) "mono"
["streams"]=>
array(1) {
[0]=>
array(7) {
["dataformat"]=>
string(3) "flv"
["codec"]=>
string(3) "mp3"
["sample_rate"]=>
int(22050)
["bits_per_sample"]=>
int(8)
["channels"]=>
int(1)
["lossless"]=>
bool(false)
["channelmode"]=>
string(4) "mono"
}
}
}
["video"]=>
array(6) {
["dataformat"]=>
string(3) "flv"
["frame_rate"]=>
float(29.97)
["resolution_x"]=>
int(320)
["resolution_y"]=>
int(180)
["codec"]=>
string(14) "Sorenson H.263"
["lossless"]=>
bool(false)
}
["encoding"]=>
string(10) "ISO-8859-1"
["filename"]=>
string(26) "123.flv"
["filepath"]=>
string(9) "/home/user"
["filenamepath"]=>
string(36) "123.flv"
["mime_type"]=>
string(11) "video/x-flv"
["flv"]=>
array(3) {
["header"]=>
array(5) {
["signature"]=>
string(3) "FLV"
["version"]=>
int(1)
["hasAudio"]=>
bool(true)
["hasVideo"]=>
bool(true)
["videoSizeType"]=>
int(1)
}
["audio"]=>
array(4) {
["audioFormat"]=>
int(2)
["audioRate"]=>
int(2)
["audioSampleSize"]=>
int(0)
["audioType"]=>
int(0)
}
["video"]=>
array(1) {
["videoCodec"]=>
int(2)
}
}
["meta"]=>
array(1) {
["onMetaData"]=>
array(12) {
["duration"]=>
float(195.762)
["width"]=>
float(320)
["height"]=>
float(180)
["videodatarate"]=>
float(292.96875)
["framerate"]=>
float(29.97)
["videocodecid"]=>
float(2)
["audiodatarate"]=>
float(54.6875)
["audiosamplerate"]=>
float(22050)
["audiosamplesize"]=>
float(16)
["stereo"]=>
bool(false)
["audiocodecid"]=>
float(2)
["filesize"]=>
float(8975327)
}
}
["playtime_seconds"]=>
float(195.736)
["bitrate"]=>
float(45854.247557935)
["playtime_string"]=>
string(4) "3:16"
}
辛苦你了~~覺得,工程師都好辛苦~~((煙!