Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Ideas on parsing mp4 file to get extract the raw aac data (Read 9937 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Ideas on parsing mp4 file to get extract the raw aac data

I am trying to get the fdk-aac source code to compile in android NDK
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
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?

Re: Ideas on parsing mp4 file to get extract the raw aac data

Reply #1
For MP4 parsing, there are the MP4v2 and Bento4 libraries:

    https://code.google.com/archive/p/mp4v2/
    https://www.bento4.com/

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.