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 <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
#include <libswscale\swscale.h>
#include <libswresample\swresample.h>
}
我自己筆記本設置有環境變量,所以對SDL引用是如下的。
#include "../include/SDL.h"
#include "../include/SDL_thread.h"