AAC decoding in FFmpeg for Android

I am trying to decode an M4A file on an Android device using AAC.

I use the following code to initialize the codec.

codec = avcodec_find_decoder(CODEC_ID_AAC); c= avcodec_alloc_context(); avcodec_open(c, codec); 

However, when I later try to decode the frame using:

 len = avcodec_decode_audio3(c, (short *)mOutbuf, &out_size, &avpkt); 

I get -1 (indicates an error) and the following in the log.

 10-11 16:30:01.115: INFO/M4ADecoder(5260): channel element 0.0 is not allocated 10-11 16:30:02.195: INFO/M4ADecoder(5260): channel element 2.0 is not allocated 10-11 16:30:03.295: INFO/M4ADecoder(5260): channel element 0.6 is not allocated 10-11 16:30:07.645: INFO/M4ADecoder(5260): Sample rate index in program config element does not match the sample rate index configured by the container. 10-11 16:30:07.655: INFO/M4ADecoder(5260): Number of bands (3) exceeds limit (2). 

Are there any other steps I need to take when setting up the codec? Do I need to prepare a file before sending data to an AAC decoder?

The same file works fine with the latest ffmpeg code on Mac OSX (i.e. ffmpeg -i filename.m4a).

+4
source share
1 answer

The command line exec on android on the phone is working fine (ffmpeg m4a to flac)

http://pastebin.com/3ZH3HQKc

above is stdout for ffmpeg on Android 4.1.1, running on GNexus ...

details of ffmpeg conversion (m4a / aac to flac / flac):

the ffmpeg executable is used, not the libavcodec c program call

+1
source

Source: https://habr.com/ru/post/1439273/


All Articles