I'm writting a little program to split mp3 files.
I found some info on the Internet about the format of each frame in an MP3 file.
What I've done so far is to search through the file and find bytes that contain FFFF.
I figured those were the start of each header (sync word).
Then I split the file at the start of a particular frame and continue until I reach the desired length.
The split file plays back fine in all of the MP3 players I have.
The problem is when I try to process (re-encode) the split file using LAME - I get an error:
Number of channels has changed in MP3 file - not supported
Sample frequency has changed in MP3 file - not supported
It seems that LAME wants to see something else at the begginning of the file so I added
the first couple hundred bytes from the beggining of the original file to the split file and
LAME was able to process it (although it did say resyncing).
Also, if I do fix headers in Foobar2k, that makes it work in LAME, but I can see that it's adding stuff to the beginning of the file also.
So either I'm not splitting at the right point or I need to add something to the beginning of the files to make them work with LAME.
Does anyone know what info LAME is looking for?
Thank you!
Jon
