Hi all,
Im trying to load the ffmpegs x64 libraries from a sub folder of my application, for instance, '.\bin64\', using the LoadFFMpegLibraries(). But it fails what ever I do the call.
I'm using the "ffmpeg" demo project. So, if I copy the dlls into the same direcoty as the final executable, the default mechanism to load the dlls works properly. But if I move the dll's into a subfolder and them call to LoadFFMpegLibraries('.\bin64\'), it fails for no reason.
[spoiler]
unit MainFrm;
//...
initialization
FFMpegDirectory := '.\bin32\';
LoadFFMpegLibraries(FFMpegDirectory);
end.
[/spoiler]
Have you any sugestion/idea why is this happening?
Thanks.
LoadFFMpegLibraries fails for a specific path
Re: LoadFFMpegLibraries fails for a specific path
Hi all,
After a few research about DLL loading. I've tryed to help the default mechanism to find out the dll into the subfolder, changing the PATH enviroemtn variablelike this:
[spoiler]initialization
if not init_ffmpeg then
begin
sEnvPath := GetEnvironmentVariable('PATH');
sEnvPath := '.\bin32\' + ';' + sEnvPath;
SetEnvironmentVariable('PATH', PWideChar(sEnvPath));
LoadFFMpegLibraries('');
end;
end.
[/spoiler]
This way I'm able to load all the dlls from a subfolder. Now my goal is to avoid to use this trick by understanding the dependencies between these DLLs. May be changing the order...
[spoiler]
dll_av_format := GetFFMpegLib(av_format, MaxVersion_av_format);
dll_av_codec := GetFFMpegLib(av_codec, MaxVersion_av_codec);
dll_av_util := GetFFMpegLib(av_util, MaxVersion_av_util);
dll_sws_lib := GetFFMpegLib(sws_lib, MaxVersion_sws_lib);
dll_swr_lib := GetFFMpegLib(swr_lib, MaxVersion_swr_lib);
[/spoiler]
we can finally load the dlls in one single step without having to modify the PATH.
Best regards,
After a few research about DLL loading. I've tryed to help the default mechanism to find out the dll into the subfolder, changing the PATH enviroemtn variablelike this:
[spoiler]initialization
if not init_ffmpeg then
begin
sEnvPath := GetEnvironmentVariable('PATH');
sEnvPath := '.\bin32\' + ';' + sEnvPath;
SetEnvironmentVariable('PATH', PWideChar(sEnvPath));
LoadFFMpegLibraries('');
end;
end.
[/spoiler]
This way I'm able to load all the dlls from a subfolder. Now my goal is to avoid to use this trick by understanding the dependencies between these DLLs. May be changing the order...
[spoiler]
dll_av_format := GetFFMpegLib(av_format, MaxVersion_av_format);
dll_av_codec := GetFFMpegLib(av_codec, MaxVersion_av_codec);
dll_av_util := GetFFMpegLib(av_util, MaxVersion_av_util);
dll_sws_lib := GetFFMpegLib(sws_lib, MaxVersion_sws_lib);
dll_swr_lib := GetFFMpegLib(swr_lib, MaxVersion_swr_lib);
[/spoiler]
we can finally load the dlls in one single step without having to modify the PATH.
Best regards,
Re: LoadFFMpegLibraries fails for a specific path
Hi all
Using "Dependency Walker" v2.2.6000 that's what I've found:
Best regards,
Using "Dependency Walker" v2.2.6000 that's what I've found:
- avcodec-58:
- swresample-3
- avutil-56
- avformat-58:
- avcodec-58
- avutil-56
- avutil-56:
- swresample-3:
- avutil-56
- swscale-3:
- avutil-56
- avutil-56,
- swscale-3,
- swresample-3,
- avcodec-58,
- avformat-58.
Best regards,
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: LoadFFMpegLibraries fails for a specific path
I think the best solution would be switching the current directory to the FFmpeg directory, load libraries, then switch the current directory back.