How to use afconvert to convert from .caf to .mp3 format?

sameerab picture sameerab · Jan 12, 2009 · Viewed 31.2k times · Source

I am using the afconvert command line utility to convert an audio file from .caf to .mp3 format. I have used afconvert:

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

But this gives me the following error:

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

I have also tried the following:

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

This also gives me the error:

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

I couldn't figure out why is this giving error.

Can anybody guide me in solving this problem?

Thanks in an advance.

Answer

Guvener Gokce picture Guvener Gokce · Mar 22, 2009

you should check this,

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

This way you will convert your CAF file to the MPEG-4 format.

Read: Apple does not ship any form of MP3 encoder with Mac OS X aside from the one built into iTunes. source: http://lists.apple.com/archives/coreaudio-api/2005/Jul/msg00182.html

you should use 3rd party encoders if you need to encode mp3 Mp3 Encoder examples: lame encoder or ffmpeg :) good luck.