Page 1 of 1

Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Sat Feb 03, 2018 3:01 am
by srinutry
Hi,

My windows playback application uses FFMPEG APIs for decoding HEVC video (AVCodec), resizing (swscale) and resampling (swresample).

Till now, I am using avcodec-57.dll, swscale-4.dll and swresample-2.dll and my application is working fine. Now I planned to use the latest FFMPEG nightly builds in my application, which are avcodec-58.dll, swscale-5.dll and swresample-3.dll etc..

I replaced all the old FFMPEG include, stub libraries and dlls from the latest FFMPEG package and successfully built my application. Unfortunately when I run my application I am getting errors such as "The Procedure entry point swr_alloc_set_opts" could not be located in dynamic link library avformat-58.dll.

I linked avcodec.lib first followed by avformat.lib, swsresample.lib and other FFMPEG libs. Unfortunately, the application is only checking the first DLL and ignoring other DLLs and throwing the "Entrypoint" not found error.

I linked "swresample.lib" ahead of avcodec.lib in my application and ran the application. I am facing ""The Procedure entry point sws_getContext" is not found. This API is part of swscale-5.dll which is already available in the same folder where my application executable is.

Did I miss anything while upgrading to new FFMPEG version?

NOTE: I successfully upgraded my application with FFMPEG libraries such as AVCodec-55.dll etc.. to AvCodec-57.dll etc... But upgrade from avcodec-57.dll etc to avcodec-58.dll etc is an issue.

Request your help in resolving the runtime linking issue.

dependency walker report of my application is attached.

Thanks and Regards,
Sri

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Sat Feb 03, 2018 8:10 pm
by Zeranoe
Can you provide a minimal application that can replicate this?

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Mon Feb 12, 2018 6:50 am
by kileyi
Same prob here.
Tested on Win7 64 VS2017,the last working version is

https://ffmpeg.zeranoe.com/builds/win32 ... 32-dev.zip
https://ffmpeg.zeranoe.com/builds/win32 ... shared.zip

other version greater than 2017.11.11 and till now 2018.02.11,they all fail with "The Procedure entry point swr_alloc_set_opts" could not be located in dynamic link library avformat-58.dll.

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Mon Feb 12, 2018 11:49 am
by Zeranoe
kileyi wrote:
Mon Feb 12, 2018 6:50 am
Same prob here.
As I already asked of srinutry, can you provide a minimum code sample to reproduce?

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Wed Feb 14, 2018 4:42 am
by kileyi
OK,here is my test project with Visual Studio 2017 x86.

https://github.com/mindoff6502/FFMPEG_W ... ss_Example

The Fail one uses

ffmpeg-20180213-474194a-win32-dev.zip
ffmpeg-20180213-474194a-win32-shared.zip

The Success one uses

ffmpeg-20171111-3af2bf0-win32-dev.zip
ffmpeg-20171111-3af2bf0-win32-shared.zip

The dll all use the shared.zip bin folder of each version

The example is just a simple version of building FFPlay myself.
Don't know what's wrong,but the early version works for me,the newer one doesn't.

What I do is just pick 4 files from ffmpeg source code to Visual Studio Project.

cmdutils.c
cmdutils.h
config.h
ffplay.c

add the following to config.h to the head

#define FFMPEG_CONFIGURATION "--enable-static --prefix=./vs2017_build --enable-debug --toolchain=msvc"
#define FFMPEG_DATADIR "./vs2017_build/share/ffmpeg"
#define HAVE_COMMANDLINETOARGVW 1
#define CONFIG_SWSCALE 1

comment 3 line on cmdutils.c

//#include "compat/va_copy.h"
//#include "libavresample/avresample.h"
//#include "libavutil/libm.h"

add

#include <Windows.h>

to ffplay.c head

search SDL_OpenAudioDevice

add

CoInitialize(NULL);

before it,do the SDL DX Init thing

add

input_filename = "mv01.mp4\0";

before

if (!input_filename)

for debugging in Visual Studio

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Wed Feb 14, 2018 9:55 am
by Zeranoe
This seems to be an issue with the lib files. dlltool has been hit or miss building libs in my experience, so I might just remove them from the dev build.

You can fix this by rebuilding the lib files with MSVC's lib.exe (run from within the folder containing the def files):

Code: Select all

for %i in (*.def) do @for /f "delims=-" %j in ("%i") do @lib /nologo /def:%i /out:%j.lib

Re: Runtime linking issue with FFMPEG APIs with latest FFMPEG releases

Posted: Wed Feb 14, 2018 10:54 am
by kileyi
Thnaks,works fine now. :D