Coder Social home page Coder Social logo

mstorsjo / fdk-aac Goto Github PK

View Code? Open in Web Editor NEW
1.1K 70.0 375.0 10.33 MB

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

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

License: Other

Makefile 0.11% C 24.56% Shell 0.01% C++ 75.11% M4 0.01% CMake 0.20%

fdk-aac's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fdk-aac's Issues

aacDecoder_DecodeFrame(timeDataSize) is unused

Looking through the code, the parameter timeDataSize is unused. Specfically, this is causing issues with decoding in ffmpeg since the allocated frame buffer is too small, and the library is ignoring the parameter; though this could obviously cause issues elsewhere.

According to the documentation:

Call aacDecoder_DecodeFrame() which writes decoded PCM audio data to a client-supplied buffer.
It is the client’s responsibility to allocate a buffer which is large enough to hold this output data.

I was unable to find how large this buffer should be to avoid any out-of-bounds writes. Is there a general recommendation for this? Also, it might be a good idea to update documentation / remove this parameter since it does nothing and is rather misleading.

Decoding a HE-AACv2 stream fails in FFmpeg

Hello Martin :-)

Many thanks for your hard work!
I recently was able to compile on my Vista x86 laptop a non-free FFmpeg binary, with:
--enable-gpl --enable-nonfree --enable-libfdk-aac
using jb's build script @
https://github.com/jb-alvarado/media-autobuild_suite

I was conducting some experiments lately using libfdk-aac as an AAC decoder, overriding
FFmpeg's native aac decoder, to investigate the difference, if any...

As input files I used some BBC Radio 1 live streams.
While the following commands worked as expected:

ffmpeg -c:a libfdk_aac -re -i "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio1_q" -t 60 -c:a libmp3lame -b:a 128k -ar 44100 -ac 2 "BBC Radio 1 Live (56aaclc-128mp3).mp3"

(stream is encoded with AAC LC profile) and

ffmpeg -c:a libfdk_aac -re -i "http://as-hls-ww-live.bbcfmt.vo.llnwd.net/pool_7/live/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio=48000.m3u8" -t 60 -c:a libmp3lame -b:a 112k -ar 44100 -ac 2 "BBC Radio 1 Live (48heaac-112mp3).mp3"

(stream is encoded with HE-AACv1 profile),
the next command, in which the live stream is encoded with the HE-AACv2 profile, causes FFmpeg to crash:

ffmpeg -c:a libfdk_aac -re -i "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_he_radio1_q" -t 60 -c:a libmp3lame -b:a 112k -ar 44100 -ac 2 "BBC Radio 1 Live (48heaac2-112mp3).mp3"

Sometimes I get an "Error number -12 occurred" :

Stream mapping:
Stream #0:0 -> #0:0 (aac (libfdk_aac) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Error while decoding stream #0:0: Error number -12 occurred
Last message repeated 1 times

but usually ffmpeg crashes right after I hit enter; adding -v 48 as an input option does not
reveal anything useful, either.
Sadly, I am not very savvy to debug this myself; I know libfdk_aac can encode with "-profile:a aac_he_v2", so I regarded it a given that it could decode, too (which is probably the case).
However, this fails in my build and system... It looks as though libfdk_aac picks up the stream as
AAC (LC) with SR=22050 Hz and in mono
(Stream #0:0, 50, 1/28224000: Audio: aac, 22050 Hz, mono, s16, 46 kb/s),
whereas using the native decoder it is correctly identified as HE-AACv2:

Stream #0:0, 50, 1/28224000: Audio: aac (HE-AACv2), 44100 Hz, stereo, fltp, 44 kb/s

Any insight will be greatly appreciated!
Keep up the pristine job!

Kind regards,
Vangelis.

rdhi, rdlo and rm must all be different

Building fdk-aac for an ARMv5te target outputs a lot of the following assembler message:

rdhi, rdlo and rm must all be different

I am using gcc toolchain 5.3.0 from Buildroot.

Assertions should not abort/crash the encoding process

I am transcoding something with ffmpeg and fdk-aac. Seems like there is a data error in the audio stream.
fdk-aac causes ffmpeg to exit with error.
The encoder should not abort, it should be able to go on with the encoding and deal with this invalid data.
Same data works with vo-aacenc

Here is a the error message.

[mp2 @ 0x1673f60] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
ffmpeg: ./libFDK/src/fixpoint_math.cpp:397: FIXP_DBL invSqrtNorm2(FIXP_DBL, INT*): Assertion `val > (FIXP_DBL)( ( (0.0) >= 0) ? ((( (double)(0.0) * (((INT64(1)<<(32-1)))) + 0.5 ) >= (double)(((signed)0x7FFFFFFF)) ) ? (INT)(((signed)0x7FFFFFFF)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) + 0.5)) : ((( (double)(0.0) * (((INT64(1)<<(32-1)))) - 0.5) <= (double)(((signed)0x80000000)) ) ? (INT)(((signed)0x80000000)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) - 0.5)) )' failed.
Aborted

How to decode a he-aac file?

I want to decode a he-aac(generated from aac-enc.c in the fdk-aac) file ,and I followed the pdf,wrote a program. But the output was not correct.

Here is my code .
HANDLE_AACDECODER handle;
handle = aacDecoder_Open(TT_MP4_ADTS,1);
FILE aacFile = fopen(infile ,"rb");
HANDLE_WAV wav;
UCHAR *inBuffer = (UCHAR
)malloc(2048);
int readLen = -1;
int pReadLen = &readLen;
UINT bytesValid = 0;
INT_PCM outBuffer[20480];
int outSize = 0;
int firstFrame = 1;
int total = 0;
while(readLen != 0)
{
if (bytesValid != 2048)
{
readLen = fread((char
)(inBuffer + bytesValid) , 1, 2048 - bytesValid ,aacFile);
}
bytesValid = readLen;
total += readLen;
aacDecoder_Fill(handle, &inBuffer, (UINT_)&readLen, &bytesValid);
AAC_DECODER_ERROR errStatus;
while ((errStatus = aacDecoder_DecodeFrame(handle,outBuffer ,20480 ,0)) != AAC_DEC_NOT_ENOUGH_BITS)
{
CStreamInfo_ info =aacDecoder_GetStreamInfo(handle);
aacDecoder_SetParam()
if (firstFrame == 1)
{
WAV_OutputOpen(&wav ,outfile ,info->aacSampleRate ,info->numChannels ,16);
firstFrame = 0;
}
WAV_OutputWrite(wav ,(void*)outBuffer ,info->frameSize ,16 ,1);
}

    if (errStatus != AAC_DEC_OK)
    {
        if (errStatus == AAC_DEC_NOT_ENOUGH_BITS)
        {
            continue;
        }
        break;
    }

}
WAV_OutputClose(&wav);
fclose(aacFile);
aacDecoder_Close(handle); 

In the pdf ,there is a main.cpp file for the decode,but I can't find it.
By the way , I used aac-enc.c to encode a mono wav using he-aac, but the output file is stereo aac.How can I change it to mono output?
Thank you ~~

ffmpeg crashed in libFDK during h.264/aac encoding

ffmpeg: ./libFDK/src/fixpoint_math.cpp:397: FIXP_DBL invSqrtNorm2(FIXP_DBL, INT*): Assertion `val > (FIXP_DBL)( ( (0.0) >= 0) ? ((( (double)(0.0) * (((INT64(1)<<(32-1)))) + 0.5 ) >= (double)(((signed)0x7FFFFFFF)) ) ? (INT)(((signed)0x7FFFFFFF)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) + 0.5)) : ((( (double)(0.0) * (((INT64(1)<<(32-1)))) - 0.5) <= (double)(((signed)0x80000000)) ) ? (INT)(((signed)0x80000000)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) - 0.5)) )' failed.

