Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtmultimedia-building-from-source.qdoc
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qtmultimedia-building-from-source.html
6\title Building Qt Multimedia from sources
7\brief This document describes how to build Qt Multimedia with full
8feature support from source code.
9
10This page describes the process of configuring and building \l{Qt
11Multimedia}. This description assumes familiarity with \l{Building Qt
12Sources} which specifies build requirements for your platform, as well
13as an overview of \l{Qt Configure Options}. For platform-specific
14considerations related to the Qt Multimedia module, see \l{Platform
15Notes} below.
16
17\section1 Building from source
18
19Building Qt Multimedia with full feature support depends on \l
20{https://ffmpeg.org/}{FFmpeg} headers and libraries on most platforms.
21It is possible to build Qt Multimedia without the Qt Multimedia FFmpeg
22media backend, but this is only recommended when building for platforms
23where the FFmpeg backend is not supported.
24
25FFmpeg development libraries required to build Qt Multimedia can be
26built from sources or downloaded as binary packages. Qt Multimedia can
27use either static linking or dynamic linking to FFmpeg libraries. We
28recommend using the same major version of FFmpeg that is listed in
29\l{Target platform and backend notes}. For information on how to build
30the FFmpeg development libraries, see \l{Building FFmpeg from source}.
31
32\note The minimum supported FFmpeg version for the Qt Multimedia FFmpeg
33backend is FFmpeg 4.4.
34
35To build Qt Multimedia with FFmpeg support, specify the \c{-ffmpeg-dir}
36option on the configure command line when building Qt.
37
38\badcode
39qt-source/configure -ffmpeg-dir <FFMPEG_DIR>
40\endcode
41
42Here, \c{<FFMPEG_DIR>} is the directory containing the FFmpeg include,
43lib, and bin directories. To build Qt Multimedia without FFmpeg, omit
44the \c{<FFMPEG_DIR>} variable and specify the \c{-no-feature-ffmpeg}
45configure option.
46
47To build Qt Multimedia without native media backends, use
48\c{-no-feature-xxx} to exclude the corresponding features, such as
49\c gstreamer, \c native_windows_backend, \c native_darwin_backend or
50\c native_android_backend.
51
52\badcode
53qt-source/configure -no-feature-gstreamer
54\endcode
55
56If you prefer not to build all Qt's submodules, you can reduce configure
57and build times using the \c{-submodules} configure option. This will
58configure a build that only builds Qt Multimedia and its dependencies.
59
60\badcode
61qt-source/configure -submodules qtmultimedia -ffmpeg-dir <FFMPEG_DIR>
62\endcode
63
64If you configure Qt Multimedia against FFmpeg built with shared
65libraries (dynamic linking), the FFmpeg shared libraries must be in the
66module loader's search path to run tests or use examples.
67
68\note Qt Multimedia requires the FFmpeg avformat, avcodec, swresample,
69swscale, and avutil libraries during runtime to be able to use the
70FFmpeg media backend. If one or more of these dynamic libraries are not
71found during application startup, the FFmpeg media backend will fail to
72load, and the system will attempt to load the native backend. Qt
73Multimedia doesn't support as many features on native backends.
74
75If you don't already have these libraries in the \c{path}, specify the
76\c{-ffmpeg-deploy} configure option. With this option enabled,
77the necessary FFmpeg binaries will be copied to Qt's install directory
78during the build and install steps:
79
80\badcode
81qt-source/configure -submodules qtmultimedia -ffmpeg-dir <FFMPEG_DIR> -ffmpeg-deploy
82\endcode
83
84After configuring Qt Multimedia, carefully review the configure summary
85(found in the config.summary file). You can verify that FFmpeg is found
86under the "Plugin" section. Then follow the regular build and install
87steps described in \l{Building Qt Sources}.
88
89\note When building Qt Multimedia statically, the path to the FFmpeg libraries
90is baked into \c{libQt6FFmpegMediaPluginImpl.prl}. You will need to patch the
91path if your Qt is supposed to be used on a different machine.
92
93\section1 Platform Notes
94
95\section2 iOS
96
97\list
98 \li When configuring Qt Multimedia with FFmpeg support, the CMake
99 configuration process looks for \c .xcframework files in the
100 supplied FFmpeg directory. Using \c .dylib binaries directly
101 is not supported. See \l{Building FFmpeg from source for iOS on macOS}
102 and \l{https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle}
103 for details on how to package FFmpeg build artifacts into
104 \c .xcframework files.
105\endlist
106
107\section2 Linux
108
109\list
110 \li When configuring Qt Multimedia with FFmpeg enabled, the
111 pipewire or the pulseaudio development package is required. Without
112 one of these packages, FFmpeg will not be recognized.
113 \li When using a version of FFmpeg that is built with VAAPI support,
114 we recommend building Qt Multimedia with VAAPI support as well
115 to make hardware texture conversion possible. To configure Qt
116 Multimedia with VAAPI support, VAAPI developer libraries must be
117 installed on your system. Review the config.summary file to
118 verify that VAAPI support is enabled under the "Hardware
119 acceleration and features" section.
120 \li When configuring Qt Multimedia with the GStreamer backend, GStreamer
121 v1.20 is the minimum requirement. However, we recommend using the
122 latest stable GStreamer upstream release if possible.
123\endlist
124*/