您的位置:首页 > 其它

Mingw下ffmpeg编译

2013-05-02 07:15 155 查看
环境搭建

安装mingw











修改D:\MinGW\msys\1.0下的msys.bat文件
set "HOME=D:\MinGW\bin" 设置环境变量不设置时会出现某个dll缺失的bug
call "D:/Program Files/Microsoft Visual Studio 10.0/VC/bin/vcvars32.bat" 使用vs2010生成.lib文件

安装sdl-devel
Sdl介绍
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."
SDL supports Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported.
SDL is written in C, but works with C++ natively, and has bindings to several other languages, including Ada, C#, D, Eiffel, Erlang, Euphoria, Go, Guile, Haskell, Java, Lisp, Lua, ML, Oberon/Component Pascal, Objective C, Pascal, Perl, PHP, Pike, Pliant, Python, Ruby, Smalltalk, and Tcl.
SDL is distributed under GNU LGPL version 2. This license allows you to use SDL freely in commercial programs as long as you link with the dynamic library

Sdl编译
编译SDL,在MinGW安装时必须选择g++ compiler和开始默认的C编译工具。再着就是下载SDL (http://www.libsdl.org/hg.php) 说关键其实很步骤很简单,就和Linux或者Cygwin中安装软件一样简单,打开MSYS,输入命令./configure;make;make install,之后等着执行完毕。就安装成功了。它应该位于MSYS/1.0/local/bin目录下,为了测试你是否安装成功SDL,可以使用SDL中test文件夹下的测试程序。当然测试程序也需要你自己来编译,在MSYS中进入SDL/test目录下,输入命令./configure;make。之后就有很多的测试程序编译成了.exe的文件,这时你可以使用鼠标双击某个.exe的文件进行测试。如果能够运行,恭喜你,
将MSYS/1.0/local/bin copy 到 D:\MinGW\bin
将 MSYS/1.0/local/lib copy 到 D:\MinGW\lib
将 MSYS/1.0/local/include copy 到 D:\MinGW\include目录下



解决方法:关闭杀毒软件
x264
介绍
x264是一个开源的H.264视频编码函数库。是最好的有损视频编码器。
主页: http://www.videolan.org/developers/x264.html

安装
解压,进入解压包

1) ./configure --enable-win32thread

2) make & make install

3) 把x264.h和x264_config.h这两个文件从d:/mingw/msys/1.0/local/include目录拷贝到d:/mingw/include目录。
4) 把libx264.a文件从c:/mingw/msys/1.0/local/lib目录拷贝到c:/mingw/lib目录。

Lame
介绍
LAME 是最好的MP3编码器,编码高品质MP3的最好也是唯一的选择。LAME本身是DOS下的文件,需要加外壳程序才比较容易使用,也可以在别的软件(比如EAC)中间调用。是一款出色的MP3压缩程序,它使用了独创的人体听音心理学模型和声学模型,改变了人们对MP3高音发哑、低音发破的音质的印象。
安装
1) ./configure

2) make & make install

3) 把lame目录从d:/mingw/msys/1.0/local/include目录拷贝到d:/mingw/include目录。
4) 把libmp3lame.a文件从d:/mingw/msys/1.0/local/lib目录拷贝到d:/mingw/lib目录。

Ffmpeg http://www.ffmpeg.org/ 执行./configure --enable-memalign-hack --enable-static –enable-shared

后现错误:

gcc is unable to create an executable file.

If gcc is a cross-compiler, use the --enable-cross-compile option.

Only do this if you know what cross compiling means.

C compiler test failed.

If you think configure made a mistake, make sure you are using the latest

version from SVN. If the latest version fails, report the problem to the

ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.

Include the log file "config.err" produced by configure as this will help

solving the problem.



解决方法 :关闭杀毒软件即可

出现mingw ffmpeg yasm not found

yasm是汇编编译器,因为ffmpeg中为了提高效率用到了汇编指令,比如MMX和SSE。解决这个问题方面有两个:

1、在网上下载一个yasm.exe并安装在mingw/bin下面,编译代码时你注意看,会发现asm后缀的文件用的编译器是yasm,c文件用的是gcc;

2、不使用汇编指令,在配置时加上,即./configure --disable-yasm

yasm下载地址:http://yasm.tortall.net/Download.html
下载yasm-1.2.0-cygwin.exe
改名后放到cygwin/bin下

最后验证ffmpeg编译是否正确
Ffmpeg –I xx.wmv -strict -2 xx.mp4
自己编译ffmpeg大功告成

待解决问题
没有生成ffserver.exe
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mingw ffmpeg编译