需要感谢这篇博文windows下使用Visual Studio编译可以调试的FFmpeg,在这篇博文的帮助下,进度才得以大大提高。
请注意此文档编译的ffmpeg库的版本是ffmpeg-2.6.9
1.在windows7 64位搭建MinGW环境,具体步骤请参考《windows下使用Visual Studio编译可以调试的FFmpeg》
2.编译ffmpeg库之前,请参考《windows下使用Visual Studio编译可以调试的FFmpeg》做相应的修改
3.具体的编译选项只包括H264和H265(HEVC)请参考《ffmpeg-2.6.9编译裁剪选项.txt》
./configure --enable-static --toolchain=msvc --arch=x86 --disable-debug --prefix="F:\FFmpeg\bin" --disable-everything --enable-decoder=h264 --enable-decoder=hevc --enable-demuxer=h264 --enable-demuxer=hevc --enable-demuxer=rtsp --disable-sdl --eanble-pareser=h264 --enable-parser=hevc --disable-protocols --enable-protocol=srtp --enable-protocol=file --enable-protocol=tcp --eanble-protocol=udp - -enable-small
如果还要做相应的减少HEVC
去除--enable-decoder=hevc --enable-demuxer=hevc –enable—parser=hevc
编译动态库与静态库只能一种,动态库—enable-shared 静态库—enable-static
4.在编译FFmpeg库时,出现“stdint.h"有关的错误,需要去掉"F:/FFmpeg/bin"中的stdint.h文件,就可以解决
5.在编译. Dll或者使用时,如果出现error C1189: #error : missing-D__STDC_CONSTANT_MACROS / #define__STDC_CONSTANT_MACROS
可以在”common.h"做添加以下内容:
extern "C"{
#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
#undef _STDINT_H
#endif
#include "stdint.h"
#endif
#ifndef INT64_C
#define INT64_C
#define UINT64_C
#endif
}