Qt下配置 ffmpeg,首先下载ffmpeg-3.2-win32-dev 版本
在工程文件中添加导入的lib和include
INCLUDEPATH += D:/ffmpeg/ffmpeg-3.2-win32-dev/include
LIBS +=-LD:/ffmpeg/ffmpeg-3.2-win32-dev/lib
LIBS += -lavcodec -lavformat -lswscale -lavutil
需要注意的是ffmpeg的库文件有依赖关系,如果依赖顺序不对的话可能会造成函数找不到,坑!
在main函数里
main.cpp
#include <iostream>
using namespace std;
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavdevice/avdevice.h"
}
int main()
{
//这里简单的输出一个版本号
cout << "Hello FFmpeg!" << endl;
av_register_all();
unsigned version = avcodec_version();
cout << "version is:" << version;
return 0;
} 这个程序时 打印出当前的版本号 需要再debug/Release目录下加入运行时的dll
下载ffmpeg-3.2.2-win64-shared,将dll拷贝到exe路径下,运行OK