I'm facing a problem to append an audio, that I recorded using android.media.MediaRecorder.MediaRecorder() to a video that I took using the camera intent.
Basically, when I try to do this:
Movie s = MovieCreator.build(audioPath);
I get an exception:
12-05 22:04:30.775: E/AndroidRuntime(4191): java.lang.NullPointerException
12-05 22:04:30.775: E/AndroidRuntime(4191): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:48)
The path in this case is:
video: /mnt/sdcard/DCIM/Camera/merged_20131205_221045.3gp audio:
/mnt/sdcard/audio_1386288700940.3gp
I have combined two videos with success. But I face this problem to combine a sound in a video.
Actually, the problem is not to combine, the exception is when I call MovieCreator.build(audioPath)
.
Have anyone already faced this problem and can help me?
I related this problem a long time ago and until now the same issue happens. I stopped using MP4Parser and started using FFmpeg4Android.
It's not free and a little expensive ($499), depending on your project. But for me, it was perfect. It works very well and you can do a lot of things that MP4Parser doesn't allow you to do.
But there's a lot of ffmpeg free libraries for Android. By the time I posted this problem, 2013, I didn't find a free lib working without problems. But for sure today must be a free library that works very well.
Another option is to build your own ffmpeg library for Android. Here is a guide for this: https://trac.ffmpeg.org/wiki/CompilationGuide/Android
Hope it helps someone.