[FFmpeg-user] Preserving AAC LC status when converting to fragmented MP4

Moritz Barsnick barsnick at gmx.net
Mon May 24 23:26:03 EEST 2021

On Wed, May 19, 2021 at 12:17:38 +0200, Tobias Rapp wrote:
> Looks like the data that should be found in the "esds" atom is missing or
> incomplete when using -c:a copy. See this link for details on how AAC
> profile information is stored in MP4:
> https://stackoverflow.com/questions/3987850/mp4-atom-how-to-discriminate-the-audio-codec-is-it-aac-or-mp3

Interesting stuff.

> Don't know enough about TS (de)muxing, though, to find out where this
> profile data should be parsed out from the input by FFmpeg.

MPEG-TS and demuxing isn't the problem. If you look at the ffmpeg
output in the original e-mail from decoding the file, it correctly
identifies the codec as "aac (LC)". The issue is the encoding to MP4.

The reason is that the AAC variants have only one codec tag
AV_CODEC_ID_AAC, and that needs to map to various tags, e.g. 0x40 for
AAC and 0x67 for AAC LC.


When writing the tag in the esds atom, there's no additional info
available allowing mapping to 0x67, therefore 0x40 is written:


I have no idea how this info could be carried forward.


More information about the ffmpeg-user mailing list