|
-
Aug 12th, 2006, 12:15 PM
#1
Thread Starter
PowerPoster
reading mp3 header
I am trying to find out the bitrate of an mp3 file.
I have successfully been able to retrieve other information (name, artist, title, year etc...) but not the bitrate of an mp3 file.
how would I go about doing this?
-
Aug 12th, 2006, 03:48 PM
#2
Re: reading mp3 header
How did you retrieve the other info.
If you tell us how perhaps we can help, but I don't really know how to get mp3 info
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 12th, 2006, 04:08 PM
#3
Thread Starter
PowerPoster
Re: reading mp3 header
the other info was retrieved by seeking 128 bytes from the file and then string parsing
FileStream theFileStream = new FileStream(@"Path\file.mp3", FileMode.Open);
Byte[] theByteBuff = new Byte[128];
theFileStream.Seek(-128, SeekOrigin.End);
theFileStream.Read(theByteBuff, 0, 128);
theFileStream.Close();
System.Text.ASCIIEncoding theEncoding = new System.Text.ASCIIEncoding();
string theTagInfo = theEncoding.GetString(theByteBuff);
if (theTagInfo.Contains("TAG"))
{
string theTitle = theTagInfo.Substring(3, 30).Trim();
string theArtist = theTagInfo.Substring(33, 30).Trim();
string theAlbum = theTagInfo.Substring(63, 30).Trim();
string theYear = theTagInfo.Substring(93, 30).Trim();
}
trust me, its not there (bitrate)
-
Aug 14th, 2006, 01:04 PM
#4
Re: reading mp3 header
Here is the information about the file format. It should give you enough information to get started on what you should be reading:
http://www.dv.co.yu/mpgscript/mpeghdr.htm
However, if you only sample one frame of data, your #s might not be correct because of the ability of MP3 files to have a variable bitrate.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|