I can issue this command:

ffmpeg -i input.mp3 -acodec alac -ab 128k -ar 48000 -ac 2 -y output.m4a 

to create a m4a file.

But when I issue this command

ffmpeg -i input.mp3 -acodec alac -ab 128k -ar 48000 -ac 2 -y output.aac

ffmpeg is throwing an error saying

Could not write header for output file #0 (incorrect codec parameters ?).

Also, the size of the m4a file is really almost 5.8 times larger than the original file, which is absolutely not what I wanted and why I wanted to convert to AAC.

link|improve this question

75% accept rate
feedback

1 Answer

up vote 5 down vote accepted

There are several problems with your approach:

  • alac is not AAC. ALAC is the Apple Lossless Audio Codec, whereas AAC is Advanced Audio Coding.

  • That's why your output is larger than the input, because in contrast to MP3, ALAC is still compressed, but it needs to be lossless – that's why it needs to store more data.

  • .aac is not an output container for ALAC audio. If you use AAC, that should work. I would use MP4 or M4A though.

Therefore, something along the following would work:

ffmpeg -i input.mp3 -acodec libfaac … output.m4a

-acodec libvo_aacenc can also be used instead of libfaac if your FFmpeg is configured to support it.

A third option, -acodec aac -strict experimental, is the "native" FFmpeg AAC encoder, but it is considered experimental.

link|improve this answer
Thanks. But for using libfaac which ffmpeg build should I use, because Zeranoe build does not support libfaac. – Soham Dasgupta Dec 23 '11 at 4:33
@Soham Well, you need libfaac installed, and I presume you're on Windows? I don't know exactly, but the regular aac codec might work for you as well. – slhck Dec 23 '11 at 8:20
Well can you explain the whole procedure because I donwloaded the libfaac.dll and kept it in the same folder as ffmpeg but still it did not recognize libfaac as a valid encoder. – Soham Dasgupta Dec 26 '11 at 5:10
@SohamDasgupta I don't know, I'm not on Windows. This thread suggests a few alternatives. It says that the Zeranoe build should support libvo-aacenc instead of libfaac`. You'll find some more info in that thread too, including suggestions on how to use a Nero encoder. – slhck Dec 26 '11 at 9:14
Isn't ALAC also compressed, just not lossy? – Daniel Beck Dec 30 '11 at 10:15
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.