Merging multiple mp4 audio files - Android

671 views Asked by At

I am trying to make an audio recorder feature for my app which supports pausing/resuming recording. At the end, when the user hits save, i only want 1 file. In android, mediarecorder doesn't support pause and write to a new file each time its initiated.

Currently im using mp4parser to merge the files but it takes a very long time (11-20 mins) to merge a 2min with 20min file.

Are there any alternatives? The files are in mp4 format.

1

There are 1 answers

0
Volodymyr Lykhonis On BEST ANSWER

MediaCodec and MediaMuxer. Once you have encoded m4a samples you can store them or pass to muxer to write into file. Since both codec and muxer are working in different threads and carrying asynchronous nature you can stop ("pause") feeding samples and continue when you need too.