是否可以在 Windows 上构建 ffmpeg x64?

Is it possible to build ffmpeg x64 on Windows?

真正的答案可能是 "no",但还是要仔细检查一下。 有没有人能够在 Windows(VS2013 或 VS2015)上构建 ffmpeg x64?我知道如果不进行大量修改,就不可能使用公开可用的资源。但是,如果有人做到了并且他愿意分享一些技巧...

编辑: 有趣的是,运行 "configure" 所需的大多数 x64 工具是如何在没有依赖性的情况下分发的,而且不可能在任何地方获得它们。看起来像专业的拖钓。

编辑2: 有成千上万个这样的错误:

fatal error C1083: Cannot open include file: 'features.h': No such file or directory

features.h 与许多其他头文件一样丢失。是否有解决办法,或者切换到 Linux 是唯一的选择?

假设 x64 是指标准的 64 位版本,是的,这是可能的。请参阅 fate page for all tested builds of FFmpeg, there's various 32- and 64-bit versions of Visual Studio in that list, including VS2013 and VS2015 64-bit. Search for "Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64" (or "19.00.24215.1") or "VS2013"/"VS2015", all the way at the bottom. For exact build options, see here for 2013 or here for 2015. The important part is to open a Windows shell with the 64-bit commandline build tools in your $PATH and open a msys shell from there, and then run configure using the --arch=x86_64 --target-os=win64 --toolchain=msvc options. For more detail, see the MSVC compilation wiki 页面。

FFmpeg 页面上有一个操作方法 itself.It 到目前为止对我不起作用,但至少你应该摆脱 C99 错误等。

https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC

也许您可以尝试安装这些东西(我必须使用 Msys2 单独下载 pkg-config 才能工作)并按照以下步骤操作。

不,这是不可能的。 MS 编译器不支持#include_next。另外,还有许多其他问题...您需要 MinGW。

我以前用 MinGW 在 linux 机器上编译 ffmpeg,但现在我可以在 windows 机器上编译,在我的例子中是 Windows 10.

注意: 对我来说,它只适用于 ffmpeg 版本 >= 3.0,我使用 VS 2013 和 2015

进行了测试

几个步骤但非常重要:

下载安装(YASM除外):

步骤:

  1. 将MSYS2安装到固定文件夹(例如:C:\Dev\msys64)
  2. 运行 msys2.exe
  3. 执行命令"pacman -S make gcc diffutils"并按"Y"安装
  4. 关闭 msys2
  5. 将 C:\Dev\msys64\usr\bin\link.exe 重命名为其他名称(例如:msys2_link.exe)
  6. 复制 "yasm--win64.exe" 并将其重命名为 "C:\Dev\yasm.exe"
  7. 将"C:\Dev"添加到环境变量PATH
  8. 运行 VS2013/2015 x86(x86)或 x64(x64)命令提示符
  9. 执行"C:\Dev\msys64\msys2_shell.cmd -msys -use-full-path"
  10. 在 msys2 window 上执行 "which cl" 你应该可以看到你的 VS 的路径
  11. 执行"which link"你应该也会看到你的VS的路径
  12. 进入ffmpeg源码路径(eg.: "cd /c/ffmpeg3.3")
  13. 运行 ./配置并制作

我用的是这个配置:

./configure \
    --toolchain=msvc \
    --arch=x86_64 \
    --enable-yasm \
    --enable-asm\
    --enable-shared \
    --enable-w32threads \
    --disable-programs \
    --disable-ffserver \
    --disable-doc \
    --disable-static \
    --prefix=/c/ffmpeg3.3/DLLS

注2: 如果您使用最后一行 --prefix=/c/ffmpeg3.3/DLLS 作为最后一步,运行 make install 二进制文件将被复制到该路径

希望对您有所帮助。

祝你好运