-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Build QtAV
Get QtAV source code
git clone https://github.com/wang-bin/QtAV.git
git submodule update --init
FFmpeg (>=1.0) or Libav (>=9.0) is always required. The latest FFmpeg release is recommended (that's what i use).
You can download latest precompiled FFmpeg from QtAV sourceforge page, or if you are using Windows you can also download FFmpeg development files from Zeranoe.
Another option is to build FFmpeg yourself use QtAV/scripts/build_ffmpeg.sh
Other requirements are:
OpenAL(Optional). Since 1.8.0 (or latest code), OpenAL is not required any more. XAudio2 is used instead. XAudio2 supports most windows, from XP to windows 10, WinRT and windows phone. Windows 8 and later natively supports XAudio2. For Windows 7 and older, you have to install DirectX.
None. System's OpenAL is used
None
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
You may have to install VA-API drivers to make VA-API available at runtime. See https://github.com/wang-bin/QtAV/wiki/Enable-Hardware-Decoding
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, just skip this step.
Choose one of the following methods.
This is the simplest and best way to let compilers find ffmpeg and other depend libraries(e.g. OpenAL). Qt header dir and library dir is always be searched. This should work for all platforms, including android, iOS and meego.
VC
set INCLUDE=ffmpeg_path\include;openal_path\include;%INCLUDE%
set LIB=ffmpeg_path\lib;openal_path\lib;%LIB%
GCC in unix shell environment(including mingw with sh.exe):
export CPATH=ffmpeg_path/include:openal_path/include:$CPATH
export LIBRARY_PATH=ffmpeg_path/lib:openal_path/lib:$LIBRARY_PATH
GCC on windows cmd.exe environment without UNIX Shell:
set CPATH=ffmpeg_path\include;openal_path\include;%CPATH%
set LIBRARY_PATH=ffmpeg_path\lib;openal_path\lib;%LIBRARY_PATH%
If you are building in QtCreator, goto QtCreator's 'Projects' page and add/append the environment/values.
For most platforms, just
qmake
make
It's strongly recommend not to build in source dir.
mkdir your_build_dir
cd your_build_dir
qmake QtAV_source_dir/QtAV.pro
make
qmake will run check the required libraries at the first time, so you must make sure those libraries can be found by compiler.
Then qmake will create a cache file .qmake.cache
in your build dir. Cache file stores the check results, for example, whether portaudio 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.
use make, jom, nmake or QtCreator to build it.
You MUST setup the environment before qmake as mention at the beginning.
Run qmake
then nmake
or jom
I don't put any vs project file in QtAV, because it's easy to create by qmake.
Open cmd
qmake -r -tp vc QtAV.pro
Then sln and vcxproj(vcproj) files will be created. Run msbuild /m
to build the projects. 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).
NOTE: you may have to put ffmpeg/openal development files in Qt include and lib dir!
QtCreator will detect VC compiler if it is installed. So it's easy to build in QtCreator
run
debuild -us -uc
in QtAV source tree
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
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