FFMPEG下载地址:
https://ffmpeg.zeranoe.com/builds/
配置环境变量(需重启电脑):
PATH:E:/ffmpeg/Shared/bin;
PRO添加如下代码:
INCLUDEPATH += E:/ffmpeg/dev/include
LIBS += -LE:/ffmpeg/dev/lib/ -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lswresample -lswscale
引用头文件:
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavdevice/avdevice.h"
}
由于我们建立的是C++的工程
编译的时候使用的C++的编译器编译
而FFMPEG是C的库
因此这里需要加上extern "C"
若函数:
avcodec_configuration()
返回如下类似文本: