How to combine 2 .mp4 videos on android device?

Viewed 2884

The goal is to combine 2 .mp4 videos like one playing after the other. There are countless references to ffmpeg, which is not a very good option since it involves NDK making the project really heavy for some not so significant function.

I came to know that mediacodec has been improved a lot. I need a guide to help me through it. I couldn't find any.

Also I am looking for combining .mp3 and a photo (single) and making a .mp4

Please help.

I tried using javacv library for 2nd query, it was a dead end. The code is as follows:

{FFmpegFrameGrabber videoFrames = FFmpegFrameGrabber.createDefault(videoSource);
    FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(videoFile, 200,         200);
    recorder.setFrameRate(10);
    recorder.start();
    Frame frame = videoFrames.grab();
    for (int i = 0; i < (numSeconds * 10); i++) {
        recorder.record(frame);
    }
}

It takes 12 seconds just to make a 5 frame video. fps is 25.

1 Answers
Related