I am trying to encode a WAV file (44.1 kHz, stereo) to AAC Low Delay and Enhanced Low Delay format using the Fraunhoffer FDK AAC library
I am using the encoder given here
https://github.com/mstorsjo/fdk-aac/tree/decoder-example (https://github.com/mstorsjo/fdk-aac/tree/decoder-example)
The encoder is in the aac-enc.c file. Changing the value to the aot parameter determines which AAC encoding format will be used. I set the values of aot to one of the values of the AUDIO_OBJECT_TYPE enum, which is defined in /libSYS/include/FDK_audio.h at line 159. For AAC-LD and ELD I choose AOT_ER_AAC_LD (23) and AOT_ER_AAC_ELD (39) respectively. I keep everything else in aac-enc.c unchanged, except the aot value.
Doing this, I get the error AACENC_INIT_TP_ERROR (enum defined in /libAACenc/include/aacenc_lib.hline 1031) afteraacEncEncode()` function and the decoding stops. The aac-enc.c program works if I choose other AAC formats like AAC LC or HE-AAC.
Why isn't this working for AAC-LD and ELD? Are there any other parameters that I have to change?
That's because ADIF and ADTS is only supported for AOT_AAC_LC:
https://github.com/mstorsjo/fdk-aac/blob/decoder-example/libMpegTPEnc/src/tpenc_lib.cpp#L252
You have to change AACENC_TRANSMUX parameter to use LOAS or LATM:
https://github.com/mstorsjo/fdk-aac/blob/decoder-example/aac-enc.c#L154