How can i merge multiple MP4 (only audio) files to one file in Android?

776 views Asked by At

I use MP4Parser: https://code.google.com/p/mp4parser/

if i want to merge two or more files then it takes a very long time.

  • File 1 is 2:00 min
  • File 2 is 3:00 min
  • File 3 is 2:00 min

merge time: approximately 10 min.

in LogCat i see a lot of this:

GC_FOR_ALLOC freed 1668K, 11% free 14047K/15748K, paused 27ms, total 27ms

can anybody help me?

My code:

                Movie[] inMovies = new Movie[count];

                for (int i = 0; i < count; i++) {

                    inMovies[i] = MovieCreator.build(tempDirectory + "/"
                            + i);
                }

                List<Track> audioTracks = new LinkedList<Track>();

                for (Movie m : inMovies) {
                    for (Track t : m.getTracks()) {
                        if (t.getHandler().equals("soun")) {
                            audioTracks.add(t);
                        }
                    }
                }

                Movie result = new Movie();

                if (audioTracks.size() > 0) {
                    result.addTrack(new AppendTrack(audioTracks
                            .toArray(new Track[audioTracks.size()])));
                }

                Container out = new DefaultMp4Builder().build(result);

                FileChannel fc = new RandomAccessFile(
                        String.format(src), "rw").getChannel();
                out.writeContainer(fc);
                fc.close();
0

There are 0 answers