首页 > 其他分享 >Build QtAV

Build QtAV

时间:2023-05-18 16:45:42浏览次数:40  
标签:ffmpeg lib qmake build path QtAV Build

git addr:https://github.com/wang-bin/QtAV

 

Uninstall QtAV SDK before building to avoid header files confliction. Run sdk_uninstall.bat/sh under your build dir

Shadow build is recommended (required for mac build).

0. Prerequisites

  • Get QtAV source code

    use git

    git clone https://github.com/wang-bin/QtAV.git
    cd QtAV && git submodule update --init
  • FFmpeg>=1.0/Libav>=9.0. The latest release is recommended.

    You can download latest prebuilt FFmpeg, or build yourself.

    • If using OSX, installing ffmpeg via brew is also ok.
  • Libass headers is required if you need ass subtitle rendering support.

For windows, download http://sourceforge.net/projects/qtav/files/depends/QtAV-depends-windows-x86%2Bx64.7z/download and using bin, include, lib in the package is enough to build.

Other requirements are:

  • Windows

    If using Visual Studio, the Windows 10 SDK or Windows 8.1 SDK

    OpenAL(Optional). OpenAL is not required since QtAV1.8.0. XAudio2 is always used. XAudio2 supports XP~windows 10 and Windows Store apps. Windows 8 and later natively supports XAudio2. For Windows 7 and older, you have to install the driver from DirectX to run.

  • OS X, iOS None. AudioToolbox and System OpenAL is used

  • Android

    On Windows you must put mingw32-make.exe in one of %PATH% to avoid qmake error.

  • Ubuntu

    OpenAL(recommended) or PulseAudio. To enable all supported features, you must install libass, XVideo and VA-API dev packages.

    sudo apt-get install libopenal-dev libpulse-dev libva-dev libxv-dev libass-dev libegl1-mesa-dev

    You may have to install VA-API drivers to make VA-API available at runtime

1. Setup the environment

You MUST let your compiler know where FFmpeg headers and libraries are. Otherwise you will get an error when running qmake. If they are already be where they should be, for example you install from apt on ubunt, just skip this step.

Choose one of the following methods.

(Recommended) Put FFmpeg headers and libs into Qt directories

It's the simplest and best way. Qt include and lib dir are always searched in QtAV. It should work for all platforms, including android, iOS, WinRT and meego etc.

Take Windows for example, Qt is installed in C:\Qt\5.7\msvc2015_64\ . Goto that dir and put ffmpeg headers to include\, libs to lib\