./rip2mkv.sh: line 9: 1125 Aborted (core dumped) ffmpeg -analyzeduration 12000000 -i ... -loglevel info -sn -ar 48000 -ac 2 -c:a libfdk_aac -b:a 128k -vcodec libx264 -preset slow -crf 23 -vf yadif,crop=704:544:8:18 -threads 6 -f matroska -y ...

Memory usage

Hello,

It looks like whole encoder library allocates up to 240 KB of memory, while the only two modules needed for the ELD profile (AAC + SBR) takes about 170 KB of ram (mono channel).
Could these sizes be lowered down even more for the ELD profile only?

I initialize the encoder as following:
aacEncOpen(&handle, (0x01 | 0x02), channels)

The goal is to squeeze AAC ELD on my 64KB demo board and even leave some room for other modules.

libfdkaac.a too big

Dears,
I cross_compile this project, but the library libfdkaac.a is too big for my arm device. I only want to encode the pcm data to aac format. What parameter can I use when I do the compile? Waiting for your reply, Thanks.

Broken Documentation

Hi,
I noticed aacEncoder.pdf is a bit broken in version 0.1.5: some code-formatted text is missing, see page 5 for an example. The same issue exists in the original FDK so it's not your fault, but maybe you could mention it somewhere, or replace the file with a non-broken one (from 0.1.4 for example) ?

