在Windows中使用MinGW编译X264

简介:
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.
目录
相关文章
|
1月前
|
Unix 编译器 开发者
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
|
3月前
|
Linux 编译器 数据安全/隐私保护
Windows10 使用MSYS2和VS2019编译FFmpeg源代码-测试通过
FFmpeg作为一个流媒体的整体解决方案,在很多项目中都使用了它,如果我们也需要使用FFmpeg进行开发,很多时候我们需要将源码编译成动态库或者静态库,然后将库放入到我们的项目中,这样我们就能在我们的项目中使用FFmpeg提供的接口进行开发。关于FFmpeg的介绍这里就不过多说明。
76 0
|
1月前
|
前端开发 Unix 开发工具
windows使用cygwin编译Xyce
windows使用cygwin编译Xyce
20 0
|
3月前
|
开发工具 git C++
libevent-windows VS2019-cmake 编译笔记
本文主要本文主要记录个人在使用window10使用cmake编译libevent遇到了一点小问题,这里就简单的记录一下,给cmake编译项目不熟悉的朋友一点帮助记录个人在使用window10使用cmake编译libevent遇到了一点小问题,这里就简单的记录一下,给cmake编译项目不熟悉的朋友一点帮助
37 0
|
3月前
|
Linux TensorFlow 算法框架/工具
windows编译TensorFlowServing
windows编译TensorFlowServing
|
3月前
|
Windows
windows 下编译openssl libssh2
windows 下编译openssl libssh2
42 0
|
3月前
|
Linux Windows Perl
windows下编译openssl
windows下编译openssl
43 0
|
1月前
|
安全 数据安全/隐私保护 Windows
解锁安全之门,Windows Server 2019密码修改攻略大揭秘
解锁安全之门,Windows Server 2019密码修改攻略大揭秘
|
1月前
|
存储 安全 网络安全
铁壁如墙-WINDOWS SERVER 2019勒索病毒终极防御指南
铁壁如墙-WINDOWS SERVER 2019勒索病毒终极防御指南
|
1月前
|
网络协议 数据安全/隐私保护 Windows
Windows Server 各版本搭建域控制器实现通过域管理用户(03~19)
Windows Server 各版本搭建域控制器实现通过域管理用户(03~19)
45 1