我是使用MSVC来编译的FFmpeg。
参考博文为:
https://blog.csdn.net/danjuan123/article/details/65444054
https://blog.csdn.net/longji/article/details/54891236
如果你需要使用MSVC的link.exe,请将msys2中的/usr/bin/link.exe改成link.exe.bak。
然后输入脚本
Windows 10 x64
./configure \
--toolchain=msvc \
--disable-programs \
--disable-d3d11va \
--disable-dxva2 \
--arch=x86_64 \
--enable-shared \
--enable-cross-compile \
--target-os=win32 \
--extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" \
--extra-ldflags="-APPCONTAINER WindowsApp.lib" \
--prefix=./Build/Windows10/x64
make clean
make
make install
Windows 10 x86
./configure \
--toolchain=msvc \
--disable-programs \
--disable-d3d11va \
--disable-dxva2 \
--arch=x86 \
--enable-shared \
--enable-cross-compile \
--target-os=win32 \
--extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" \
--extra-ldflags="-APPCONTAINER WindowsApp.lib" \
--prefix=./Build/Windows10/x86
make clean
make
make install
如果你要编译出exe文件,请删除disable-programs选项,并加上enable-ffmpeg
x64:
然后在fftools/ffmpeg.c中找到
void init_dynload(void)
{
#ifdef _WIN32
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
* current working directory from the DLL search path as a security pre-caution. */
SetDllDirectory("");
#endif
}
改成
void init_dynload(void)
{
#ifdef _WIN32
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
* current working directory from the DLL search path as a security pre-caution. */
SetDllDirectoryA("");
#endif
}
x86
SetDllDirectoryA("");和GetModuleHandleA(NULL)都要注释掉。