i want get audio info by remote files method,
however don't need to download audio file to my PC?
i'm using one simple class, to get mp3 bitrate , don't need download audio file, by remote files
Sorry Allan, but that would give 32MiB ;)Allan Hansen wrote:$fp = fopen('http://myserver/myfile.flac');
$first32kb = fread($fp, 32*1024*1024);
fclose($fp);
$fp = fopen('http://myserver/myfile.flac');
$first32kb = fread($fp, 32*1024);
fclose($fp);$remotefilename = 'mylink,example';
$fp = fopen($remotefilename,'rb');
if ($fp2 = fopen('boo', 'wb')) {
$first32kb = fread($fp, 32*1024);
fwrite($fp2,$first32kb);
}
fclose($fp);
$ThisFileInfo = $getID3->analyze('boo'); Filesize, obviously not. You can get the remote filesize with a function like this:rassen wrote:one more question, that's i can't get right playtime and filesize util download full file to my desktop :| ??!
function filesize_remote($remotefile, $timeout=10) {
$size = false;
$url = parse_url($remotefile);
if ($fp = @fsockopen($url['host'], ($url['port'] ? $url['port'] : 80), $errno, $errstr, $timeout)) {
fwrite($fp, 'HEAD '.@$url['path'].@$url['query'].' HTTP/1.0'."\r\n".'Host: '.@$url['host']."\r\n\r\n");
while (!feof($fp)) {
$headerline = fgets($fp, 4096);
if (eregi('^Content-Length: (.*)', $headerline, $matches)) {
$size = intval($matches[1]);
break;
}
}
fclose ($fp);
}
return $size;
}resolution: 1280 x 720
time: 9701.695 sec time_string: 161:42
1310784729+4351741=1315136470 total bytes
bitrates: 1084Kbps
File parsed in 9.986 seconds.
$tmpfname = tempnam("./", "mp4");
$buf = file_get_contents( $_REQUEST['filename'], false, null, 0, GETID3_FREAD_BUFFER_SIZE * 300);
file_put_contents( $tmpfname, $buf);
$info = $getID3->analyze( $tmpfname);
getid3_lib::CopyTagsToComments($info);
//echo table_var_dump($info);
//print_r( $info['quicktime']['vedio']);
echo $info['video']['resolution_x']." x ";
echo $info['video']['resolution_y']."<br>";
echo $info['playtime_seconds']." ";
echo $info['playtime_string']."<br>";
$filesize = $info['quicktime']['mdat']['size'] + $info['quicktime']['mdat']['offset'];
echo $info['quicktime']['mdat']['size']."+";
echo $info['quicktime']['mdat']['offset']."={$filesize}<br>";
echo round( $filesize * 8 / $info['playtime_seconds'] / 1000)."Kbps<br>";
Users browsing this forum: No registered users and 2 guests