(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

(NOT Recommended)Use Environment Vars

  • VC: INCLUDE and LIB

    command line:

    set INCLUDE=ffmpeg_path\include;openal_path\include;%INCLUDE%
    set LIB=ffmpeg_path\lib;openal_path\lib;%LIB%
  • gcc/clang: CPATH and LIBRARY_PATH

    unix shell environment(including mingw with sh.exe) command line

    export CPATH=ffmpeg_path/include:openal_path/include:$CPATH
    export LIBRARY_PATH=ffmpeg_path/lib:openal_path/lib:$LIBRARY_PATH
    export LD_LIBRARY_PATH=ffmpeg_path/lib:openal_path/lib:$LD_LIBRARY_PATH

    windows cmd.exe environment without UNIX Shell command line

    set CPATH=ffmpeg_path\include;openal_path\include;%CPATH%
    set LIBRARY_PATH=ffmpeg_path\lib;openal_path\lib;%LIBRARY_PATH%
  • If build in QtCreator, open 'Projects' page and add/append the environment/values.

    QtCreator Settings

  • If using OSX and your ffmpeg is installed via brew (brew install ffmpeg), you can:

    export CPATH=/usr/local/Cellar/ffmpeg/[VERSION]/include:$CPATH
    export LIBRARY_PATH=/usr/local/Cellar/ffmpeg/[VERSION]/lib:$LIBRARY_PATH
    export DYLD_LIBRARY_PATH=/usr/local/Cellar/ffmpeg/[VERSION]/lib:$DYLD_LIBRARY_PATH
    ~/Qt/5.7/clang_64/bin/qmake [QtAV Repo Directory]/QtAV.pro

2. Build in QtCreator or command line

  • Command line build

    For most platforms, just run

    mkdir your_build_dir
    cd your_build_dir
    qmake QtAV_source_dir/QtAV.pro
    make -j4

    It's strongly recommended not to build in source dir(especially OSX).

    qmake will check the required libraries to make sure they can be found by compiler.

    Then qmake will create a cache file .qmake.cache in your build dir. Cache file stores the dependencies check results, for example, whether openal is available. If you want to recheck, you can either delete .qmake.cache and run qmake again, or run

    qmake QtAV_source_dir/QtAV.pro -r "CONFIG+=recheck"

WARNING: If you are in windows mingw with sh.exe environment, you may need run qmake twice. I have not found out the reason behind this phenomenon.


CMake Build

QtAV 1.12 supports cmake. cmake + ninja can reduce build time. You have to set QTDIR to the installed qt path, otherwise cmake will find Qt5 in system default dirs.

cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQTDIR=C:\Qt\5.8\msvc2015 qtav_src_dir
ninja
ninja install

Visual Studio/MSBuild

I don't put any vs project file in QtAV, because it's easy to create by qmake.

Open a correct VS Prompt, for example, to build UWP for mobile, open VS2015 prompt for arm. Then run command there

%QTDIR%\bin\qmake -r -tp vc QtAV.pro

Where QTDIR is the corresponding Qt version directory, for example D:\Qt\5.7\winphone_arm for windows phone 8.1. Then sln and vcxproj(vcproj) files will be created. Run msbuild /m to build the projects (/m option will break the build since qt5.7, just remove it). You can also open QtAV.sln in your Visual Studio to Compile it.

Another solution is using Qt vs plugin. It will help you to load qmake projects(not tested).

QtCreator With MSVC

QtCreator will detect VC compiler if it is installed. So it's easy to build in QtCreator

Build for Android on Windows

You may get qmake error libavutil is required, but compiler can not find it. That's because mingw32-make.exe can not be found in the config test step. An workaround is put your mingw32-make.exe to one of %PATH% dirs

Build Debian Packages

run

debuild -us -uc

in QtAV source tree

Link to Static FFmpeg and OpenAL

QtAV >=1.4.2 supports linking to static ffmpeg and openal libs. It's disabled by default. To enable it, add

CONFIG += static_ffmpeg static_openal

in $QtAV/.qmake.conf for Qt5 or $QtAV_BUILD_DIR/.qmake.cache

Ubuntu 12.04 Support

If QtAV, FFmpeg and OpenAL are built on newer OS, some symbols will not be found on 12.04. For example, clock_gettime is in both librt and glibc2.17, we must force the linker link against librt because 12.04 glibc does not have that symbol. add

CONFIG += glibc_compat

to .qmake.conf or .qmake.cache

CI

You can read the build log to see how they work.

Build Error

  • qmake error Checking for avutil... no

Make sure ffmpeg headers and libs can be found by compiler. Read config.log in build dir for details.

标签:ffmpeg,lib,qmake,build,path,QtAV,Build
From: https://www.cnblogs.com/kn-zheng/p/17412416.html

相关文章

  • 一张图解析FastAdmin中的FormBuilder表单生成器
     功能描述在使用FastAdmin一键生成CRUD后,默认的生成的都是原生HTML的组件代码,会有许多不熟悉前端的小伙伴改动起来会比较费劲。其实在FastAdmin中有一个简单的FormBuilder,但是它只能生成一些简单的文本框或下拉框,像FastAdmin中常用的动态下拉框、城市选择框、联动框,它就没法实......
  • builder模式
     1#include<iostream>2#include<string>3#include<vector>4#include<sstream>5usingnamespacestd;67template<classT>8stringConvertToString(Tvalue){9stringstreamss;10ss<......
  • 使用buildx在x86机器上面编译arm64架构的Docker镜像
    buildx多架构编译安装docker下载docker下载buildx安装架构支持dockerrun--privileged--rmtonistiigi/binfmt--installall创建一个自己的空间buildxcreate--use--namemybuilder检查支持的架构buildxinspectmybuilder--bootstrapNodes:Name:mybu......
  • angular-devkit 中 build-angular 包的作用
    @angular-devkit/build-angular是AngularCLI的一个开发包,主要用于构建和打包Angular应用程序。它提供了一组命令行工具和可重用的构建流程,用于自动化构建和部署Angular应用程序。下面我们将介绍@angular-devkit/build-angular的作用和主要功能。作用@angular-devkit/b......
  • 第四周编程作业(一)-Building your Deep Neural Network: Step by Step
    BuildingyourDeepNeuralNetwork:StepbyStepWelcometoyourweek4assignment(part1of2)!Youhavepreviouslytraineda2-layerNeuralNetwork(withasinglehiddenlayer).Thisweek,youwillbuildadeepneuralnetwork,withasmanylayersasyou......
  • python:ERROR: Could not build wheels for wordcloud, which is required to install
    pycharm里无法下载,在下面下载出现问题 需要下载error里的文件https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud这个网站找。输入Python,看自己电脑是怎样的 下载文件后,放到对应位置,下载成功 ......
  • @Builder 注解的简单使用
    1、导语(可跳过)Java小白一枚,研读公司代码。发现实体类上加了@Builder、@NoArgsConstructor和@AllArgsConstructor。话不多说,上代码 2、实体类代码@Data@EqualsAndHashCode(callSuper=false)@Builder@AllArgsConstructor@NoArgsConstructor@ApiModel(value="TOrder对......
  • Unable to find Gradle tasks to build: [:]. Build mode: ASSEMBLE. Tests: None
    从Github上下载了一个项目,运行时报如下错误:UnabletofindGradletaskstobuild:[:].Buildmode:ASSEMBLE.Tests:None解决办法1、修改Gradle版本;2、项目中缺失setting.gradle文件,从其他项目中复制一份过来。   ......
  • gdb如何比较core文件和image及buildid
    gdb从git上看到的提交记录,关键的修改是在elf_core_file_matches_executable_p函数中添加的对于build_id的比较。///@file:gdb-10.1\bfd\elfcore.hbfd_booleanelf_core_file_matches_executable_p(bfd*core_bfd,bfd*exec_bfd){char*corename;/*xvecsmustmatch......
  • element-plus + VUE3 项目 build 之后 el-cascader无法选中而且导致整个网页卡顿
    cascader不能用v-model接收值,需要改为model-value方式<el-cascadermodel-value="selRegion":options="RegionTreeCascader":show-all-levels="true"separator="-":props="{checkStrictly:true,expandTrigger:'hove......