How to build x264 on Windows

I just had a little bit of an ordeal getting x264 to build on Windows so I am going to write the steps out here as all the other online guides are out of date or missing some information:

Step One: You need the x264 source. This is mirrored in a few locations:

Use git to pull down a copy of the source.
From a bash command prompt like this:
git clone {address of the source from one of those sites here...}

Step Two: You need a compiler that is supported. For ease of use I went with MingW.

The installer for MingW can be found here: https://sourceforge.net/projects/mingw/files/Installer/

When running that installer you will be given a list of packages to install from the installation manager that looks like this:

From this manager ensure you have msys-base, g++ and mingw32-base. Then go into MSYS -> MSYS Base System and tick msys-bash aswell. Then go to 'Installation->Apply Changes' to download those files.

Step Three: The documentation doesnt tell you this, but on Windows you need to manually download NASM to build the application without the setup process complaining a lot.

Download here: http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/win64/

The default directory that this installs to is in your user appdata instead of program files (unless you launch with admin privileges). Find the folder you installed to, it will probably look something like: 'C:\Users\{YOURNAME}\AppData\Local\bin\NASM' and add it to your path.

Step Four: You need to configure the build directory.

Open the MingW shell you installed in step two. Change to the directory you pulled the course code to and run './configure'.

Untitled.png

Step Five: Run make

Now you should have the code compiled to x264.exe in the source directory.

I hope this saves you time!


Addition!

Step Six: Did you want MP4 support? That is enabled automatically in the configure step if you have GPAC instealled.
Download here and add to PATH: https://gpac.wp.imt.fr/downloads/gpac-nightly-builds/