简体   繁体   English

混合不同格式的Android音频文件

[英]Mixing audio files android with different formats

I have two audio files with .mp3 and .3gp with different timings but i want to mix those audios and produce one audio file with timings as first one. 我有两个音频文件,其中.mp3和.3gp具有不同的时序,但是我想将这些音频混合并以一个时序生成一个音频文件。 If 1st audio is 30sec and 2nd audio is 2min i want mixture of two audios which is of 30sec only. 如果第一个音频是30秒,第二个音频是2分钟,我想混合两个仅30秒的音频。 Once the first audio ends it should stop mixing. 第一个音频结束后,应停止混音。 I want the audio to be saved in file. 我希望将音频保存在文件中。

Currently I'm succeful of playing two audios using mediaPlayer but i want them to be played only when mixing is complete. 目前,我可以使用mediaPlayer播放两个音频,但是我希望仅在混合完成后才能播放它们。

This sounds like you can accomplish it using FFMPEG. 听起来您可以使用FFMPEG完成它。 They have ported it over to Android here: https://github.com/WritingMinds/ffmpeg-android-java 他们已将其移植到Android: https//github.com/WritingMinds/ffmpeg-android-java

With durations as low as those, I think the solution should be timely enough. 由于工期很短,我认为解决方案应该足够及时。

Once you get it setup, you'll run the command using the file path's from your code. 安装完成后,将使用代码中的文件路径来运行命令。

Here's an example of the code for audio mixing: https://superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpeg 这是音频混合代码的示例: https : //superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpeg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM