QT application programming: QtCreate compiled and deployed the open source audio and video framework module QtAV

1. Environmental introduction

Operating system: win10 64 bit

QT version:  QT5.12.6

Compiler:  MinGW 32

QtAV version:   QtAV-1.12.0

FFMPEG version:   ffmpeg 3.1 uses the package provided by QtAV, use it directly

2. Related software package download

QtAV homepage address:   http://www.qtav.org/ If you      don’t know the QtAV open source framework, you can go here to find out.

QtAV-1.12.0 download address (CSDN):   https://download.csdn.net/download/xiaolong1126626497/14023609

ffmpeg dependency library download address (CSDN):  https://download.csdn.net/download/xiaolong1126626497/14023601

The official download address of ffmpeg required for QTAV compilation:  https://sourceforge.net/projects/qtav/files/depends/

Three, QtCreate compiles QtAV source code

3.1 Decompress ffmpeg dependent packages

File name after download:  QtAV-depends-windows-x86+x64 (ffmpeg dependency library).zip

After decompression as follows:

  3.2 Copy dependent header files and library files

  Next, copy the header files and library files in the decompressed ffmpeg directory to the compiler directory used by QtCreate. If you don't copy them, problems will occur when you compile the QtAV project.

  The compiler directory used by my QT:   C:\Qt\Qt5.12.6\5.12.6\mingw73_32

 (1). Copy the header file to the compiler directory

(2). Copy the library file to the compiler directory

(3). Copy the pkgconfig file to the compiler directory

3.3 Compile QtAV

Unzip the QtAV-1.12.0.tar.zip file, open the .pro file, load the project, and complete the compilation and installation.

(1). Open the project

(2). Build the project 

(3). Successfully built 

After compiling, if you want to run an example program, you need to copy the ffmpeg library to the run directory.

 

(4). After the build is completed, find the project build directory and run the installation script. QtAV will be installed in the QT installation directory in the form of a QT module to facilitate loading and calling. 

 

 

Fourth, the new QtAV test project

Add code to the .pro project file.

QT       += avwidgets
LIBS     += -L$$quote(C:\Qt\Qt5.12.6\5.12.6\mingw73_32\lib) -lQtAV1 -lQtAVWidgets1

Related header files and namespaces

#include <QtAV>
#include <QtAVWidgets>

using namespace QtAV;

Refer to the official website to write basic playback code:

 Widgets::registerRenderers();
    VideoOutput *m_vo;
    AVPlayer *m_player;
    m_player = new AVPlayer(this);
    m_vo = new VideoOutput(this);
    m_player->setRenderer(m_vo);
    setCentralWidget(m_vo->widget());
    m_player->play("D:/123.mp4");

 

Note: For normal operation, you need to copy ffmpeg-related libraries to the program running directory, or add ffmpeg-related libraries to the system environment variables.

 

 

 

Guess you like

Origin blog.csdn.net/xiaolong1126626497/article/details/112209279