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

Simon Brown simon.k.brown at gmail.com
Wed May 26 18:18:22 EEST 2021

> Ok, I've cheated somewhat, and taken my (much older) ffmpeg and
> editted isom.c so that rather than substituting 0x40 for AV_CODEC_ID_AAC it
> now substitutes 0x67 instead.  If I look at the resulting output file with
> mp4info and the output of FFmpeg itself they both show that it's MP4 AAC
> LC.  However, the codec string given by mp4info is mp4a.67.  If I want to
> send it to a web page it has to be AAC LC, but the typically accepted codec
> string is mp4a.40.2 which is also supposed to map to AAC LC.  So now I am
> wondering how I would encode that in the ESDS or similar so that a) mp4info
> is happy that it's mp4a.40.2 and that the chrome video decoder is happy
> with the media type (because mp4a.67 codec string although in theory
> supported gives me "Unrecognised media codec: mp4a.67" in Chrome.
> Another update:
I've updated movenc.c now, having reverted isom.c to original.
This (as I'm only ever dealing with AAC_LC) hacks the decoder specific info
len to force an extra 10 bytes if the track->par->codec_id =
And then later on where decoder specific info is inserted from vos_len and
vos_data (I couldn't find where these get set - hence me doing it this way)
I force these to insert the extra info required to make it think it's
This was done by comparing the esds packet from a faulty encoding and from
the correct encoding.
The correct encoding for mp4a.40.2 adds a descriptor of 5, length 5, and
then the bytes: 0x11 0x90 0x56 0xe5 0x00
mp4info accepts this is mp4a.40.2 and so does Chrome.

Thank you again for pointing me in the right direction, and apologies that
I've hacked ffmpeg purely for my purposes without finding a "proper"


More information about the ffmpeg-user mailing list