I recently tried to upgrade the ffmpeg libraries I use in my Mac OS X application by downloading and compiling ffmpeg from source.
My code works correctly with pre-compiled libraries of the same version on windows.
On Mac OS X, the library appears to work (it can open the file and find the streams and codecs used), but when it gets to avcodec_find_decoder, this function always returns null.
The code has worked with an older version of the library (compiled a year ago on Mac OS X 10.5)
I configured fmpeg using
./configure --extra-cflags="-arch i386" --extra-ldflags='-arch i386' --arch=x86_32 --target-os=darwin --enable-cross-compile --disable-indev=jack --enable-shared --disable-static
I checked config.mak, and it appears to have the decoders for the file types I tried enabled (ogg, vorbis, avi, mkv, ...)
I also checked that the correct header files have been used and that the newly compiled library is used.
I have found only some older posts relating to this issue, but without any solution:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-January/021399.html
http://libav-users.943685.n4.nabble.com/avcodec-find-decoder-problem-td944800.html
Edit: checking further, it appears av_codec_next(NULL) returns null as well, which means there isn't a single codec available, or that first_avcodec in utils.c is not set (I actually haven't found at all where this variable is set, I would have assumed av_register_all, but I can't find it there)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…