wiki:

CompilationGuide

/

CrossCompilingForWindows

Cross Compiling for Windows

Introduction

Cross compiling FFmpeg for Windows means that you use a special version of the gcc compiler (and related tools) that output a working Windows executable when they're done. You can copy it to your Windows box and then use it (or use WINE to run it under Linux, but that kind of defeats the point).

Most cross compilation is done under Linux, but it is possible to use macOS as a host machine as well. Windows 10 WSL can do cross compilation as well.

Note that cross-compiling is sometimes easier than using a "native" compilation under Windows because some dependencies' configure scripts accept a cross compiler more readily than a native Windows MinGW, gcc, etc. It also may be "faster" than using gcc under Windows.

Tip: The FFmpeg Windows Build Helpers script can automatically cross-compile FFmpeg for Windows. You can still follow this guide if you want to manually compile FFmpeg.

Cross-Compiling Environment

Automated Cross Compiling Environment

Some building environments aim to automatically build the cross compilers and dependencies of FFmpeg. By using these projects you can eliminate the mess of building toolchains yourself. These projects include MXE and Win-builds.

MXE is more feature-complete as of Dec 2013, as

  • it has more dependencies for FFmpeg (x264, xvid, etc.)
  • it has an ffmpeg package (by default it is libraries-only, but users are able to generate the programs to by simply deleting one line in the building recipe)
  • it supports macOS as a host machine
  • it supports MinGW in addition to mingw-w64.

Win-builds as the official package manager for mingw-w64 is really new, and it does not have as many multimedia packages as MXE.

Linux Packages

Some Linux distros have packages like mingw-w64-dev or gcc-mingw-w64-i686 which might also get a working local cross compiler system. They'll add x86_64-w64-mingw32-gcc to your PATH and you're ready to go.

Compile FFmpeg

Now configure and compile FFmpeg like:

./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32-
make

and other options if you want them, like --enable-libx264, etc. if you have these dependencies cross-compiled as well.

This should eventually create the file ffmpeg_g.exe (ffmpeg.exe with debug symbols) and ffmpeg.exe (ffmpeg.exe "stripped" of its debug symbols). If you cross compile SDL beforehand, it will also include ffplay.exe.

Getting Help

You can ask questions on the Zeranoe Forum.

Last modified 3 weeks ago Last modified on Nov 1, 2017, 4:01:33 PM