Closed prashantrar closed 7 years ago
What does ffmpeg -i ../sugar.m4a
say? In m4a-dec.c
, try adding debug printfs showing what values in->nb_streams
has got and what values in->streams[i]->codec->codec_id
get for those sterams.
The number of streams are 1 but it reports codec id as 0. I tried multiple m4a files downloaded from the internet as well. For most of them it identifies the number of streams but codec id is reported as 0.
Also ffmpeg -i for sugar.m4a gave me this result.
prashantravi@mini:~$ ffmpeg -i /media/sf_Shared/sugar.m4a
ffmpeg version N-86233-g504d580 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration:
libavutil 55. 63.100 / 55. 63.100
libavcodec 57. 96.101 / 57. 96.101
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 90.100 / 6. 90.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/sf_Shared/sugar.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: isomiso2
encoder : Lavf57.72.101
Duration: 00:05:01.37, start: 0.000000, bitrate: 128 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
At least one output file must be specified
Try adding avformat_find_stream_info(in, NULL);
after avformat_open_input
, before the for (i = 0; i < in->nb_streams && !st; i++) {
loop.
Getting the same issue
streams: 1 codec id:0 No AAC stream found
Does this example need a specific version of libav/ffmpeg? does it need to be linked to any other libraries other than the fdk-aac and the libavcodec library?
It shouldn't really require any specific version of libav/ffmpeg - it only needs to be linked to libavformat, but it might actually require that libavformat/libavcodec combo to support AAC decoding in itself.
gcc m4a-dec.c -o m4a-dec wavreader.c wavwriter.c -I./libAACdec/include -I./libAACenc/include -I./libFDK/include -I./libMpegTPDec/include -I./libMpegTPEnc/include -I./libPCMutils/include -I./libSBRdec/include -I./libSBRenc/include -I./libSYS/include ./.libs/libfdk-aac.a -lm -Wdeprecated-declarations -lavcodec -lavformat -lavutil
This is my compile command. Let me know if its ok
Is it possible to attach a sample m4a file to this thread so that I can test.
Try http://martin.st/temp/sine.m4a, this works with m4a-dec.c
for me, tested with the latest libavformat/libavcodec from ffmpeg. libav should work equally well.
Btw, if using ffmpeg instead of libav, you might want to add in->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
after the avformat_open_input
call.
The issue is fixed now. If i build the libavcodec libraries from the latest github source, it fails, but if I download the prebuilt libraries of libavcodec and libavformat usint apt-get install it is working fine. Any reason why this is happening?
That sounds like an incompatibility between the libavformat headers used for compilation vs the actual library used for linking and loaded at runtime. If you are linking shared libraries, it might pick up the wrong version at runtime, e.g. actually using the system provided libraries instead of the manually built ones you intended to use. You can use ldd m4a-dec
to see exactly which libraries it does load at runtime.
In any case, this is clearly not an fdk-aac issue at this point, so I'll close this issue.
Thanks a lot for the help. Appreciate it.
Hey just a random follow up question, is it possible to decode m4a without the use of libav and using only fdk-aac
Fdk-aac does not contain any code for parsing m4a files at all.
To do that, you need to use some external code for parsing m4a files; libavformat is one example of such code, but you should be able to use any other similar library.
I tried compiling the m4a-dec.c example but it is unable to decode any m4a files. I tried using m4a files encoded by ffmpeg abd I get the following errors.
prashantravi@mini:/media/sf_Shared/fdk-aac$ ./m4a-dec ../sugar.m4a ../out.wav No AAC stream found