【问题标题】:How to use afconvert to convert from .caf to .mp3 format? [closed]如何使用 afconvert 从 .caf 转换为 .mp3 格式? [关闭]
【发布时间】:2010-09-30 22:11:28
【问题描述】:

我正在使用 afconvert 命令行实用程序将音频文件从 .caf 转换为 .mp3 格式。我用过afconvert:

afconvert -f 'MPG3 ' -d '.mp3' -v input.caf output.mp3 

但这给了我以下错误:

Input file: input.caf, 19008 frames
Error: ExtAudioFileSetProperty ('cfmt') failed ('fmt?')

我还尝试了以下方法:

afconvert -f 'MPG3 ' -d LEI32@44100 -v input.caf  output.mp3

这也给了我错误:

Input file: min.caf, 19008 frames
Error: ExtAudioFileCreateWithURL failed ('fmt?')

我不知道为什么会出现这个错误。

谁能指导我解决这个问题?

提前致谢。

【问题讨论】:

    标签: iphone core-audio


    【解决方案1】:

    您可以使用 LAME 编码器(在 Mac 上,运行 brew install lame 来安装它)。

    首先,您必须将 caf 转换为 wav(我没有机会检查 LAME 是否支持 caf 作为输入,但它肯定支持 wav)。 然后运行

    lame --alt-preset cbr 128 sample.wav
    

    这将创建具有 128 kbps 恒定比特率的 mp3 文件。
    LAME有很多设置,你可以随意选择mp3参数。

    【讨论】:

    • 命令“sudo port install lame”不起作用。
    • 安装 homebrew brew.sh 然后 brew install lame
    【解决方案2】:

    试试这个:

    afconvert -f mp4f -d aac -v input.caf output.mp3
    

    我知道它不完全是 mp3,但我无法解决您遇到的相同错误,所以我尝试了 mp4f,它成功了。

    【讨论】:

      【解决方案3】:

      你应该检查一下,

      afconvert -f mp4f -d aac -b 128000   input.caf output2.mp4
      

      这样您就可以将您的 CAF 文件转换为 MPEG-4 格式。

      阅读:Apple 不随 Mac OS X 提供任何形式的 MP3 编码器,除了 iTunes 内置的编码器。 来源:http://lists.apple.com/archives/coreaudio-api/2005/Jul/msg00182.html

      如果您需要对 mp3 进行编码,您应该使用 3rd 方编码器 Mp3 编码器示例:lame 编码器或 ffmpeg :) 祝你好运。

      【讨论】:

      • afconvert -f mp4f -d aac -b 128000 input.caf output2.mp3 适合我
      • 完美运行,谢谢!
      • -1 错误。这只是创建一个带有 mp3 扩展名的 mpeg4 音频文件。
      • 对我来说,以这种方式使用afconvert 会创建一个长度更大、体积更小的 mp3 文件。所以我用iTunes去convert a song to mp3
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2010-11-19
      • 2012-03-12
      • 2010-11-05
      • 1970-01-01
      • 1970-01-01
      • 2016-03-23
      相关资源
      最近更新 更多