Skip to main content
Topic: AAC decoding with a free Windows Library? (Read 448 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

AAC decoding with a free Windows Library?

This is my first post here, and I hope to get some help with a technical problem concerning AAC-decoding. I am looking for a 64-Bit AAC decoding library on Windows for use in an Open Source project which I am running.

The mentioned project is QIRX, a Software-Defined-Radio (SDR), featuring a demodulator for DAB+ audio broadcast transmissions, allowing to listen to DAB+ with cheapest RTL-SDR dongles as receiving frontends. The software is running on Windows as a 64-Bit application.

QIRX is using the libfaad decoder for converting the AAC stream to PCM16. Although this works very well, I would like to change to another decoder, for licensing reasons. libfaad is GPL licensed, whereas e.g. ffmpeg is LGPL licensed.

I created raw AAC coded files (ADTS headers) from QIRX , and tried different programs to decode them. Among those were ffmpeg and foobar2000 in version 1.4.3. beta 4.

foobar2000 was the only program I could find on Win10 decoding my AAC files correctly. ffmpeg produced stuttering output with tons of error messages on its console.

My question: Does anyone knows how foobar2000 decodes the AAC? They state to use ffmpeg (if I got it right). Maybe it is used in another configuration than the ffmpeg I used. Would they perhaps be willing to share the dll they are using?

Any help or information would be appreciated!

Re: AAC decoding with a free Windows Library?

Reply #1
foobar2000 uses avcodec-fb2k-57.dll and avutil-fb2k-55.dll (and they're inside foobar2000 folder).
You can compile them yourself using instructions at http://www.foobar2000.org/ffmpeg

Re: AAC decoding with a free Windows Library?

Reply #2
Thanks for your fast reply.

I am asking myself why the "official" ffmpeg player, called ffplay does not work. It starts with the output shown in the "code" part below. The output is totally corrupted. On the other hand, foobar2000 plays that file (2 minutes) perfectly. Using the foobar200 DLLs directly is unfortunately not possible because they are 32-bit, and 32bit mixing with 64bit is not possible within a process.

What are foobar2000 and ffplay doing different?

However, inspired by your remark about the sources ( I had tried these as well, I think under native windows this is a real challenge...) I will try the foobar SDK, and see if I can get something from it.

Code: [Select]
ffplay version N-93264-g85051febc6 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.102 / 58. 47.102
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[aac @ 000002641ef74800] Format aac detected only with low score of 1, misdetection possible!
[aac @ 000002641ef74800] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'RawTestFile_DTS.aac':
  Duration: 00:02:07.37, bitrate: 63 kb/s
    Stream #0:0: Audio: aac (HE-AAC), 48000 Hz, stereo, fltp, 63 kb/s
[aac @ 000002641ef7a6c0] Error decoding AAC frame header.0B f=0/0
[aac @ 000002641ef7a6c0] channel element 3.6 is not allocated
[aac @ 000002641ef7a6c0] channel element 3.11 is not allocated
[
...
...


Re: AAC decoding with a free Windows Library?

Reply #4
I tried this as well, no success...

Anyway, thanks for the hint!

Re: AAC decoding with a free Windows Library?

Reply #5
Thanks for your fast reply.

I am asking myself why the "official" ffmpeg player, called ffplay does not work. It starts with the output shown in the "code" part below. The output is totally corrupted.

The log notes that ffmpeg isn't even certain it has an AAC file, and then fails to parse the header, so no surprise the data is corrupted.  DAB+ support was recently added to ffmpeg, so make sure you have a new enough build of ffmpeg, and that you don't have to set any specific settings to tell the decoder it is a DAB+ stream (since you don't have it wrapped in an mp4 file don't assume that the decoder knows what you are feeding it). Foobar is presumably handling all of this for you before calling the ffmpeg decoder. 

There are a lot of threads on google about dealing with DAB+ streams in ffmpeg.  Might be worth looking. 

Re: AAC decoding with a free Windows Library?

Reply #6
Hello saratoga,

Although you are right that the log writes some uncertainty about AAC, it decodes the header correctly. Duration, HE-AAC, sampling rate etc. are reported properly. But you are right that no other header apart from the DTS header is provided. foobar2000 doesn't complain about it.

Another item might be that - when inspecting the history of foobar2000 some days ago - I remember a remark that ffmpeg had made a patch for them, specifically for the AAC decoding. I cannot find this remark anymore, maybe because the "beta" tag has been removed (or it's because I'm getting old...).

To my knowledge, the main difference between "usual" AAC files and DAB+ is that normally 1024 bytes blocks are used, whereas DAB+ uses 960 bytes. Maybe this makes the difference. Libfaad2 in its original version cannot decode 960Byte blocks with ADTS headers, only in ASC mode. However, that had been easy to modify, and QIRX uses ADTS headers now regularly.

I will follow your advise and try to get info about DAB+ ffmpeg, although I doubt a little that there is much of code available.

Re: AAC decoding with a free Windows Library?

Reply #7
By the way, ffmpeg still doesn't support decoding of HE-AAC 960, it decodes only LC-AAC part  (and, it's not 960 bytes, it's 960 samples).

 

Re: AAC decoding with a free Windows Library?

Reply #8
Thanks for clarifying about bytes and samples. My bad. Your remark about the inability of ffmpeg to decode 960 samples files would be an explanation, supporting the assumption that foobar2000 is not using "standard" ffmpeg?

Re: AAC decoding with a free Windows Library?

Reply #9
Thanks for clarifying about bytes and samples. My bad. Your remark about the inability of ffmpeg to decode 960 samples files would be an explanation, supporting the assumption that foobar2000 is not using "standard" ffmpeg?

ffmpeg can decode 960 sample files, but it won't use the HE part (if present). 

Re: AAC decoding with a free Windows Library?

Reply #10
Thanks for clarifying about bytes and samples. My bad. Your remark about the inability of ffmpeg to decode 960 samples files would be an explanation, supporting the assumption that foobar2000 is not using "standard" ffmpeg?
No, it can decode AAC-960, but SBR part won't be decoded. So ffmpeg will treat your HE-AAC 48 kHz file as LC-AAC 24 kHz.

Re: AAC decoding with a free Windows Library?

Reply #11
Should 24kHz sampling rate instead of 48kHz give some output?

libfaad reports the Object Type as #5 (SBR). And - sorry - there MUST be a difference between foobar2000 and ffplay (perhaps some missing commandline argument).

Re: AAC decoding with a free Windows Library?

Reply #12
Yes, decoding the AAC-LC part of the SBR stream will give you audio.

Re: AAC decoding with a free Windows Library?

Reply #13
Ok, the struggle will continue.

Thanks a lot to you and also lvqcl for your clarifications and advises. That was really helpful.

 
SimplePortal 1.0.0 RC1 © 2008-2019