Parsing the MP3 Data, Isolating the MP3 Data Only |
Parsing the MP3 Data, Isolating the MP3 Data Only |
Dec 16 2011, 06:57
Post
#1
|
|
|
Group: Members Posts: 8 Joined: 16-December 11 Member No.: 95828 |
Hello Everyone.
I am still a newbie when it comes to MP3 and its detail/internal structure. This past few days, I have been parsing different MP3 files most of which have ID3vxx format. So basically to get the Mp3 data, I just read the data after the tag in case of ID3v2 and before the tag in case of ID3v1. So now I am given a Lame encoded? MP3 file. I can get the Header Information but not the actual audio data. So basically what I'm trying to do is to get the MP3 header and MP3 data only and ignore any tag/header or info within it. Thank you for any information. ** I hope I posted this in the correct area |
|
|
|
![]() |
Dec 16 2011, 08:19
Post
#2
|
|
|
Group: Members Posts: 592 Joined: 12-May 06 From: Colorado, USA Member No.: 30694 |
|
|
|
|
Dec 16 2011, 09:12
Post
#3
|
|
|
Group: Members Posts: 8 Joined: 16-December 11 Member No.: 95828 |
Thank you for that sample code. Besides the VBR/Xing Headers area, my code basically has the same concepts. I dump the HEX value of the mp3 file and there is no "Xing", "Info". One file have the LAME3.94 Version somewhere at the bottom of the file and the on the other file it is scattered all over the file. So basically I need to know the starting point of the audio stream and how big it is so that I can read it from the file and copy it to the memory and give it to the decoder .. |
|
|
|
Dec 16 2011, 13:20
Post
#4
|
|
|
Group: Members Posts: 107 Joined: 3-April 09 Member No.: 68627 |
So basically I need to know the starting point of the audio stream and how big it is so that I can read it from the file and copy it to the memory and give it to the decoder .. To find the start of the actual audio stream you have to skip the ID3v2 tag if it is present, using the tag size field from the tag itself, and then start scanning the stream for a valid mp3 frame header, which always starts from the 11 bits all set to one. Then parse the header to verify that this is actually a valid frame and find out its size. If the first frame of the stream does not contain VBR ("Xing" or "Info") header, then there is no way to find out the length of the entire stream except to parse it frame-by-frame until there are no more data to process. |
|
|
|
Dec 19 2011, 03:00
Post
#5
|
|
|
Group: Members Posts: 8 Joined: 16-December 11 Member No.: 95828 |
So basically I need to know the starting point of the audio stream and how big it is so that I can read it from the file and copy it to the memory and give it to the decoder .. To find the start of the actual audio stream you have to skip the ID3v2 tag if it is present, using the tag size field from the tag itself, and then start scanning the stream for a valid mp3 frame header, which always starts from the 11 bits all set to one. Then parse the header to verify that this is actually a valid frame and find out its size. If the first frame of the stream does not contain VBR ("Xing" or "Info") header, then there is no way to find out the length of the entire stream except to parse it frame-by-frame until there are no more data to process. That is what I did for files with ID3v2 tags and ID3v1 tags. Unfortunately, my test file right now does not contain "Xing" or "Info" header that is why I am having a hard time knowing where the actual audio stream are located in the file. Our decoder is very hardware specific and the api is very limited and not very friendly to use Thank you for the information though. |
|
|
|
samokan Parsing the MP3 Data Dec 16 2011, 06:57
pdq QUOTE (samokan @ Dec 16 2011, 04:12) One ... Dec 16 2011, 15:12
samokan QUOTE (pdq @ Dec 16 2011, 23:12) QUOTE (s... Dec 19 2011, 03:04
pdq Correct. You could replace it with almost anything... Dec 19 2011, 05:33
samokan Thank you. I was able to find some source code for... Dec 19 2011, 09:54
Sebastian Mares Right, LAME uses its version string as frame paddi... Dec 16 2011, 15:31
Sebastian Mares What I don't fully understand is what you are ... Dec 19 2011, 12:12
samokan QUOTE (Sebastian Mares @ Dec 19 2011, 20... Jan 5 2012, 04:37
benski once you skip the ID3v2 tag, you can basically sen... Jan 5 2012, 17:06
samokan thanks for pointing that out. I check all my worki... Jan 6 2012, 09:18
samokan thank you for all the response. it is finally work... Jan 10 2012, 08:11![]() ![]() |
|
Lo-Fi Version | Time is now: 19th June 2013 - 16:24 |