如何使用FFMPEG混合不同格式的声音文件? [英] How to mix sound files of different format using FFMPEG?

查看:157
本文介绍了如何使用FFMPEG混合不同格式的声音文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要不同类型的音频文件混合到在我的iPad应用程序通过code一个输出文件。
例如,我需要合并以.mp3或.wav或任何其他格式文件。M4A文件。
由此产生的输出文件应该是.m4a的类型。

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.

我已经编译FFMPEG适用于iOS的链接: HTTP: //lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html

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?

推荐答案

这是一个多回答一个建议。我没有与OBJ-C的经验,虽然我已经与其他语言的音频格式工作。除非你能找到一些图书馆做这个特定的任务,你可能需要取消code中的文件和数据转换为一些常见的数值再presentation。

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.

一个.wav 的文件的采样数据被存储为带符号的整数-32768至32767的范围内,之间,而 MP3采样数据存储为浮动的-1到+1的范围之间的点。要么重新presentation可以通过一些简单的计算被转换为另一个。

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.

mp3ToWavSample = mp3Sample * 32767

在数据被转换为合并变得非常容易。你可以简单地添加样本值在一起。

Once the data is converted "merging" becomes very easy. You can simply add the sample values together.

mergedSample = convertedSample1 + convertedSample2

您需要这适用于MP3的每一个样本。根据文件的尺寸,这可能是一个显著处理任务。

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.

这篇关于如何使用FFMPEG混合不同格式的声音文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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