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?
Asked
Active
Viewed 595 times
0
-
merge means append one file's content to another to make the two file a single one – David Jun 14 '11 at 02:59
-
Most people would call that "join" or "concatenate" or "append" or "splice together". Most people's impression of "merging" is something like interlacing or blending the frames of the two segments. – Stephen C Jun 14 '11 at 03:56
3 Answers
2
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.

Community
- 1
- 1

Denis Tulskiy
- 19,012
- 6
- 50
- 68
-
Your answer is good and helpfull. I have different problem , may be you have answer. I want to concatenate multiple mp3 files in android. Is it possible to achieve with Lame or any other library . If you have answer i can post a question for . I have googled alot about concatenating Mp3 file in android but found nothing that can help . In java we can do that with the help of javax package and awt package But it is not supported in android. Thanx in advance – Harsh Jul 30 '12 at 12:07
-
@Harsh: nothing I provided in my answer requires javax or awt. You can still simply dump all mp3 files in one file and have a working mp3 file that most players should be able to play. But it might have some noise or cracks between files. If you want to have a continuous sound, you have to decode the files with a fully gapless library, like mpg123 to pcm, concatenate them, and reencode with lame. – Denis Tulskiy Jul 30 '12 at 13:34
0
There is nothing built in to Android to achieve that, because there is no MP3 encoder in the SDK. You'll need an MP3 codec library.
See this answer.