Is it possible to build ffmpeg x64 on Windows?

user1090249 picture user1090249 · Dec 28, 2016 · Viewed 11.2k times · Source

The real answer is probably "no", but still, just to double check. Has anyone ever been able to build ffmpeg x64 on Windows (VS2013 or VS2015)? I know it is not possible with publicly available sources without heavy modifications. However, if somebody did it and if he is willing to share a few tips...

Edit: It is interesting how most of the required x64 tools for running the "configure" are distributed without dependencies and it is impossible to get them anywhere. Looks like a professional trolling.

Edit2: There are thousands of errors like this:

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

features.h is missing as many other header files. Is there a fix for that, or switching to Linux is the only option?

Answer

tweellt picture tweellt · Jun 15, 2017

I used to compile ffmpeg on a linux machine with MinGW, but now I'm able to compile on a windows machine, in my case Windows 10.

NOTE: For me it only worked for ffmpeg versions >= 3.0 and I tested using VS 2013 and 2015

Few steps but very important:

Download and install (except YASM):

Steps:

  1. Install MSYS2 to a fixed folder (eg.: C:\Dev\msys64)
  2. Run msys2.exe
  3. Execute command "pacman -S make gcc diffutils" and press "Y" to install
  4. Close msys2
  5. Rename C:\Dev\msys64\usr\bin\link.exe to some other name (eg.: msys2_link.exe)
  6. Copy and rename "yasm--win64.exe" to "C:\Dev\yasm.exe"
  7. Add "C:\Dev" to environment variables PATH
  8. Run VS2013/2015 x86 (for x86) or x64 for (x64) Command Prompt
  9. Execute "C:\Dev\msys64\msys2_shell.cmd -msys -use-full-path"
  10. On the msys2 window execute "which cl" and you should see the path of your VS
  11. Execute "which link" and you should also see the path of your VS
  12. Go to the ffmpeg source path (eg.: "cd /c/ffmpeg3.3")
  13. Run ./configure and make

I use this configuration:

./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

NOTE2: If you used the last line --prefix=/c/ffmpeg3.3/DLLS, as a final step, run make install and the binaries will be copied to that path

Hope it helped.

Best of luck