Search code examples
javaandroidmp3

Is it possible to merge equally sized mp3 format files, and then retrieve, modify each unit file and add new ones in Java?


Is it possible to merge equally sized mp3 format files, and then retrieve, modify each unit file and add new ones in Java? Is there any tool or programming solution?


Solution

  • MP3 format does not allow clean merging of two files to create a new one without re-encoding. The reason is that first and last frame of the file contain some junk information that has to be discarded. You still can merge the files, like here, but it will not be gapless and accurate. Strip id3v1 tag from the first file (last 120 bytes, if it exists), id3v2 from the second file (see this link to see how to find and get size of id3v2), and then merge the files. Things could get complicated if there are LAME frames. But most player should be able to handle these files.