Qt ffmpeg环境搭建

ffmpeg下载地址:https://ffmpeg.zeranoe.com/builds/ 

版本选择第一个,然后多少位看自己的pc(我的是64),右边对应三个都要下载,Static,Shared,Dev,

Static对应ffmpeg.exe,ffprobe.exe

Shared对应ffmpeg.exe.ffprobe.xex,之外还有一些dll

Dev对应一个文件夹,dll,lib,h等文件,

把上面下载的三个文件全部解压,然后放到ffmpeg文件夹里面,放到C盘【我的是SSD无分区】

在qt5的工程文件中添加

INCLUDEPATH += C:/ffmpeg/dev/include
LIBS += -LC:/ffmpeg/dev/lib/ -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lswscale

然后环境变量添加C:/ffmpeg/Shared/bin;
然后清理工程-qmake-重新重新构建,
    ui->textEdit->append(avcodec_configuration());

后面输出配置信息即可表示环境装配成功。

除了上面配置以外,博友提醒了下,还要声明下外部定义域如下:
extern "C"
{
    #include <libavcodecavcodec.h>
    #include <libavformatavformat.h>
    #include <libswscaleswscale.h>
    #include <libswresampleswresample.h>
}

我自己笔记本设置有环境变量,所以对SDL引用是如下的。
#include "../include/SDL.h"
#include "../include/SDL_thread.h"


原文地址:https://www.cnblogs.com/liuruoqian/p/6211894.html