mstorsjo / fdk-aac

A standalone library of the Fraunhofer FDK AAC code from Android.

Home Page:https://sourceforge.net/projects/opencore-amr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

decoder example

robotnic opened this issue · comments

commented

I have many soundfiles in aac-eld format. (It was a mistake to use eld). Now I don't find a program that is aber to open this format.

A decoder example would be excellent.

Sure, I could try writing such an example, that shouldn't be too hard. What file format is your aac-eld data in? Ideally I could try to make the decoder example parse this file format, but it's quite possible that parsing that file format is out of scope for a small example here. You can't put AAC-ELD in ADTS at least, so I guess it's in a mp4/m4a file, or possibly in LATM, and both of these latter ones are much harder to handle than ADTS.

FWIW, I've got an experimental patch for libav that adds support for decoding using libfdk-aac as well, at https://github.com/mstorsjo/libav/commits/fdk-aac. It's not meant to be included upstream, but probably can do the job for you.

commented

I will try the libav version. At the moment I can't download big files - I'm in a remote place in Laos and the connection is not good.

Here my question about that at stackoverflow:
http://stackoverflow.com/questions/14986386/aac-eld-decode-linux

The experimental branch for libav doesn't seem to work well now when I rebased it on top of the latest version of libav, I'll try to fix it soon.

The latest version of that libav branch on github should work now. When built, run e.g. "./avconv -acodec libfdk_aac -i in.mp4 -y out.wav", you need to specify the decoder manually for this one to work since it doesn't override the internal default decoder.

FWIW, I've added a branch here on github, named decoder-example. This contains a simple standalone tool that decodes from .aac (ADTS) files, and a second tool that uses libavformat to read .m4a/.mp4 files and decodes them to .wav.

commented

I compiled the decoder-example.
When I try to convert the aac-eld mp4 files I get the error "Not an ADTS packet".

aac-dec audio.mp4 y.wav
Not an ADTS packet

Yes, as I explained earlier, MP4 files are harder to demux, so this simple example only handles .aac files (ADTS). If you have libavformat installed, configure should also find the other example, m4a-dec, which uses libavformat to read the .mp4 file and decode it to a wav file. Alternatively, you can use the fdk-aac branch for libav which allows you to decode it using the avconv program.

commented

How do I checkout and compile this:
https://github.com/mstorsjo/libav/commits/fdk-aac
?
I don't know how to clone it.

You clone the repo (git://github.com/mstorsjo/libav.git) and check out that particular branch (fdk-aac).

Hi.
I'm interested in evaluating the aac decoder library for the ELD profile.
Can you also upload an example for decoding raw eld frames ?
Encoding-decoding in raw seems easier than unpacking latm, but I can't find any documentation on how to set up the parameters of aacDecoder_ConfigRaw().

The example in decoder-example shows how to do it from an mp4 file. Since raw AAC frames aren't self-delimited, an example that decodes them from a file needs some sort of container, I can't do an example with raw frames unless they come straight from the encoder, as an encode-decode example (but I don't see that as necessary).

The data that you pass to aacDecoder_ConfigRaw should be the buffer that you get from aacEncInfo in the encoder (it's normally about 2 bytes large); if you are dealing with raw AAC frames you will need to pass this buffer separately as a separate packet.

Hello,
I've a little trouble with compiling decoder-example. I'm trying to analyzed quantized spectral coefficients. I want to decode aac stream(.aac). I don't need to deal with m4a. The compilation is giving me m4a error. Please guide me.

fdk-aac: make
  CCLD     m4a-dec
Undefined symbols for architecture x86_64:
  "_av_free_packet", referenced from:
      _main in m4a_dec-m4a-dec.o
  "_av_strerror", referenced from:
      _main in m4a_dec-m4a-dec.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [m4a-dec] Error 1

Thank you.

If you you're testing the decoder-example branch and it fails for you, you can either try to checkout the second-last commit in that branch (before the m4a-dec tool was added, if that fails for you and you don't want to build it), or try configuring with PKG_CONFIG=false ./configure --enable-example, to make sure it doesn't detect libavformat and doesn't try to build m4a-dec.

Dear Sir,
Compilation is successful. But I'm getting shell script wrapper executable for aac-dec even though I compiled with --disable-shared. However, I got real binary for aac-enc. Thank you.

Did you build without --disable-shared first? Make sure you do a full make clean (or ideally make distclean) if you reconfigure.

Yes, I did without it first, let me try now.

I make distclean. I configured with --disable-shared. But only aac-dec becomes wrapper.

I can't really help much with that, then - I get a proper binary and no shell script when building that way. What does ldd .libs/aac-dec say (or, on OS X, otool -L .libs/aac-dec)?

Sorry, I felt asleep, it was 3am. Now I nuked the whole folder, I checked out decoder-example again and build as you said, it's awesome. I'm good to go now. I'm not sure it's related to iTerm2 session or not. Maybe time to move to Linux. Thank you very much, you are the best.