sorry, I still can't get the bitrate out of WMA file

The place for "I can't figure out how to..." questions.
Post Reply
kenmaster
User
Posts: 4
Joined: Sat May 20, 2006 12:58 am

sorry, I still can't get the bitrate out of WMA file

Post by kenmaster » Sun May 21, 2006 2:24 am

I use PHP code to get all the tags info out of WMA but bitrate.
Here's my code:

if ($wmafile) { // is it an WMA file?
$txt_artist = isset($mp3info['comments']['artist'][0]) ? $mp3info['comments']['artist'][0] : "";
$txt_song = isset($mp3info['comments']['title'][0]) ? $mp3info['comments']['title'][0] : "";
$txt_album = isset($mp3info['comments']['album'][0]) ? $mp3info['comments']['album'][0] : "";
$num_track = isset($mp3info['comments']['track'][0]) ? $mp3info['comments']['track'][0] : 0;
$num_year = isset($mp3info['comments']['year'][0]) ? $mp3info['comments']['year'][0] : 0;

// Try to get a valid ID3v1 genre ID
require ("includes\genres_array.inc.php");
$num_genre = isset($mp3info['comments']['genre'][0]) ? $mp3info['comments']['genre'][0] : 255;
if (array_search($num_genre,$genres_array) != NULL) {
$num_genre = array_search($num_genre,$genres_array); // $num_genre now contains the old ID3v1 tag
} else {
$num_genre=255;
$genre_error=1;
}

if (isset($mp3info['asf']['audio']['bitrate_mode']) || isset($mp3info['asf']['audio']['bitrate'])) {
if ($mp3info['asf']['audio']['bitrate_mode']=="CBR") {
$txt_quality=$mp3info['asf']['audio']['bitrate_mode'];
} else {
$txt_quality=$mp3info['asf']['video']['bitrate'];
}
} else $txt_quality = "unknown";
}

But I can't get the bitrate out of WMA file, could anyone help?

James Heinrich
getID3() v1 developer
Posts: 1476
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Sun May 21, 2006 2:41 am

Code: Select all

echo $mp3info['bitrate'];

kenmaster
User
Posts: 4
Joined: Sat May 20, 2006 12:58 am

Post by kenmaster » Sun May 21, 2006 2:51 am

sorry, where did mean I should put this code in?

James Heinrich
getID3() v1 developer
Posts: 1476
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Sun May 21, 2006 2:56 am

Wherever you want. The overall file bitrate is stored in $mp3info['bitrate'] as a float. Do with it as you please.

Post Reply