Digital Audio/Video => General A/V => Topic started by: mahaju on 2019-08-29 16:35:16

Title: Ideas on parsing mp4 file to get extract the raw aac data
Post by: mahaju on 2019-08-29 16:35:16
I am trying to get the fdk-aac source code to compile in android NDK
https://github.com/mstorsjo/fdk-aac/tree/decoder-example (https://github.com/mstorsjo/fdk-aac/tree/decoder-example)
I want to supply an mp4 file (with only aac audio) to this library and decode it wav samples
Looking around I have seen that people recommend using a separate library to open the mp4 file and extract the aac data and supply it to the fdk-aac decoder, as parsing mp4 is too complicated
Following this advice I tried to include the libav library into my project, but it is very difficult to get this combined project compiled in NDK
I don't need all the features of libav, I just need to be able to open an mp4 file and obtain the raw, aac data inside, so that I can decode this data using fdk-aac library as shown here
https://github.com/mstorsjo/fdk-aac/blob/decoder-example/m4a-dec.c (https://github.com/mstorsjo/fdk-aac/blob/decoder-example/m4a-dec.c)
It seems I can't just copy the libavformat folder from libav to my project, as it uses file from othe folder (like libavcodec for example) as well, and if I include the whole libav project into my project then it's very difficult to get it to compile

Is there any other simple library that can open and parse mp4 file to get the aac audio inside it? Or is there no option but to make an mp4 parser from scratch?
Title: Re: Ideas on parsing mp4 file to get extract the raw aac data
Post by: enzo on 2019-08-29 17:47:48
For MP4 parsing, there are the MP4v2 and Bento4 libraries:


MP4v2 is a bit outdated as it has been mostly unmaintained for a while. You might want to use the unofficial TechSmith fork of it which has some additional fixes: https://github.com/TechSmith/mp4v2

It is reasonably easy to use though and you can find example code on GitHub etc. Cannot say much about Bento4, but it seems to be more up to date with support for MPEG DASH etc.

Be aware of the licenses though. Bento4 is GPL and a commercial license must be bought from the company behind it for non-GPL use. MP4v2 is licensed under the MPL and can be used under that license even in commercial apps.
SimplePortal 1.0.0 RC1 © 2008-2021