Is it possible to build ffmpeg x64 on Windows?

12,406

Solution 1

No, it cannot be done. MS compiler doesn't support #include_next. Plus, many other problems... You need MinGW.

Solution 2

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

Solution 3

Assuming with x64 you mean the standard 64-bit version, yes it is possible. See the 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 page.

Share:
12,406
Admin
Author by

Admin

Updated on June 09, 2022

Comments

  • Admin
    Admin about 2 years

    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?

  • Admin
    Admin over 7 years
    How exactly is that going to help me? I know the legend says it is possible, but this URL only reports the build result. One thing that makes me think it is fake is the config log for the x64. It says: ARCH x86 (generic)
  • Admin
    Admin over 7 years
    Running configure with only arch, target-os and toolchain is not even close enough. You need to provide compiler switches and preprocessor directives. There are also some Linux only sources that are getting compiled always, because they have no preprocessor directives for various platforms. Also, the pkg-config is missing, etc... The most important parts are missing.
  • Ronald S. Bultje
    Ronald S. Bultje over 7 years
    I don't think "fake" and "wrong" are very informative. The MSVC port works as claimed, including 64-bit support. If you have specific questions about things that aren't working, I'm happy to help.
  • Admin
    Admin over 7 years
    Maybe it works, but definitely not as described in your answer. I thought that's pretty much clear. In other words, no, the MSVC port doesn't works as described. If you don't understand the question, perhaps I should wait for somebody else with more constructive comments and answers?
  • llogan
    llogan over 7 years
    @moose Comments like that will get you no help.
  • Admin
    Admin over 7 years
    @LordNeckbeard People are earning big bucks for building ffmpeg. That's why nobody is willing to explain how to do it. Answers like fate page and wiki is something that any Google warrior will get in a second. If you have never tried it, it looks like as answer, but unfortunately it is not.
  • Admin
    Admin about 7 years
    You say it didn't work for you so far. Why do you think it will work for me if I follow the same procedure?
  • Earinor
    Earinor about 7 years
    It's a matter of the Environment, and it is at least something to start with I guess. So maybe you are smarter than me and figure it out ;) How far did you get with your attempt to build it?
  • Admin
    Admin about 7 years
    Don't remember all the details. It was last year in December. It starts with solving one problem at the time, but every solved problem brings a few new problems, so it turns into an endless patching. It's probably better to build it with MinGW. It still requires some fixing, but at least there is a chance of winning the battle within some reasonable time. The bad side is that you cannot debug it through VS then. VS cannot work with DWARF format.
  • Arturo
    Arturo about 6 years
    - ffmpeg recommends using "mingw64" instead of "msys" in step 9. Do you do this so that it actually finds the MSVC toolset? I seem to be having problems using the toolset flag
  • Summit
    Summit almost 4 years
    @tweellt Please if you could guide me how can i enable X264 and libsrt support in ffmpeg.