2、编译过程html
一、编辑C:\MinGW\msys\1.0\msys.bat文件,在最前面加入一行linux
后面路径是机器上安装的vc的对应路径,加入这行编译ffmpeg时会多出windows下调用dll对应的lib,方便vc调用。(网上看到的)windows
二、双击C:\MinGW\msys\1.0\msys.bat运行,进入ffmpeg源码目录D:\ffmpeg0.8.5,这个窗口的命令和shell类似,和cmd运行有些区别,右斜杠须要换成左斜杠,而后盘符D:也要改为/d,输入cd /d/ffmpeg/ffmpeg0.8.5,进入ffmpeg主目录。服务器
三、开始编译ffmpeg,继续输入:ide
4,等待一段时间后,输入:make (忽略警告)函数
5,等待较长的时间后,输入make installui
这样就能够调用ffmpeg库了。
附:编译时遇到的一些问题:
1,Cannot open include file: 'inttypes.h': No such file or director解决办法
一、找到include目录中的ffmpeg\common.h
二、在“#define COMMON_H”以后加入以下代码,同时删除“#include <inttypes.h>” 而后保存:
#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
#
#endif
#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(EMULATE_INTTYPES)
#
#endif
#ifndef EMULATE_INTTYPES
#
#else
#
#
#
#endif
2,error C3861: 'UINT64_C': identifier not found
找到include目录中的ffmpeg\common.h
在函数头部加入宏定义:
//本身所加的定义,处理UINT64_C未定义的错误
#ifndef INT64_C
#define INT64_C(c) (c ## L)
#define UINT64_C(c) (c ## UL)
#endif
3,处理相关宏定义格式错误,将括号中的…改成n
#if AV_GCC_VERSION_AT_LEAST(4,3)
#else
#endif
4,出现Cannot open include file: 'stdint.h': No such file or directory
在出现 #include <stdint.h>的地方注掉便可
5,处理template类错误的方法,在extern前检查宏定义
#undef __cplusplus
extern "C" {
#include "libavutil/avutil.h"
#include "libavformat/avformat.h"
}
#define __cplusplus