(I'm viewing the file with Atril Document Viewer 1.8.1 on Ubuntu).

Can't compile under visual studio 2015

It shows:
Item severity code file line
Error C1021 Invalid preprocessor command "Warning " FDK - AAC C: \ Users \ Shen Shu super \ Download \ compression \ fdkaac \ FDK -AAC \ libfdk \ include \ FDK_archdef.h 218

Getting warning messages when compiling

CXX      libSBRdec/src/psdec_hybrid.lo
In file included from libSBRdec/src/psdec_hybrid.cpp:87:0:
./libFDK/include/fft.h:152:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_8(FIXP_DBL *x)
                         ^
./libFDK/include/fft.h:124:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_4(FIXP_DBL *x)
                         ^
CXX      libSBRdec/src/sbr_crc.lo
.....................
.....................
.....................
CXX      libFDK/src/dct.lo
In file included from libFDK/src/dct.cpp:104:0:
./libFDK/include/fft.h:152:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_8(FIXP_DBL *x)
                         ^
./libFDK/include/fft.h:124:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_4(FIXP_DBL *x)
                         ^
CXX      libFDK/src/FDK_bitbuffer.lo
.....................
.....................
.....................
CXX      libFDK/src/FDK_hybrid.lo
In file included from libFDK/src/FDK_hybrid.cpp:94:0:
./libFDK/include/fft.h:152:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_8(FIXP_DBL *x)
                         ^
./libFDK/include/fft.h:124:25: warning: always_inline function might not be inlinable [-Wattributes] static void FORCEINLINE fft_4(FIXP_DBL *x)
                         ^
CXX      libFDK/src/FDK_tools_rom.lo
.....................
.....................
.....................
CXX      libFDK/src/fft.lo
libFDK/src/fft.cpp:139:25: warning: always_inline function might not be inlinable [-Wattributes]
 static FORCEINLINE void fft5(FIXP_DBL *RESTRICT pDat)
                         ^
libFDK/src/fft.cpp:106:25: warning: always_inline function might not be inlinable [-Wattributes]
 static FORCEINLINE void fft3(FIXP_DBL *RESTRICT pDat)
                         ^
In file included from libFDK/src/fft.cpp:91:0:
./libFDK/include/fft.h:152:25: warning: always_inline function might not be inlinable [-Wattributes]
 static void FORCEINLINE fft_8(FIXP_DBL *x)
                         ^
./libFDK/include/fft.h:124:25: warning: always_inline function might not be inlinable [-Wattributes]
 static void FORCEINLINE fft_4(FIXP_DBL *x)
                         ^
CXX      libFDK/src/fft_rad2.lo

Compile in GNU/Linux Ubuntu 64bit GCC 4.8.4

Missing bitrate information on encoded videos

Hello, when i encode videos using this libraries (with ffmpeg or handbrake), the
output file is missing of information about encoded bitrate,

This cause various issues with several software.
I encode MKV files and I use Linux as OS.

Sorry for bad english.
Thanks in adavance and, in first, thanks for giving us a efficent aac encoder working also under linux.

Regards.

about LATM

Hello,

I have a problem in decoding AAC with LATM header. I can't find the frame size in LATM header. It's hard to understand LATM than ADTS .Can you give an example or some information?

Thanks in advance

Trouble with compiling aac-enc.c

I've trouble with compiling an example encoder. I linked with wavreader. But still no success. May I know the correct way to get aac-enc get running. I'm sorry for asking the compilation, I'm really in trouble. Thank you. What I did is
I run autoconf, ./configure, make
I run gcc -c -o wavreader.o wavreader.c
I run gcc aac-enc.c wavreader.o -o aac-enc
It failed.

static library

Hi
I want to use fdk-aac as a static library.
how i can make .a library from the source code.

bogus audio + spike when encoding gaples WAVs

Hey.

I have some WAV files from tracks from a CD which would play gapless, which does work perfectly when playing them back via mpv.
It also works when playing lame encoded MP3s from them, at least in mpv and on the ipod (many other players, e.g. mplayer or totem seem to not support gapless playback at all).

Since AAC is more advanced I tried to use that with fdkaac using version 0.6.2 and from libfdk-aac 0.1.4 with those commands:
fdkaac -p 2 -G 2 -m 5 1.wav -o fdkaac-lc-gap2-vbr5_1.m4a
fdkaac -p 2 -G 2 -m 5 2.wav -o fdkaac-lc-gap2-vbr5_2.m4a
(I also tried -p 5 and 29, and then everything with -G 0, but the problem looks just the same there).

When comparing the ends 1.wav with fdkaac-lc-gap2-vbr5_1.m4a it looks like this:
screenshot from 2015-09-02 23-38-33
(and the beginning of the to tracks is perfectly aligned)
As you can see, the AAC has some audio and a nasty spike added (the spike looks different for LC, HE and HE2).

Comparing the begins of 2.wav and the corresponding fdkaac-lc-gap2-vbr5_2.m4a doesn't show such problems.
The fdkaac-lc-gap2-vbr5_2.m4a is again a bit longer than 2.wav (which is of course explainable) but no bugs data seems to have been added at the end,... maybe because there was digital silence.

Long story short... that bogus audio+spike is quite a showstopper for anything not having digital silence in the end, especially gapless files.

Any ideas whether/how this could be fixed?

Cheers,
Chris.

assertion failure in GetInvInt() for 96kHz input + AACENC_BITRATEMODE: 5

As the title says, when trying to encode 96kHz input with AACENC_BITRATEMODE: 5 (VBR), fdk-aac crashes with an assertion failure.
Stack trace is as follows:

GetInvInt(int intValue=54)  Line 459 + 0x27 bytes
FDKaacEnc_prepareIntensityDecision(const long * sfbEnergyLeft=0x00dcfa1c, const long * sfbEnergyRight=0x00dd0750, const long * sfbEnergyLdDataLeft=0x00dbee58, const long * sfbEnergyLdDataRight=0x00dc13a8, const long * mdctSpectrumLeft=0x00dbcdb8, const long * mdctSpectrumRight=0x00dbf308, const INTENSITY_PARAMETERS * isParams=0x0038ddb8, long * hrrErr=0x0038dfcc, int * isMask=0x0038dcc0, long * realScale=0x0038dddc, long * normSfbLoudness=0x0038ded4, const int sfbCnt=48, const int sfbPerGroup=12, const int maxSfbPerGroup=12, const int * sfbOffset=0x00dd0470)  Line 331 + 0x21 bytes
FDKaacEnc_IntensityStereoProcessing(long * sfbEnergyLeft=0x00dcfa1c, long * sfbEnergyRight=0x00dd0750, long * mdctSpectrumLeft=0x00dbcdb8, long * mdctSpectrumRight=0x00dbf308, long * sfbThresholdLeft=0x00dcf83c, long * sfbThresholdRight=0x00dd0570, long * sfbThresholdLdDataRight=0x00dc11c8, long * sfbSpreadEnLeft=0x00dd028c, long * sfbSpreadEnRight=0x00dd0fc0, long * sfbEnergyLdDataLeft=0x00dbee58, long * sfbEnergyLdDataRight=0x00dc13a8, int * msDigest=0x00de82dc, int * msMask=0x00de82e0, const int sfbCnt=48, const int sfbPerGroup=12, const int maxSfbPerGroup=12, const int * sfbOffset=0x00dd0470, const int allowIS=1, int * isBook=0x00de4d68, int * isScale=0x00de4e58, PNS_DATA * * pnsData=0x0038ec74)  Line 629 + 0x50 bytes
FDKaacEnc_psyMain(int channels=2, PSY_ELEMENT * psyElement=0x0017ffa0, PSY_DYNAMIC * psyDynamic=0x00dcf838, PSY_CONFIGURATION * psyConf=0x00dd1be8, PSY_OUT_ELEMENT * psyOutElement=0x00de82d0, short * pInput=0x00d80068, int * chIdx=0x00dbcc8c, int totalChannels=2)  Line 1249 + 0x111 bytes
FDKaacEnc_EncodeFrame(AAC_ENC * hAacEnc=0x00dbcc68, TRANSPORTENC * hTpEnc=0x00df7b08, short * inputBuffer=0x00d80068, int * nOutBytes=0x0038f180, AACENC_EXT_PAYLOAD * extPayload=0x001761bc)  Line 744 + 0x5a bytes
aacEncEncode(AACENCODER * const hAacEncoder=0x001760b0, const AACENC_BufDesc * inBufDesc=0x0038f36c, const AACENC_BufDesc * outBufDesc=0x0038f350, const AACENC_InArgs * inargs=0x0038f340, AACENC_OutArgs * outargs=0x0038f32c)  Line 1632 + 0x30 bytes

GetAacDecoder(), Where is it declared and defined?

In fdk-aac/libAACdec/src/aacdecoder.cpp,

LINKSPEC_CPP HANDLE_AACDECODER CAacDecoder_Open(TRANSPORT_TYPE bsFormat)    /*!< bitstream format (adif,adts,loas,...). */
{
  HANDLE_AACDECODER self;

  self = GetAacDecoder();
  if (self == NULL) {
    goto bail;
  }
...
}

GetAacDecoder return NULL all the time.
I search in this respo, no file declare or define the function GetAacDecoder().

Where is GetAacDecoder() declared and defined?

Multichannel wav support via pipe

"/Users/selur/build-Hybrid.app/Contents/MacOS/ffmpeg" -y -threads 2 -v -10 -i "/Users/selur/Desktop/temp/iId_1_aid_1_07_29_14_4710_01.ac3" -ac 6 -ar 48000 -acodec pcm_s16le -f wav - | "/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/aac-enc" -r 128000 -t 5 - "/Users/selur/Desktop/temp/iId_1_aid_1_07_29_14_4710_02.aac"

gives me:

Unsupported WAV format 65534

Looks like aac-enc only support stereo wav files. (works fine if I downmix to stereo beforehand)
-> Would be nice if multichannel wav files could also be supported.

uploaded a the multi channel test file I used for testing to: http://www.multiupload.nl/Z75GN7Z6BX

AAC raw decode issue

I've slightly modified decoder example to support ADIF container, it is working well.
However decoder returns errors such as AAC_DEC_PARSE_ERROR when using it with AAC raw files as input.
Input AAC raw file has been encoded using aac-enc and aacDecoder_ConfigRaw set with buffer from aacEncInfo. After dumping the 2 bytes ASC from aacEncInfo, I got 0x11 0x90 (AACLC, @48khz, channel cfg 2) which seems to match with my input wav file parameters.
The resulting .aac file is well decoded with FAAD decoder ...
Does anyone manage to successfully decode AAC raw file ?

Thanks in advance

FDK bit buffer causes access violations

The FDK bit buffer implementation is broken in that it regularly reads past the provided buffer - seemingly as a performance optimization. This causes access violation errors if the bytes directly following the buffer belong to a protected page.

You can see this in action in Valgrind where you get lots of invalid access errors when decoding an AAC stream with libfdk: valgrind.txt

On Windows I get an access violation about once every 4000 files when converting AAC. Here's a dump I got using Dr. Mingw: fdk-aac-dump.txt

The code that causes the bug is basically:

unsigned char	*buffer	    = NIL;
unsigned int	 bufferSize = 0;

MP4ReadSample(mp4File, mp4Track, 1, (uint8_t **) &buffer, (uint32_t *) &bufferSize, NIL, NIL, NIL, NIL);

unsigned int	 bytesValid = bufferSize;
short		 outputBuffer[16384];

aacDecoder_Fill(handle, &buffer, &bufferSize, &bytesValid);
aacDecoder_DecodeFrame(handle, outputBuffer, 16384, 0);

MP4Free(buffer);

I'm working around this bug in my software by copying the bytes returned from MP4ReadSample to a new buffer that is 4 bytes larger than the original one, thereby making sure FDK_get will not access protected pages:

unsigned char	*buffer	    = NIL;
unsigned int	 bufferSize = 0;

MP4ReadSample(mp4File, mp4Track, 1, (uint8_t **) &buffer, (uint32_t *) &bufferSize, NIL, NIL, NIL, NIL);

unsigned int	 bytesValid = bufferSize;
unsigned char	*inputBuffer  = new unsigned char [bufferSize + 4];
short		 outputBuffer[16384];

memcpy(inputBuffer, buffer, bufferSize);

aacDecoder_Fill(handle, &inputBuffer, &bufferSize, &bytesValid);
aacDecoder_DecodeFrame(handle, outputBuffer, 16384, 0);

delete [] inputBuffer;

MP4Free(buffer);

It would be great if this could be fixed in libfdk!

It does not seem to be easy, however. The bit buffer would need to know the actual buffer size, but transportDec_FillData always initializes it with 65536 instead of passing bufferSize, because "the FDK bit buffer implementation needs a number 2^x" which seems quite obscure to me.

testing read-streamed-wav

read https://sourceforge.net/p/opencore-amr/mailman/message/31945744/ and just tested:

1 - created fifo:

mkfifo -m 777 /Users/selur/Desktop/temp/HybridTempPipe_08_04_53_9610_02_audio.wav

2 - connected main process to pipe:

"/Users/selur/aac-enc" -r 128000 -t 2 "/Users/selur/TempPipe_08_04_53_9610_02_audio.wav" "/Users/selur/Desktop/temp/iId_1_aid_0_DELAY_-43ms_08_04_53_9610_02.aac"

3 - decode file and feed pipe:

"/Users/selur/ ffmpeg" -y -threads 2 -v -10 -i "/Users/selur/Desktop/temp/iId_1_aid_0_DELAY_-43ms_08_04_53_9610_01.aac" -ac 2 -ar 44100 -f sox - | "/Users/selur/sox" --multi-threaded --ignore-length --temp "/Users/selur/Desktop/temp" --buffer 524288 -S -t sox - -b 16 -t wav "/Users/selur/Desktop/temp/TempPipe_08_04_53_9610_02_audio.wav" rate 48k

(the sox part is used to make sure the output is 16 bit wav)
Problem is that the output is only 682 byte large.

My guess is that something like 'ignore length' might be needed. (since the header of the wave sox will output, will have a wrong length)
If I don't use the named pipe but simply use intermediate files everything works, so seems to me that the pipe support isn't working. :(

Cu Selur

Random Seed

Hi,

I've found this line in the decoder module (aacdec_pns.cpp, line 271), which is supposed to calculate some noise signal:

randomState = (1664525L * randomState) + 1013904223L; // Numerical Recipes

Does anyone know how were the constants determined?
I intend to port the code to 24 bit and I'm unsure if a truncation could make the seeding algorithm behave other than intended.

Thanks

stream encoded with profile - aac_he_v2 - not playing in flash players

I try encode live audio stream with following command

ffmpeg -v quiet -f alsa -ac 10 -ar 44100 -i pcm.traktor  -vn \
-map_channel 0.0.0 -map_channel 0.0.1 -c:a libfdk_aac -profile:a aac_he_v2 -b:a 56k -f flv rtmp://localhost/live/europe-56 \
-map_channel 0.0.0 -map_channel 0.0.1 -c:a libfdk_aac -profile:a aac_he_v2 -b:a 24k -f flv rtmp://localhost/live/europe-24

These streams succefully played in vlc player(http://videolan.org/), but in flash player, on the web page, fails. When i change codec to libaacplus, all work in flash too. libfdk_aac from ubuntu repositories, not from sources.
P.S. Sorry for bad english, i'm russian.

decoder example

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.

implementation of "mpegFileRead.h" ?

I am trying to use this library to decode aac files, and I want to use the folowing helper functions

 mpegFileRead_Open
 mpegFileRead_GetTransportType

defined in

 libMpegTPDec/include/mpegFileRead.h

However, I haven't been able to find any implementations in any of the source files. Why are they missing?
Any help would be much appreciated!

Getting error when compiling

Hi,

I'm getting "bash: ./configure: No such file or directory" error after cloning repo.

Why I'm getting this?

Fails to compile on GCC 6.1 mingw-w64

A user reported that with GCC 6.1.0 and mingw-w64 fdk-aac fails to compile.

libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2180108801u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2435191937u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2914591489u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '3560484608u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2147483649u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2276992735u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2649899348u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '3221225445u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '3922060664u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2156644481u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2229462401u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2372618753u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2581238273u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2848216833u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3164462721u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3519206656u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3900368192u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2147483649u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2184048624u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2292498406u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2469139869u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2707957698u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3000819239u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3337751441u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3707280484u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '4096822497u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]

I'm not 100% certain if this is a GCC bug or not.

Full log is available at https://gist.githubusercontent.com/starius/f0a78ec2f1fbe92d92f250e4ff22bc51/raw/cbf726fb7702c5719662ed1cff14d3c346a3092e/fdk-aac_x86_64-w64-mingw32.shared

quantized coefficients in encoder and decoder

I've tried to compare the quantized coefficients SHORT *quantSpectrum values and decoded values from huffman decoder, FIXP_DBL *mdctSpectrum for each frame. I watched frame 1 and frame 2. The last coefficients are the same in encoder and decoder. But the beginning coefficients are not the same. Are quantized coefficients supposed to be the same in both encoder and decoder? May I know some heads-up? I'm confused. I thought I am going to get the same coefficients in the decoder after huffman decoding. Thank you.

Assert in fixpoint_math.cpp - libfdk-aac-0.1.4

Thread 19 "ghb" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffc77fe700 (LWP 3063)]
0x00007fffed8fbe55 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54    return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0  0x00007fffed8fbe55 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007fffed8fda5a in __GI_abort () at abort.c:89
#2  0x00007fffed8f46f7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7ffff7bc43cc "L_num >= (FIXP_DBL)0", 
    file=file@entry=0x7ffff7bc4373 "libFDK/src/fixpoint_math.cpp", line=line@entry=546, 
    function=function@entry=0x7ffff7bc4640 <fDivNorm(int, int, int*)::__PRETTY_FUNCTION__> "FIXP_DBL fDivNorm(FIXP_DBL, FIXP_DBL, INT*)") at assert.c:92
