在Windows中使用MinGW编译X264

参考:http://ayobamiadewole.com/Blog/Others/x264compilation.aspx

注意:安装完MinGW后,要把“安装路径\MinGW\bin”加到PATH环境变量中。否则在./configure的时候会“No working C compiler found”。

具体步骤如下:

For someone coming from a windows background, where you do virtually everything, using GUI probably with Visual studio or an equivalent IDE, compiling a program from the command line can be a daunting task. 
This blog post will guide you through compiling and building the popular open source video encoding library on windows using the MinGW(Minimalist GNU on Windows). 
First you need to download the x264 source code from http://x264.nl/ Or if you know how to use git, you can git clone the x264 from git://git.videolan.org/x264.git. 
Then you should download MinGW from http://sourceforge.net/projects/mingw/files Download the mingw-get-inst-20111118.exe (591.9 kB) install it and during the installation steps, select all the check boxes. (直接到这里下载就可以了:http://sourceforge.net/projects/mingw/)

After the installation is completed(然后还要把环境变量加上), then from Start button , click All program, then click MinGW and then Click on MinGW shell, this brings up the following window 
MinGW bash 
From the msys shell change your directory to the location where your x264 source code is, in my own case the x264 code is in the c: drive so I will simply Type cd c:\x264
 MinGW bash2 
Then type ./configure and press enter, this screen waits for some seconds and the bring
 MinGW bash4 
Then you can now type make and press enter, this will bring up the window below, showing the progress of the compilation process.
 MinGW bash3 
After the compilation is finished, if you look into your x264 directory you will find x264.exe file there.
 MinGW bash5 
Now compiling the x264 into a dynamic link library that can be used in Visual studio takes another process entirely. Open the MinGW bash once again and change the directory to the location of your x264 source code, just like you did previously. 
Then type 
./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264-120.def 
              or just 
./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def

 MinGW bash6 
Now in libx264-120.def “120” is the version of the x264 you are using, you can find the version of the x264 you are using by opening the x264.h file in your x264 source folder you will see something like this #define X264_BUILD 120 depending on your version.

You can now type the make command and press enter and you will find the libx264-120.dll in your x264 source folder. Then rename libx264-120.dll to libx264.dll and you have you dynamic link library to work with.
 window 
If you wish to generate the Visual Studio .lib file to work with then open a Visual Studio command prompt, and change the directory to the location of the x264 source . 
Then run this command
 LIB /DEF:libx264.def 
Then press enter 
visual studio command prompt 
And your libx264.lib would be generated.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值