Like previous post, this post will guide you to make your own x264 build under Windows by using msys2
Update msys2
Skip this if you already done, just in case msys2 have new package, open msys2 64-bit
pacman -Syu
Press Y and wait until you see this screen, simply exit terminal without CTRL+C
Install required package
x264 require some other tool to work, for example, output to mp4 require GPAC MP4Box
or L-SMAH
, to read any file without pipe, require libav
or ffms2
.
Download compiler tools
pacman -S --needed base-devel git subversion mercurial nasm yasm mingw-w64-x86_64-toolchain
Download x264 required source
pacman -S --needed mingw-w64-x86_64-ffms2 mingw-w64-x86_64-gst-libav mingw-w64-x86_64-l-smash
Compile x264
Now, we can compile, first, we need clone x264 project
If you using AMD Ryzen/Threadripper/Epyc (Zen 2), it’s good time to run compiler optimization:
Then, you can start compile as usual
git clone https://code.videolan.org/videolan/x264
cd ~/x264
./configure --extra-cflags="-march=znver2" --enable-static --bit-depth=8
or…
./configure --extra-cflags="-march=znver2" --enable-static --bit-depth=10
Make sure the configure is configured like this:
shared: no
static: yes
asm: yes
interlaced: yes
avs: avisynth
lavf: yes
ffms: yes
mp4: lsmash
opencl: yes
Then start make
Copy dependency
If your compiled binary not working, it’s time to make a jail version of x264 by copying all required file to a folder you like.
mkdir ~/jail
cp x264 ~/jail
ldd x264 | grep "=> /" | awk '{print $3}' | grep "/ming" | xargs -I '{}' cp -v '{}' ~/jail
Command grep "/ming"
is skipping Windows DLL file, copy only mingw DLL