使用 afconvert 命令行工具将 .mp3 文件转换为 m4r

Using afconvert command line tool to convert .mp3 files to m4r

我有一个简短的 bash 脚本,用于将充满 .mp3 文件的文件夹转换为 .m4r 铃声。我无法弄清楚为什么会抛出以下错误:

“错误:ExtAudioFileCreateWithURL 失败('fmt?')”

#!/bin/bash

cd "/path/to/directory/containing/mp3s"

for i in *.mp3; do
    baseFilename=$( basename ${i} .mp3 )
    afconvert -f m4af ${i} -o "/path/to/new/location/${baseFilename}.m4r"
done

exit 0

问题是我没有指定输出数据格式。找到一个帮助我找到答案的页面:

http://support.moonpoint.com/os/os-x/audio/afconvert.php

    #!/bin/bash

cd "/path/to/directory/containing/mp3s"

for i in *.mp3; do
    baseFilename=$( basename "${i}" .mp3 )
    afconvert -f m4af "${i}" -d aac "/path/to/new/location/${baseFilename}.m4r"
done

exit 0