Combine / merge / mix multiple audio files with MP4Parser on Android - android

I have two MP4 audio files and one MP4 video file. I need to combine them to reproduce the video and the two sounds at same time (Parallel, Not concatenate), in order to get an only MP4 file.
For example, I have an MP4 audio file with voice, another with music, and another with video. I need that they play all together like a videoclip.
I have been trying to add several audio tracks to movie with MP4Parser with:
video.addTrack(audioTrack1);
video.addTrack(audioTrack2);
But when I play it, I only can hear one of them. Maybe MP4Parser is working correctly and I didn't understand this functionality, for this cause I need an answer about it.
Is it possible to do this with MP4Parser or I am wrong and it is impossible?
If it is possible, please could you give me a working example code?
Thank you in advance.

Related

In order to make an MP4 in Instagram and Whatsapp previewable, should I move the MOOV box to the front of the file?

At the moment I've successfully generated MP4 files via MediaCodec, but I can't play them back in Instagram or Whatsapp after uploading them. Right now I assume that the problem lies with the MP4 files being not streamable as the MPEG4Writer says, and that in order to make them streamable, I have to move the MooV atom to the beginning of the MP4 file.
I know of the qt-faststart option in libav/ffmpeg, but I'm ruling that out because ffmpeg will bloat my APK size. I heard it's possible to do this using MP4Parser, though.
My questions:
Is there any other alternative when it comes to moving the MooV atom to the beginning of the MP4 file?
Does Instagram and Whatsapp require the MP4 file to be streamable like this?
Actually, you don't need all of libav/ffmpeg to use qt-faststart, it's a self-contained small application - you only need the single C file that it is contained in, so it's in practice a very small tool.
I don't know if this is the reason why Instagram and Whatsapp can't work with your video, though, or if it is due to some other issue.

how to cut audio file and merge with video file in android?

I want to cut audio and merge an audio file with video programmatically in android.
I don't know how to work with FFMPEG , can anyone tell me how to start with or another solution?
Any Help?
Use mp4parser library
library
https://github.com/sannies/mp4parser
test
https://github.com/vicmns/mp4parser-android-test

Android_Can't play the mp4 file generated by MediaMuxer

I am trying to use MediaCodec and MediaMux to generate mp4 file. The code I am using is here.
I get some mp4 file. However, I can't play it with my player, which is just a normal software.
Does anyone has any idea? What should I do next?
I had a similar issue - in my case I simply wasn't calling muxer.stop() and ended up with a large unplayable file.

How can we make part of single audio file. like i want to make two audio files from one audio file in Android.

How can we make part of single audio file. Just like want to make two Audio files from one Audio file from selected position of Audio file in android. so how is it possible please let me know.
Check this
How to write a Mp3 clipper or cutter in android?
And this
https://code.google.com/p/ringdroid/source/browse/trunk/?r=66#trunk/src/com/ringdroid

How to merge an Audio and Video files in Android

I have a small video clip and an audio file. The problem is how to write code to merge them into a single file. i have never written code for multimedia applications for android and don't know if the merging is possible with android media framework. Is there any third party library to do that?
Can we right a merging code in Java and call it in Android?
Please guide me through this. Thanks
You can try INDE Media for Mobile, tutorials are here: https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials
It has a sample demonstating how to substitute audio track in mp4 video file by another audio track from another mp4 file. It's here: https://github.com/INDExOS/media-for-mobile/blob/master/Android/samples/effects/src/com/intel/inde/mp/effects/SubstituteAudioEffect.java
In sample app it's under Audio Effect:

Categories

Resources