如何合并两个mp3文件到一个(合并/加入) [英] How to merge two mp3 files into one (combine/join)

查看:1179
本文介绍了如何合并两个mp3文件到一个(合并/加入)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在任何告知如何合并/合并两种媒体文件合并成一个?

Can any tell how to combine/merge two media files into one ?

我发现了一个关于的AudioInputStream 主题,但现在它不支持Android和所有$ C $下的Java。

i found a topics about audioInputStream but now it's not supported in android, and all code for java .

和上StackOverflow的我发现这里这个链接 但我不能找到解决办法 - 只在流式音频这些链接。任何一个可以告诉我吗?

And on StackOverflow i found this link here but there i can't find solution - these links only on streaming audio . Any one can tell me ?

P.S,为什么我不能启动赏金:(

P.S and why i can't start bounty ?:(

推荐答案

考虑两种情况的 MP3播放文件:

  • 文件具有相同的取样频率和声道数

在这种情况下,我们可以只添加第一个文件的结束第二个文件。这可以利用现有的文件类在Android上实现。

In this case, we can just append the second file to end of first file. This can be achieved using File classes available on Android.

  • 文件具有不同的采样频率和声道数量。

在这种情况下,夹子之一具有被重新烯coded到确保这两个文件具有相同采样频率和信道数目。要做到这一点,我们需要去code MP3,获得PCM采样,处理它改变采样频率,然后再重新连接code为MP3。据我所知,Android不具备跨code或reen code的API。一种选择是使用像瘸子/​​ FFMPEG外部库通过JNI重新连接code。

In this case, one of the clips has to be re-encoded to ensure both files have same sampling frequency and number of channels. To do this, we would need to decode MP3, get PCM samples,process it to change sampling frequency and then re-encode to MP3. From what I know, android does not have transcode or reencode APIs. One option is to use external library like lame/FFMPEG via JNI for re-encode.

这篇关于如何合并两个mp3文件到一个(合并/加入)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