如何在没有.caf容器的情况下使用AVAudioRecorder进行录制? [英] How to record using AVAudioRecorder without the .caf container?

查看:188
本文介绍了如何在没有.caf容器的情况下使用AVAudioRecorder进行录制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AVAudioRecorder实例进行记录,其中 AVFormatIDKey 的设置设置为 kAudioFormatMPEG4AAC 。它以AAC格式记录音频,但 .caf 音频容器打包音频文件。 (我可以在录音机文件中看到caff标题)。
我如何记录以便caff容器不在那里,而是以纯m4a格式存储,以便我可以跨平台使用这些文件。

I am using a AVAudioRecorder instance to record with the setting for AVFormatIDKey set to kAudioFormatMPEG4AAC. It records the audio in AAC format but a .caf audio container packages the audio file. (I can see the caff header in the recorder file). How do I record so that the caff container is not there but in pure m4a format so that I can use the files across platforms.

推荐答案

找到答案。
AVAudioRecorder有一种奇怪的方式。

Found the answer. There is a weird way the AVAudioRecorder works.

AVAudioRecorder保存文件的格式取决于您指定的URL /字符串您保存的文件。这取决于您要保存的文件名的扩展名。

如果您没有指定任何扩展程序或记录器无法理解的那个它将添加Core Audio容器。
所以,基本上看到扩展名和 AVFormatIDKey 匹配。
喜欢 aac 使用格式使用 .aac 扩展名 kAudioFormatMPEG4AAC 作为 AVFormatIDKey

If you don't specify any extension or one that the recorder can't understand then it will add the Core Audio container. So, basically see to that the extension and the AVFormatIDKey match. Like for aac use format use .aac extension with kAudioFormatMPEG4AAC as the AVFormatIDKey

这篇关于如何在没有.caf容器的情况下使用AVAudioRecorder进行录制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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