如何使用FFMPEG混合不同格式的声音文件?
我需要通过 iPad 应用程序中的代码将不同类型的音频文件混合到一个输出文件中。 例如,我需要将 .m4a 文件与 .mp3 或 .wav 或任何其他格式文件合并。 生成的输出文件应为 .m4a 类型。
我已经编译了适用于 iOS 的 FFMPEG,链接如下: http://lists .mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
现在,我不明白该往哪个方向继续?
I need to mix audio files of different types into a single output file through code in my iPad app.
For example, I need to merge a .m4a file with .mp3 or .wav or any other format file.
The resulting output file should be of .m4a type.
I have compiled FFMPEG for iOS with the link: http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
Now, I am not able to understand in which direction to proceed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这更多的是一个建议而不是一个答案。尽管我使用过其他语言的音频格式,但我对 obj-c 没有任何经验。除非您找到执行此特定任务的库,否则您可能需要解码文件并将其数据转换为某种常见的数字表示形式。
.wav 文件的示例数据存储为范围之间的有符号整数-32768 到 32767,而 mp3 样本数据 存储为介于范围为 -1 到 +1。任何一种表示形式都可以通过一些简单的计算转换为另一种表示形式。
一旦数据被转换,“合并”就变得非常容易。您只需将样本值相加即可。
您需要将其应用于 mp3 中的每个样本。根据文件的大小,这可能是一项重要的处理任务。
至于向轨道添加混响,我建议您在另一个问题中寻求帮助。
This is more of a suggestion than an answer. I don't have any experience with obj-c, though I have worked with audio formats in other languages. Unless you find some library that does this specific task, you may need to decode the files and convert their data to some common numerical representation.
The sample data of a .wav file is stored as signed integers between the range of -32768 to 32767, while mp3 sample data is stored as floating points between the range of -1 to +1. Either representation could be converted to the other through some simple calculation.
Once the data is converted "merging" becomes very easy. You can simply add the sample values together.
You would need to apply this to every sample in the mp3. Depending on the size of your files, this could be a significant processing task.
As for adding reverb to your track, I'd suggest that you ask for help on that in a another question.