Ubuntu – Failure in FFMPEG compilation on Ubuntu 16.04 – recipe for target ‘libavcodec/libfdk-aacenc.o’ failed

ffmpeg

I had followed up the installation steps which was documented on https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu , and I had installed the FFMPEG with libfdk_aac support successfully on Ubuntu 16.04. Recently, when I want to setup again a new encoding ecosystem, I faced an error which looks like this:

CC libavcodec/libfdk-aacdec.o
In file included from /home/sn/ffmpeg_build/include/fdk-aac/aacdecoder_lib.h:457:0,
from libavcodec/libfdk-aacdec.c:20:

/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:735:30: warning: ‘FDKinitLibInfo’ defined but not used [-Wunused-function]
static FDK_AUDIO_INLINE void FDKinitLibInfo(LIB_INFO* info) {
^
/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:745:1: warning: ‘FDKlibInfo_getCapabilities’ defined but not used [-Wunused-function]
FDKlibInfo_getCapabilities(const LIB_INFO* info, FDK_MODULE_ID module_id) {
^

/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:757:29: warning: ‘FDKlibInfo_lookup’ defined but not used [-Wunused-function]
static FDK_AUDIO_INLINE INT FDKlibInfo_lookup(const LIB_INFO* info,
^

CC libavcodec/libfdk-aacenc.o
libavcodec/libfdk-aacenc.c: In function ‘aac_encode_init’:
libavcodec/libfdk-aacenc.c:293:34: error: ‘AACENC_InfoStruct {aka struct }’ has no member named ‘encoderDelay’
avctx->initial_padding = info.encoderDelay;
^

In file included from /home/sn/ffmpeg_build/include/fdk-aac/aacenc_lib.h:1026:0,
from libavcodec/libfdk-aacenc.c:20:
libavcodec/libfdk-aacenc.c: At top level:
/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:735:30: warning: ‘FDKinitLibInfo’ defined but not used [-Wunused-function]
static FDK_AUDIO_INLINE void FDKinitLibInfo(LIB_INFO* info) {
^

/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:745:1: warning: ‘FDKlibInfo_getCapabilities’ defined but not used [-Wunused-function]
FDKlibInfo_getCapabilities(const LIB_INFO* info, FDK_MODULE_ID module_id) {
^

/home/sn/ffmpeg_build/include/fdk-aac/FDK_audio.h:757:29: warning: ‘FDKlibInfo_lookup’ defined but not used [-Wunused-function]
static FDK_AUDIO_INLINE INT FDKlibInfo_lookup(const LIB_INFO* info,
^
ffbuild/common.mak:60: recipe for target 'libavcodec/libfdk-aacenc.o' failed
make: *** [libavcodec/libfdk-aacenc.o] Error 1

It seems that there is an update on libfdk or ffmpeg repository which causes this error.

Best Answer

After some investigations, I found an answer on ffmpeg mailing list. As mentioned on this http://www.ffmpeg-archive.org/ffmpeg-compilation-error-on-libfdk-acc-ubuntu16-04-td4685096.html, the error is raised due to an update on libfdk APIs. There is no ffmpeg release which could match with this new version of API list.

The reasonable solution until ffmpeg team update their codes, is downgrading libfdk. For doing this, you could change the installation instructions of libfdk on the https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu, as below:

cd ~/ffmpeg_sources && \
git -C fdk-aac pull 2> /dev/null || git clone --depth 11 https://github.com/mstorsjo/fdk-aac && \
cd fdk-aac && \
autoreconf -fiv && \
./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
make && \
make install

Note that we changed the depth parameter and set it to 11. This worked for current date of this answer. If any new commit or release package publish on the the future, you should increase the depth number to fit the proper version that you could compile ffmpeg with it.

Another solution which is reflected on https://github.com/mstorsjo/fdk-aac/issues/93 and also on http://www.ffmpeg-archive.org/ffmpeg-compilation-error-on-libfdk-acc-ubuntu16-04-td4685096.html is about applying a patch on the source code. The patch itself is accessible via https://github.com/libav/libav/commit/141c960e21d2860e354f9b90df136184dd00a9a8 . We have to manually open the source file in a text editor, go to the line number which is shown in the path and add the lines with + and delete the lines with -.