#3  0x00007fffed8f47a2 in __GI___assert_fail (assertion=assertion@entry=0x7ffff7bc43cc "L_num >= (FIXP_DBL)0", 
    file=file@entry=0x7ffff7bc4373 "libFDK/src/fixpoint_math.cpp", line=line@entry=546, 
    function=function@entry=0x7ffff7bc4640 <fDivNorm(int, int, int*)::__PRETTY_FUNCTION__> "FIXP_DBL fDivNorm(FIXP_DBL, FIXP_DBL, INT*)") at assert.c:101
#4  0x00007ffff7ba1a9b in fDivNorm (L_num=<optimized out>, L_denum=<optimized out>, result_e=<optimized out>) at libFDK/src/fixpoint_math.cpp:546
#5  0x00007ffff7b434f5 in FDKaacEnc_initMinSnr (sfbMinSnrLdData=<optimized out>, blockType=2, sfbActive=12, sfbOffset=0x7fffb40ee4f0, numLines=128, samplerate=48000, 
    bitrate=80000) at libAACenc/src/psy_configuration.cpp:516
#6  FDKaacEnc_InitPsyConfiguration (bitrate=bitrate@entry=80000, samplerate=samplerate@entry=48000, bandwidth=bandwidth@entry=16120, blocktype=blocktype@entry=2, 
    granuleLength=1024, useIS=useIS@entry=1, psyConf=0x7fffb40ee4e4, filterbank=FB_LC) at libAACenc/src/psy_configuration.cpp:652
