在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.
目录
相关文章
|
7月前
|
Unix 编译器 开发者
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
688 0
|
2月前
|
并行计算 开发工具 异构计算
在Windows平台使用源码编译和安装PyTorch3D指定版本
【10月更文挑战第6天】在 Windows 平台上,编译和安装指定版本的 PyTorch3D 需要先安装 Python、Visual Studio Build Tools 和 CUDA(如有需要),然后通过 Git 获取源码。建议创建虚拟环境以隔离依赖,并使用 `pip` 安装所需库。最后,在源码目录下运行 `python setup.py install` 进行编译和安装。完成后即可在 Python 中导入 PyTorch3D 使用。
278 0
|
4月前
|
监控 机器人 Unix
GoLand——windows下如何编译Linux二进制文件
GoLand——windows下如何编译Linux二进制文件
64 1
GoLand——windows下如何编译Linux二进制文件
|
4月前
|
C++ Windows
Windows下编译64位CGAL
Windows下编译64位CGAL
141 0
|
4月前
|
编译器 Linux C语言
Windows下编译并使用64位GMP
Windows下编译并使用64位GMP
211 0
|
6月前
|
编译器 C语言 C++
Windows下配置GCC(MinGW)环境
Windows下配置GCC(MinGW)环境
1305 0
|
7月前
|
计算机视觉 Windows
OpenCV + CLion在windows环境下使用CMake编译, 出现Mutex相关的错误的解决办法
OpenCV + CLion在windows环境下使用CMake编译, 出现Mutex相关的错误的解决办法
315 0
|
7月前
|
前端开发 Unix 开发工具
windows使用cygwin编译Xyce
windows使用cygwin编译Xyce
90 0
|
29天前
|
网络安全 Windows
Windows server 2012R2系统安装远程桌面服务后无法多用户同时登录是什么原因?
【11月更文挑战第15天】本文介绍了在Windows Server 2012 R2中遇到的多用户无法同时登录远程桌面的问题及其解决方法,包括许可模式限制、组策略配置问题、远程桌面服务配置错误以及网络和防火墙问题四个方面的原因分析及对应的解决方案。
|
1月前
|
监控 安全 网络安全
使用EventLog Analyzer日志分析工具监测 Windows Server 安全威胁
Windows服务器面临多重威胁,包括勒索软件、DoS攻击、内部威胁、恶意软件感染、网络钓鱼、暴力破解、漏洞利用、Web应用攻击及配置错误等。这些威胁严重威胁服务器安全与业务连续性。EventLog Analyzer通过日志管理和威胁分析,有效检测并应对上述威胁,提升服务器安全性,确保服务稳定运行。

相关课程

更多
下一篇
DataWorks