cropsly / ffmpeg-android-java

Android java library for FFmpeg binary compiled using https://github.com/writingminds/ffmpeg-android
http://writingminds.github.io/ffmpeg-android-java
GNU General Public License v3.0
3.32k stars 831 forks source link

Merge Multiple Audios and Video #336

Open nacartunahan opened 4 years ago

nacartunahan commented 4 years ago

Does anybody know how to merge 3 or more audio with video writing a command. Also I am working on Android Studio so command must be like this. String command[ ] = {" ", " ", " "};

yadavkohi commented 4 years ago

please check the below command to merge 2 audio with 1 video.

String[] cmd = new String[]{"-i", videoPath, "-i", firstAudio, "-i", secondAudio "-filter_complex", "[0:a]volume=20dB[a0];[1:a]volume=10dB[a1];[2:a]volume=10dB[a2];[a0][a1][a2]amix=inputs=3[a]", "-map", "0:v", "-map", "[a]", "-c:v", "copy", "-threads", "50", "-preset", "ultrafast", finalVideoPath};

This command merge 2 audio with 1 video(with sound). You can merge as many audio as you want. just add the input using "-i", file name and add this into the filter_complex tag.

nacartunahan commented 4 years ago

This command is not working, do you have any other command?

engelbertink commented 3 years ago

No packets were sent for some of the attached pictures

This error came along with this one below

Error writing trailer of /storage/emulated/0/AudioReplacingTest/MultipleAudioWithVideo1595589437585.mp3: Invalid argument

@yadavkohi ?? Can you elaborate, how can we solve this error.

aliraza96 commented 3 years ago

No packets were sent for some of the attached pictures

This error came along with this one below

Error writing trailer of /storage/emulated/0/AudioReplacingTest/MultipleAudioWithVideo1595589437585.mp3: Invalid argument

@yadavkohi ?? Can you elaborate, how can we solve this error.