AAC decoding with Audio Toolbox is failing in Monterey RC

When I use Audio Toolbox APIs to decode AAC audio, I am getting kAudioConverterErr_FormatNotSupported(1718449215) error. This works fine in BigSur(11.5.2) and previous versions.

prompt> ./ffmpeg -c:a aac_at -i audio24b_he_aac.aac -f s16le -acodec pcm_s16le output.pcm -v trace


ffmpeg version N-104401-gcd38fbf4f7 Copyright (c) 2000-2021 the FFmpeg developers
 built with Apple clang version 13.0.0 (clang-1300.0.29.3)
 configuration: --disable-x86asm
 libavutil   57. 7.100 / 57. 7.100
 libavcodec   59. 12.100 / 59. 12.100
 libavformat  59. 6.100 / 59. 6.100
 libavdevice  59. 0.101 / 59. 0.101
 libavfilter   8. 15.100 / 8. 15.100
 libswscale   6. 1.100 / 6. 1.100
 libswresample  4. 0.100 / 4. 0.100
Splitting the commandline.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac_at'.
Reading option '-i' ... matched as input url with argument 'audio24b_he_aac.aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 's16le'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'pcm_s16le'.
Reading option 'output.pcm' ... matched as output url.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'trace'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url audio24b_he_aac.aac.
Applying option c:a (codec name) with argument aac_at.
Successfully parsed a group of options.
Opening an input file: audio24b_he_aac.aac.
[NULL @ 0x7f8cf4004d40] Opening 'audio24b_he_aac.aac' for reading
[file @ 0x7f8cf4005180] Setting default whitelist 'file,crypto,data'
Probing aac score:51 size:2048
[aac @ 0x7f8cf4004d40] Format aac probed with size=2048 and score=51
[aac @ 0x7f8cf4004d40] Before avformat_find_stream_info() pos: 0 bytes read:65696 seeks:4 nb_streams:1
[aac_at @ 0x7f8cf40057c0] AudioToolbox init error: 1718449215
[aac @ 0x7f8cf4004d40] All info found
[aac @ 0x7f8cf4004d40] Estimating duration from bitrate, this may be inaccurate

Following lines of code is failing.

status = AudioConverterNew(&in_format, &out_format, &at->converter);
if (status != 0) {
    av_log(avctx, AV_LOG_ERROR, "AudioToolbox init error: %i\n", (int)status);
    return AVERROR_UNKNOWN;
}

Is there any change with respect to these APIs in Monterey. I could not find any thing in the documentation or release notes.

Replies

Hi, I had the same issue you faced and I fixed with this patch below, found in FFMpeg issue report.

Hope it helps you!