到官方下载,下载最新源码,配置MSYS2,然后编译;
Getting x264
Source
The latest x264 source code is available through git repository:
# git clone https://code.videolan.org/videolan/x264.git
You can browse the source on-line.
Application binaries
Official builds for Windows, Linux, and MacOSX are available from here.
--enable-shared :编译成动态库。 --enable-static :编译成静态库。
在Windows 上,编译参数:
./configure --enable-shared --disable-cli --disable-thread ----enable-debug (调试版本)
二:《windows下编译最新的x264》
1,关于lib,不需要转化工具,直接将编译后的文件,libx264.dll.a 修改为 libx264.lib即可;
之前可以直接用msys或者mingw直接编译 x264,现在新版本的x264,在Windows上的编译需要多几个步骤:
《Compiling x264 on Windows with MSVC》
https://www.roxlu.com/2016/057/compiling-x264-on-windows-with-msvc
1. Download and install msys2
Go to msys2.github.io and download the 64 bit installer. On their website they have a pretty good how-to that you can follow. You select the destination and click next a couple of times. It will install all base files, but you still need to do some steps after clicking next a couple of times. Make sure you tick the [x] Run MSYS2-64 bit now
. In the msys window type (also described on their website) the following command. Note that you may need to close and then open (via the windows menu) msys2 again during any of these steps. If there is no "msys2" in your start menu (which happened to me), you can execute the msys2_shell.cmd
from the install directory. Next execute the following to update the packages.
$ pacman -Sy pacman $ pacman -Syu $ pacman -Su
2. Install dependencies
Click on the msys2_shell.cmd
file from the install directory and install some more dependencies:
$ pacman -S yasm $ pacman -S make
3. Get x264 sources
Next, because installing git with pacman in the msys shell failed, I cloned x264 using the git-bash I had installed already. So open your git-bash and clone x264.
$ cd /some/dir $ git clone http://git.videolan.org/git/x264.git
4. Compile
Now press your windows key and type vs2015
(and of course make sure you have installed Visual Studio 2015 Express Edition), and select the VS2015 x64 Native Tools Command Prompt
Using this VS2015 x264 Native Tools Command Prompt
go to your msys2 directory and type:
$ msys2_shell.cmd -mingw64 -full-path
This will open a new msys2
shell, in which the correct environment variables have been set, which allows you to compile x264 with VS2015. Now, go to your x264 directory and execute:
$ cd /to/your/x264/source $ CC=cl ./configure --enable-static --prefix=${PWD}/installed $ make $ make install
《How to compile ffmpeg + x264 using Visual Studio 2015》
https://gist.github.com/RangelReale/3e6392289d8ba1a52b6e70cdd7e10282
##### How to compile ffmpeg + x264 using Visual Studio 2015 ##### ##### Building this way will make the DLLs compatible with SEH, so there will be no need to use /SAFESEH:NO when compiling your code ##### ##### SOURCES: ### https://pracucci.com/compile-ffmpeg-on-windows-with-visual-studio-compiler.html ### https://gist.github.com/sailfish009/8d6761474f87c074703e187a2bc90bbc ### http://roxlu.com/2016/057/compiling-x264-on-windows-with-msvc * Download "MSYS2 x86_64" from "http://msys2.github.io" and install into "C:\workspace\windows\msys64" # pacman -S make gcc diffutils mingw-w64-{i686,x86_64}-pkg-config mingw-w64-i686-nasm mingw-w64-i686-yasm * Rename C:\workspace\windows\msys64\usr\bin\link.exe to C:\workspace\windows\msys64\usr\bin\link_orig.exe, in order to use MSVC link.exe ===== 32 BITS BEGIN * Run "VS2015 x86 Native Tools Command Prompt" * Inside the command prompt, run: # C:\workspace\windows\msys64\msys2_shell.cmd -mingw32 -use-full-path ===== 32 BITS END ===== 64 BITS BEGIN * Run "VS2015 x64 Native Tools Command Prompt" * Inside the command prompt, run: # C:\workspace\windows\msys64\msys2_shell.cmd -mingw64 -use-full-path ===== 64 BITS END ### x264 ### # git clone http://git.videolan.org/git/x264.git # cd x264 # CC=cl ./configure --enable-static --prefix=/usr/local --disable-cli # make # make install ### ffmpeg ### * Download sources from "http://www.ffmpeg.org/download.html" # cd ffmpeg-3.3.2 # export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig ===== 32 BITS BEGIN # ./configure --toolchain=msvc --arch=x86 --enable-yasm --enable-asm --enable-shared --disable-static --disable-programs --enable-avresample --enable-libx264 --enable-gpl --prefix=./install ===== 32 BITS END ===== 64 BITS BEGIN # ./configure --toolchain=msvc --arch=x86_64 --enable-yasm --enable-asm --enable-shared --disable-static --disable-programs --enable-avresample --enable-libx264 --enable-gpl --prefix=./install ===== 64 BITS END # make # make install