0

For AAC ("libfaac") audio encoder, how can I specify the "MPEG Version" to either "MPEG-4" or "MPEG-2" through FFmpeg's command?

1
  • I see that some encoding software can specify mpeg2 or mpeg4 as AAC's codec option and it is based on ffmpeg, so I think there is a command to specify this, but I can't find out. Commented Feb 28, 2013 at 12:28

1 Answer 1

1

When using libfaac, FFmpeg hard-codes the MPEG version to MPEG-4. You can observe this in libfaac.c, line 118.

faac_cfg->mpegVersion = MPEG4;

If you want to change it, you will have download the FFmpeg source, modify this line to use MPEG2 instead, and recompile FFmpeg with the appropriate configuration (including --enable-libfaac). This works and produces a playable file, however you'll obviously have to use a bitstream filter to create a valid bitstream for MPEG-4 containers now:

ffmpeg -i in.wav -c:a libfaac -absf aac_adtstoasc out.m4a

If instead you use the FAAC API directly, you can of course change this parameter as you wish.


Ideally, one would submit a patch for FFmpeg to include a new option which allows you to set this manually, but given that MPEG-4 was chosen as a hardcoded default I don't see a compelling reason to implement this.

Sign up to request clarification or add additional context in comments.

2 Comments

When do I need to use '-absf aac_adtstoasc'??
You need to use it when you're encoding an MPEG-2 versioned AAC bitstream that you want to package in an MPEG-4 container, because ADTS is the bitstream format for MPEG-2 AAC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.