#7  0x00007ffff7b4e6f5 in FDKaacEnc_psyMainInit (hPsy=0x7fffb40eddb0, audioObjectType=AOT_AAC_LC, cm=cm@entry=0x7fffb403b39c, sampleRate=48000, 
    granuleLength=<optimized out>, bitRate=bitRate@entry=160000, tnsMask=15, bandwidth=16120, usePns=1, useIS=1, syntaxFlags=0, initFlags=1)
    at libAACenc/src/psy_main.cpp:355
#8  0x00007ffff7b3c5ee in FDKaacEnc_Initialize (hAacEnc=0x7fffb403b390, config=config@entry=0x7fffb4031514, hTpEnc=0x7fffb40ff500, initFlags=initFlags@entry=1)
    at libAACenc/src/aacenc.cpp:548
#9  0x00007ffff7b46843 in aacEncInit (hAacEncoder=hAacEncoder@entry=0x7fffb4031490, InitFlags=<optimized out>, config=config@entry=0x7fffb4031490)
    at libAACenc/src/aacenc_lib.cpp:1160
#10 0x00007ffff7b48198 in aacEncEncode (hAacEncoder=0x7fffb4031490, inBufDesc=0x0, outBufDesc=0x0, inargs=0x0, outargs=0x0) at libAACenc/src/aacenc_lib.cpp:1434
#11 0x00007ffff62a909a in aac_encode_init () from /lib64/libavcodec.so.57
#12 0x00007ffff66c1002 in avcodec_open2 () from /lib64/libavcodec.so.57
#13 0x0000000000464f7f in encavcodecaInit ()
#14 0x000000000049ac7c in work_func ()
#15 0x000000000046adcb in hb_thread_func ()
#16 0x00007ffff262e5ba in start_thread (arg=0x7fffc77fe700) at pthread_create.c:333
#17 0x00007fffed9ca7cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

This happens 100% when ripping a specific dvd with handbreak.
If I do:
(gdb) break libFDK/src/fixpoint_math.cpp:542 if L_num < 0

I see the following parameters being passed:
Thread 16 "ghb" hit Breakpoint 1, fDivNorm (L_num=-2147483648, L_denum=1030750208, result_e=0x7fffaf15e174) at libFDK/src/fixpoint_math.cpp:542

Unify the shared library version and package version?

There are many version numbers out there when it comes to FDK. Here is a list I've tried to maintain: http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Software_Versions

I was wondering if you would consider unifying the shared library version with your package version to reduce the population of version numbers by one.

Now that the so version is 1.0.0, the binary package 0.1.4 in debian will be libfdk_aac1, and libfdk_aac0 will remain based on 0.1.3 for whatever might be depending on it. The idea would be to make the next package version match the so version at 1.0.0, to maybe reduce confusion a little.

Libtool library used but `LIBTOOL' is undefined

Hi

im trying to install this on centos 5.

I run the following

git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --disable-shared

but get the following error

autoreconf: Entering directory .' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf --force autoreconf: configure.ac: not using Autoheader autoreconf: running: automake --add-missing --copy --force-missing Makefile.am:31: Libtool library used butLIBTOOL' is undefined
Makefile.am:31:
Makefile.am:31: The usual way to define LIBTOOL' is to addAC_PROG_LIBTOOL'
Makefile.am:31: to configure.ac' and runaclocal' and autoconf' again. Makefile.am: C objects in subdir butAM_PROG_CC_C_O' not in `configure.ac'
autoreconf: automake failed with exit status: 1

