QtAV编译



https://github.com/wang-bin/QtAV/wiki/Build-QtAV

我的环境windows Qt mingw版本, 5.14.1

qt 安装后添加PATH D:\Qt\Qt5.14.1\5.14.1\mingw73_64\bin,方便找到运行库,后面qtav运行库也安装到这里

参考wiki,很顺利

1、下载
git clone https://github.com/wang-bin/QtAV.git
cd QtAV && git submodule update –init


2、下载依赖

http://sourceforge.net/projects/qtav/files/depends/QtAV-depends-windows-x86%2Bx64.7z/download
解压到QtAV同一级目录


3、设置环境
官网推荐配置

(Recommended) Edit .qmake.conf (if use qmake)

Extract ffmpeg to QtAV source dir. add 2 lines in .qmake.conf
INCLUDEPATH += $$PWD/ffmpeg/include
LIBS += -L$$PWD/ffmpeg/lib


我的配置

INCLUDEPATH += $$PWD/../QtAV-depends-windows-x86+x64/include
  LIBS += -L$$PWD/../QtAV-depends-windows-x86+x64/lib

如果是64位qt, LIBS修改为
  LIBS += -L$$PWD/../QtAV-depends-windows-x86+x64/lib/x64

4、编译
mkdir your_build_dir
cd your_build_dir
qmake QtAV_source_dir/QtAV.pro

F:\qt-project\QtAV-build-dir>qmake ..\QtAV\QtAV.pro

qmake ../QtAV/QtAV.pro CONFIG+=debug
mingw32-make.exe –j4


运行 sdk_install.bat 把qtav头文件和库拷贝到qt目录下。


5、运行

只要把依赖库拷贝到bin目录下,就可以双击运行了


参考simpleplayer, 工程pro修改如下,


# "avwidgets" module is required only for qwidget apps. QML apps only need "av" module
greaterThan(QT_MAJOR_VERSION, 4) {
   QT += av avwidgets
} else {
   CONFIG += av avwidgets
}

LIBS += -LD:\Qt\Qt5.14.1\5.14.1\mingw73_64\lib -lQtAV1 –lQtAVWidgets1


调试运行时把QtAV-depends-windows-x86+x64\bin\x64 相关dll拷贝到对应目录 D:\Qt\Qt5.14.1\5.14.1\mingw73_64\bin,就可以正常运行了


posted on 2020-03-26 11:08  katago  阅读(516)  评论(0编辑  收藏  举报