Can you advise on what I should be doing?

Thanks for any help

Cant install on centos 5.9

Hi

I seem to be getting a error when trying to install on centos 5.9 been try to install ffmpeg with libfdk_aac for nearly two days now ;(.

i have been following this tutorial
http://ffmpeg.org/trac/ffmpeg/wiki/CentosCompilationGuide#libfdk_aac

I have seen the bug with centos and have downloaded the latest from
http://sourceforge.net/projects/opencore-amr/files/fdk-aac/

and also tried commenting out the line

# libfdk_aac_la_LINK = $(LINK) $(libfdk_aac_la_LDFLAGS)

and when i run

autoreconf -fiv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
Makefile.am: C objects in subdir but `AM_PROG_CC_C_O' not in `configure.ac'
autoreconf: automake failed with exit status: 1

i get that issue

any help please really want this option to encode videos correctly for web i want to run this command.

from this tut - https://www.virag.si/2012/01/web-video-encoding-tutorial-with-ffmpeg-0-9/

ffmpeg -i input_file.avi -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -acodec libfdk_aac -b:a 128k output_file.mp4

AAC frame size in frequency domain

Hi All,

I wanted to know that what is the frame size in frequency domain?
I am dumping 1024 samples of *pSpectralCoefficient. Is that correct?
Is it possible that some frames are 1024 in length and others are a set 0f 8 frames with 128 frequency bins. If it is possible, then is there any flag that can give me this information ?

Request you to please answer my queries (this one and the previous one: #31).

Thank you for your time.

Regards,
Akshay Malhotra

Encoded file wrong length and speed.

I'm trying to encode some audio and having a problem. A 10 second input file becomes 7.17 seconds after encoding. I can confirm that the input file is 48kHz PCM. Playing back the encoded file, I can hear that the entire file is there, but the playback rate is faster. If anybody has any ideas about what I've done wrong here, any help is appreciated. Here are my encoder parameters:

HANDLE_AACENCODER encoder_handle = NULL;
  if (aacEncOpen(&encoder_handle, 0, 2) != AACENC_OK) {
    fprintf(stderr, "Unable to open encoder\n");
    return 1;
  }
if (aacEncoder_SetParam(encoder_handle, AACENC_AOT, 2) != AACENC_OK) {
    fprintf(stderr, "Unable to set the AOT\n");
    return 1;
  }
  if (aacEncoder_SetParam(encoder_handle, AACENC_SAMPLERATE, 48000) != AACENC_OK) {
    fprintf(stderr, "Unable to set the sample rate\n");
    return 1;
  }
  if (aacEncoder_SetParam(encoder_handle, AACENC_CHANNELMODE, MODE_2) != AACENC_OK) {
    fprintf(stderr, "Unable to set the channel mode\n");
    return 1;
  }
  if (aacEncoder_SetParam(encoder_handle, AACENC_CHANNELORDER, 1) != AACENC_OK) {
    fprintf(stderr, "Unable to set the wav channel order\n");
    return 1;
  }
  if (aacEncoder_SetParam(encoder_handle, AACENC_BITRATE, 576000) != AACENC_OK) {
      fprintf(stderr, "Unable to set the bitrate\n");
      return 1;
    }
  if (aacEncoder_SetParam(encoder_handle, AACENC_TRANSMUX, 2) != AACENC_OK) {
    fprintf(stderr, "Unable to set the ADTS transmux\n");
    return 1;
  }
  if (aacEncoder_SetParam(encoder_handle, AACENC_AFTERBURNER, 1) != AACENC_OK) {
    fprintf(stderr, "Unable to set the afterburner mode\n");
    return 1;
  }
  if (aacEncEncode(encoder_handle, NULL, NULL, NULL, NULL) != AACENC_OK) {
    fprintf(stderr, "Unable to initialize the encoder\n");
    return 1;
  }

Here's what ffprobe says about the output file:

[aac @ 0x7f951980da00] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'out.aac':
Duration: 00:00:07.17, bitrate: 576 kb/s
Stream #0:0: Audio: aac, 48000 Hz, stereo, fltp, 576 kb/s

Thanks!

error during make

 Finished prerequisites of target file `libfdk-aac.la'.
Must remake target `libfdk-aac.la'.

/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o libfdk-aac.la -version-info 0:2:0 -no-undefined -export-symbols ./fdk-aac.sym -rpath /usr/local/lib -version-info 0:2:0 -no-undefined -export-symbols ./fdk-aac.sym libAACdec/src/aacdec_drc.lo libAACdec/src/aacdec_hcr.lo libAACdec/src/aacdecoder.lo libAACdec/src/aacdec_pns.lo libAACdec/src/aac_ram.lo libAACdec/src/block.lo libAACdec/src/channelinfo.lo libAACdec/src/ldfiltbank.lo libAACdec/src/rvlcbit.lo libAACdec/src/rvlc.lo libAACdec/src/aacdec_hcr_bit.lo libAACdec/src/aacdec_hcrs.lo libAACdec/src/aacdecoder_lib.lo libAACdec/src/aacdec_tns.lo libAACdec/src/aac_rom.lo libAACdec/src/channel.lo libAACdec/src/conceal.lo libAACdec/src/pulsedata.lo libAACdec/src/rvlcconceal.lo libAACdec/src/stereo.lo libAACenc/src/aacenc.lo libAACenc/src/aacEnc_ram.lo libAACenc/src/band_nrg.lo libAACenc/src/block_switch.lo libAACenc/src/grp_data.lo libAACenc/src/metadata_main.lo libAACenc/src/pre_echo_control.lo libAACenc/src/quantize.lo libAACenc/src/tonality.lo libAACenc/src/aacenc_hcr.lo libAACenc/src/aacEnc_rom.lo libAACenc/src/bandwidth.lo libAACenc/src/channel_map.lo libAACenc/src/intensity.lo libAACenc/src/ms_stereo.lo libAACenc/src/psy_configuration.lo libAACenc/src/sf_estim.lo libAACenc/src/transform.lo libAACenc/src/aacenc_lib.lo libAACenc/src/aacenc_tns.lo libAACenc/src/bit_cnt.lo libAACenc/src/chaosmeasure.lo libAACenc/src/line_pe.lo libAACenc/src/noisedet.lo libAACenc/src/psy_main.lo libAACenc/src/spreading.lo libAACenc/src/aacenc_pns.lo libAACenc/src/adj_thr.lo libAACenc/src/bitenc.lo libAACenc/src/dyn_bits.lo libAACenc/src/metadata_compressor.lo libAACenc/src/pnsparam.lo libAACenc/src/qc_main.lo libMpegTPDec/src/tpdec_adif.lo libMpegTPDec/src/tpdec_adts.lo libMpegTPDec/src/tpdec_asc.lo libMpegTPDec/src/tpdec_latm.lo libMpegTPDec/src/tpdec_lib.lo libMpegTPEnc/src/tpenc_adif.lo libMpegTPEnc/src/tpenc_adts.lo libMpegTPEnc/src/tpenc_asc.lo libMpegTPEnc/src/tpenc_latm.lo libMpegTPEnc/src/tpenc_lib.lo libSBRdec/src/env_calc.lo libSBRdec/src/env_dec.lo libSBRdec/src/env_extr.lo libSBRdec/src/huff_dec.lo libSBRdec/src/lpp_tran.lo libSBRdec/src/psbitdec.lo libSBRdec/src/psdec.lo libSBRdec/src/psdec_hybrid.lo libSBRdec/src/sbr_crc.lo libSBRdec/src/sbr_deb.lo libSBRdec/src/sbr_dec.lo libSBRdec/src/sbrdec_drc.lo libSBRdec/src/sbrdec_freq_sca.lo libSBRdec/src/sbrdecoder.lo libSBRdec/src/sbr_ram.lo libSBRdec/src/sbr_rom.lo libSBRenc/src/bit_sbr.lo libSBRenc/src/env_bit.lo libSBRenc/src/fram_gen.lo libSBRenc/src/mh_det.lo libSBRenc/src/ps_bitenc.lo libSBRenc/src/ps_encode.lo libSBRenc/src/resampler.lo libSBRenc/src/sbr_encoder.lo libSBRenc/src/sbr_ram.lo libSBRenc/src/ton_corr.lo libSBRenc/src/code_env.lo libSBRenc/src/env_est.lo libSBRenc/src/invf_est.lo libSBRenc/src/nf_est.lo libSBRenc/src/ps_main.lo libSBRenc/src/sbrenc_freq_sca.lo libSBRenc/src/sbr_misc.lo libSBRenc/src/sbr_rom.lo libSBRenc/src/tran_det.lo libPCMutils/src/pcmutils_lib.lo libFDK/src/autocorr2nd.lo libFDK/src/dct.lo libFDK/src/FDK_bitbuffer.lo libFDK/src/FDK_core.lo libFDK/src/FDK_crc.lo libFDK/src/FDK_hybrid.lo libFDK/src/FDK_tools_rom.lo libFDK/src/FDK_trigFcts.lo libFDK/src/fft.lo libFDK/src/fft_rad2.lo libFDK/src/fixpoint_math.lo libFDK/src/mdct.lo libFDK/src/qmf.lo libFDK/src/scale.lo libSYS/src/cmdl_parser.lo libSYS/src/conv_string.lo libSYS/src/genericStds.lo libSYS/src/wav_file.lo -lm
Putting child 0x057530e0 (libfdk-aac.la) PID 16143 on the chain.
Live child 0x057530e0 (libfdk-aac.la) PID 16143
libtool: link: more than one -exported-symbols argument is not allowed
Reaping losing child 0x057530e0 PID 16143
make: *** [libfdk-aac.la] Error 1
Removing child 0x057530e0 PID 16143 from chain.

libfdk-aac + FFmpeg + Decklink capture card

I am using fdk-aac (Git) + FFmpeg (Git) + BMD SDK 10.8
I use above combination to capture video and audio from pristine source.

Encoded audio is choppy and has popping noice.
Please advise.

Thanks

Optimizing for ARM/NEON

I noticed that none of the files in libFDK/src/arm are included when compiling, is there any flag I need to set for these files to get included? I'm assuming those files need to be included to be fully optimized for ARM processors?

I'm trying to compile for a Raspberry PI 2, and when used with FFMPEG the cpu usage is ~80%. I'm hoping to get that down with a version compiled to take advantage of NEON.

cross compilation error

I'm building it for android. Configuration is Okay. When I make, i got this error,
arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: libAACdec/src/.libs/aacdec_drc.o:1:1: invalid character
This error happened in all files of generated .libs for both libAACenc and libAACdec. I'm on Yosemite. I did this way.
./configure --host=arm-linux --enable-shared --enable-static --enable-example
I used standalone androideabi compilor. I did my homework searching in google first. But I could not fix it and I've to ask you again. I'm sorry.

Access Huffman encoded and decoded data

Hi,

I want to access the spectral data before and after Huffman encoding/decoding in the encoder and in the decoder.
For accessing spectral data before Huffman encoding, I am using pSpectralCoefficient pointer and dumping 1024 samples (on the decoder side) and using qcOutChannel[ch]->quantSpec and dumping 1024 samples (on the encoder side). Is this correct?

Secondly, how do access the Huffman encoded signal in the encoder and decoder. If someone can tell me the location in the code and the name of the pointer to use and the length of this data, I will be extremely thankful.

Thanks in adavnce.

Regards,
Akshay

Input Buffer PCM Format

Docs are unclear. What kind of PCM should the input buffer be filled with for encoding? 16-bit signed INTs? Does endianness matter?

The required sample bitrate (represented by the data type INT_PCM which is 16, 24 or 32 bits wide) is
fixed and depends on library configuration (usually 16 bit).

Thanks!

Decoder and/or encoder has a delay causing shift and clip of the input data

If you transcode an input aac file, the ouput aac has a blank gap at the beginning and it is clipped at the end.

To emphasize this effect I put together a sample code that transcodes an input aac file multiple times. As you increase the number of transcode loops, the audio gap at the beginning and the clip at the end becomes more prominent, eventually yielding a no-sound file.

#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>

#include "libAACdec/include/aacdecoder_lib.h"
#include "libAACenc/include/aacenc_lib.h"

void usage(const char* name) {
    fprintf(stderr, "%s in.aac loops\n", name);
}

int main(int argc, char *argv[]) {
    FILE *in, *out;
    HANDLE_AACDECODER dec;
    HANDLE_AACENCODER enc;
    char infile[256];
    char outfile[256];

    /* Fixed parameters */
    int bitrate = 192 * 1024;
    int sample_rate = 44100;

    /* Input parameters */
    if (argc != 3) {
        usage(argv[0]);
        return 1;
    }

    sprintf(infile, "%s", argv[1]);
    int loops = atoi(argv[2]);
    if (loops <= 0 || loops > 100) {
        fprintf(stderr, "loops parameter have to be [1-100]\n");
        return 1;
    }

    /* Create buffers */
    uint8_t in_packet[10240];
    uint8_t out_packet[10240];
    int16_t pcm[8*2*1024];

    for (int i=0; i<loops; i++) {

        /* Create decoder */
        dec = aacDecoder_Open(TT_MP4_ADTS, 1);
        if (aacDecoder_SetParam(dec, AAC_CONCEAL_METHOD, 1) != AAC_DEC_OK) return 1;
        if (i) sprintf(infile, "%d.aac", i%2);

        in = fopen(infile, "rb");
        if (!in) {
            perror(infile);
            return 1;
        }

        /* Transcode all ADTS packets */
        while (1) {
            int pcm_size;

            /* Read an ADTS packet */
            uint8_t* in_packet_ptr = in_packet;
            int n = fread(in_packet, 1, 7, in);
            if (n != 7) break;
            if (in_packet[0] != 0xff || (in_packet[1] & 0xf0) != 0xf0) break;
            UINT in_packet_size = ((in_packet[3] & 0x03) << 11) | (in_packet[4] << 3) | (in_packet[5] >> 5);
            n = fread(in_packet + 7, 1, in_packet_size - 7, in);
            if (n != in_packet_size - 7) break;

            /* Decode the ADTS packet */
            UINT valid = in_packet_size;
            if (aacDecoder_Fill(dec, &in_packet_ptr, &in_packet_size, &valid) != AAC_DEC_OK) break;
            AAC_DECODER_ERROR dec_err = aacDecoder_DecodeFrame(dec, pcm, sizeof(pcm), 0);
            if (dec_err == AAC_DEC_NOT_ENOUGH_BITS) continue;
            if (dec_err != AAC_DEC_OK) continue;

            /* Create encoder lazily */
            if (!enc) {
                CStreamInfo *dec_info = aacDecoder_GetStreamInfo(dec);
                if (!dec_info || dec_info->sampleRate <= 0) break;
                int channels = dec_info->numChannels;
                pcm_size = dec_info->frameSize * dec_info->numChannels;

                if (aacEncOpen(&enc, 0, channels) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_AOT, 2) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_SBR_MODE, 0) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_SAMPLERATE, sample_rate) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_CHANNELMODE, 1) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_CHANNELORDER, 1) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_BITRATE, bitrate) != AACENC_OK) return 1;
                if (aacEncoder_SetParam(enc, AACENC_TRANSMUX, 2) != AACENC_OK) return 1;

                if (aacEncEncode(enc, NULL, NULL, NULL, NULL) != AACENC_OK) return 1;

                sprintf(outfile, "%d.aac", (i+1)%2);
                out = fopen(outfile, "wb");
                if (!out) {
                    perror(outfile);
                    return 1;
                }
            }

            /* Rencode the decoded PCM data */
            void* in_ptr = pcm;
            int in_size = pcm_size * sizeof(int16_t);
            int in_elem_size = sizeof(int16_t);
            int in_identifier = IN_AUDIO_DATA;

            AACENC_InArgs in_args = { 0 };
            in_args.numInSamples = pcm_size;

            AACENC_BufDesc in_buf = { 0 };
            in_buf.numBufs = 1;
            in_buf.bufs = &in_ptr;
            in_buf.bufferIdentifiers = &in_identifier;
            in_buf.bufSizes = &in_size;
            in_buf.bufElSizes = &in_elem_size;

            void* out_ptr = out_packet;
            int out_size = sizeof(out_packet);
            int out_elem_size = sizeof(uint8_t);
            int out_identifier = OUT_BITSTREAM_DATA;

            AACENC_BufDesc out_buf = { 0 };
            out_buf.numBufs = 1;
            out_buf.bufs = &out_ptr;
            out_buf.bufferIdentifiers = &out_identifier;
            out_buf.bufSizes = &out_size;
            out_buf.bufElSizes = &out_elem_size;

            AACENC_OutArgs out_args = { 0 };
            AACENC_ERROR enc_err;
            if ((enc_err = aacEncEncode(enc, &in_buf, &out_buf, &in_args, &out_args)) != AACENC_OK) {
                if (enc_err == AACENC_ENCODE_EOF) break;
                return 1;
            }
            if (out_args.numOutBytes == 0) continue;
            fwrite(out_packet, 1, out_args.numOutBytes, out);
        }
        fclose(out);
        aacEncClose(&enc);
        enc = NULL;

        fclose(in);
        aacDecoder_Close(dec);
    }

    return 0;
}

Libfdk crashed to encode specific file

Libfdk failed to encode following file
https://drive.google.com/file/d/0B1M0AqE6GJyBNUFEYUlrdDJCUW8/view?usp=sharing

the problem reproduced with our application and with ffmpeg. ffmpeg command line is

ffmpeg -i 2017-03-11_14:07:11.mkv -vn -c:a libfdk_aac -profile:a aac_he_v2 -b:a 32k 2017-03-11_14:07:11.ts

unfortunately if we cut the file problem not reproduced so please start the command above and wait till encoder move to 00:37:00. As we don't add -re encoder will reach 00:37:00 in two minutes.
then it crash with following stack
ffmpeg: libFDK/src/fixpoint_math.cpp:439: FIXP_DBL invSqrtNorm2(FIXP_DBL, INT*): Assertion `val > (FIXP_DBL)( ( (0.0) >= 0) ? ((( (double)(0.0) * (((INT64(1)<<(32-1)))) + 0.5 ) >= (double)(((signed)0x7FFFFFFF)) ) ? (INT)(((signed)0x7FFFFFFF)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) + 0.5)) : ((( (double)(0.0) * (((INT64(1)<<(32-1)))) - 0.5) <= (double)(((signed)0x80000000)) ) ? (INT)(((signed)0x80000000)) : (INT)( (double)(0.0) * (double)(((INT64(1)<<(32-1)))) - 0.5)) )' failed.
Aborted (core dumped)

we have the same stack in our application without ffmpeg so it's definitely FDK issue.
If we add -af "volume=0.90" so we modify a little incoming audio stream problem is not reproduced

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.