Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtmultimedia-index.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page qtmultimedia-index.html
6 \title Qt Multimedia
7 \image noun_Media_166644.svg "image of multimedia icons, courtesy of misirlou from the Noun Project"
8 \brief The Qt Multimedia module provides APIs for playing back and recording
9 audiovisual content
10
11 Qt Multimedia is an add-on module that provides a rich set of QML types
12 and C++ classes to handle multimedia content. It contains an easy to use
13 API for playing back audio and video files and rendering those on screen, as
14 well as a comprehensive API for recording audio and video from the system's
15 cameras and microphones.
16
17 The functionality of this module is divided into the following submodules:
18
19 \table
20 \row
21 \li \l{Multimedia Overview}{Qt Multimedia}
22 \li Provides an API for multimedia-specific use cases.
23 \row
24 \li \l{Qt Multimedia Widgets}
25 \li Provides a widget-based multimedia API.
26 \row
27 \li \l{Qt Spatial Audio}
28 \li Provides an API for implementing sound fields in 3D space.
29 \endtable
30
31 \section1 Getting started
32 If you are porting from Qt 5 to Qt 6 see \l{Changes to Qt Multimedia}.
33
34 If you are new to Qt Multimedia, the QML types can be
35 \l{qtqml import syntax}{imported} into an application using the following
36 statement in your \c {.qml} file.
37
38 \qml
39 import QtMultimedia
40 \endqml
41
42 To link against the C++ libraries, add the following to your project's
43 \c CMakeLists.txt file. Substitute \c my_project with the name of your
44 project.
45
46 \code
47 find_package(Qt6 REQUIRED COMPONENTS Multimedia)
48 target_link_libraries(my_project PRIVATE Qt6::Multimedia)
49 \endcode
50
51 See \l {Building Qt Multimedia from sources} for guidance on building
52 Qt Multimedia from sources.
53
54 \section1 Overviews and important topics
55
56 \list
57 \li \l{Changes to Qt Multimedia}{Changes in Qt 6}
58 \li \l{Multimedia Overview}
59 \li \l{Audio Overview}
60 \li \l{Spatial Audio Overview}
61 \li \l{Video Overview}
62 \li \l{Camera Overview}
63 \li \l{Supported Media Formats}
64 \endlist
65
66 \section1 QML types
67
68 The following table outlines some important QML types.
69
70 \table
71 \header
72 \li Type
73 \li Description
74 \row
75 \li \l{MediaPlayer}
76 \li Add audio/video playback functionality to a scene.
77 \row
78 \li \l {QtMultimedia::CaptureSession}{CaptureSession}
79 \li Create a session for capturing audio/video.
80 \row
81 \li \l {QtMultimedia::Camera}{Camera}
82 \li Access a camera connected to the system.
83 \row
84 \li \l {QtMultimedia::AudioInput}{AudioInput}
85 \li Access an audio input (microphone) connected to the system.
86 \row
87 \li \l {QtMultimedia::AudioOutput}{AudioOutput}
88 \li Access an audio output (speaker, headphone) connected to the system.
89 \row
90 \li \l {QtMultimedia::VideoOutput}{VideoOutput}
91 \li Display video content.
92 \row
93 \li \l {QtMultimedia::MediaRecorder}{MediaRecorder}
94 \li Record audio/video from the CaptureSession.
95 \row
96 \li \l {QtMultimedia::ImageCapture}{ImageCapture}
97 \li Capture still images from the Camera.
98 \row
99 \li \l {QtMultimedia::Video}{Video}
100 \li Add Video playback functionality to a scene. Uses MediaPlayer and
101 VideoOutput types to provide video playback functionality.
102 \row
103 \li \l {QtMultimedia::ScreenCapture}{ScreenCapture}
104 \li Captures a screen.
105 \row
106 \li \l {QtMultimedia::WindowCapture}{WindowCapture}
107 \li Captures a top-level window.
108 \endtable
109
110 \section1 C++ classes
111
112 The following table outlines some important C++ classes
113
114 \table
115 \header
116 \li Class
117 \li Description
118 \row
119 \li QMediaPlayer
120 \li Playback media from a source.
121 \row
122 \li QVideoWidget
123 \li Display video from a media player or a capture session.
124 \row
125 \li QMediaCaptureSession
126 \li Capture audio and video.
127 \row
128 \li QCamera
129 \li Access a camera connected to the system
130 \row
131 \li QAudioInput
132 \li Access an audio input (microphone) connected to the system.
133 \row
134 \li QAudioOutput
135 \li Access an audio output (speaker, headphone) connected to the system.
136 \row
137 \li QImageCapture
138 \li Capture still images with a camera.
139 \row
140 \li QMediaRecorder
141 \li Record media content from a capture session.
142 \row
143 \li QVideoSink
144 \li Access and render individual video frames.
145 \row
146 \li QAudioSink
147 \li Sends raw audio data to an audio output device.
148 \row
149 \li QScreenCapture
150 \li Captures a screen.
151 \row
152 \li QWindowCapture
153 \li Captures a top-level window.
154 \endtable
155
156 For playback QMediaPlayer, QAudioOutput and QVideoOutput contain all the required functionality.
157 The other classes are used for capturing audio and video content, where the QMediaCaptureSession is the central
158 class managing the whole capture/recording process.
159
160 \section1 Licenses and attributions
161
162 The Qt Multimedia module is available under commercial licenses from
163 \l{The Qt Company}.
164 In addition, it is available under free software licenses. Since Qt 5.6,
165 these free software licenses are
166 \l{GNU Lesser General Public License, version 3}, or
167 the \l{GNU General Public License, version 2}.
168 See \l{Qt Licensing} for further details.
169
170 Furthermore, Qt Multimedia in Qt \QtVersion may contain third-party modules
171 under following permissive licenses:
172
173 \generatelist{groupsbymodule attributions-qtmultimedia}
174
175 Note that video compression standards, such as the H.264 media compression
176 standard, may be covered by patents and can incur royalty fees. This can
177 apply to any implementation, also if the implementation is provided as an
178 operating system service, through a third party library, or through any of
179 Qt Multimedia's backends. Such fees are not covered by the Qt licenses.
180
181 \section1 Target platform and backend notes
182 We aim to align the behavior on all the platforms but there are some issues
183 to consider.
184
185 \section2 Backends
186 On most platforms, there are two different backends that can be used for
187 Qt Multimedia.
188
189 \section3 FFmpeg as the default backend
190 In this release the \l {http://ffmpeg.org}{FFmpeg framework} is set as the
191 default backend on Windows, macOS, Android, and Linux except Yocto distribution.
192
193 The version shipped with Qt binary packages is \b{FFmpeg 6.1.1} and is tested
194 by the maintainers.
195
196 \note On the Windows platform, Qt's FFmpeg media backend uses
197 dynamic linking to the FFmpeg libraries. Windows applications must
198 therefore bundle FFmpeg binaries in their installer, and make them
199 visible to the application according to Windows dll loading rules.
200 We recommend to store the FFmpeg dlls in the same directory as the
201 application's executable file, because this guarantees that the
202 correct build of FFmpeg is being used if multiple versions are
203 available on the system. All necessary FFmpeg dlls are shipped with
204 the Qt Online Installer and are automatically deployed if the
205 windeployqt tool is used to create the deployment. Applications can
206 also deploy their own build of FFmpeg, as long as the FFmpeg major
207 version matches the version used by Qt.
208
209 \note See \l{Licenses and Attributions} regarding what components are removed
210 in the package shipped by Qt.
211
212 \section3 Native backends
213 These are:
214 \list
215 \li gstreamer on Linux
216 \li AVFoundation on macOS and iOS
217 \li WMF Windows
218 \li MediaCodec framework on Android
219 \endlist
220
221 \note These are still available but with \b limited support. The gstreamer
222 backend is only available on Linux.
223
224 \section2 Backend support
225 Maintainers will strive to fix critical issues with the native backends but
226 don't guarantee fixing minor issues and won't implement new features for the
227 native backends. Furthermore, even some major issues with the gstreamer
228 backend (on Linux) won't be fixed since gstreamer is difficult to debug and
229 is further complicated as it is dependent on Linux distributions.
230
231 We aim to align the behavior on all the platforms, especially, with the
232 FFmpeg backend. Despite this fact we still have platform-dependent issues
233 with formats, codecs, advanced camera features, and screen capturing due to
234 the Qt Multimedia API relying on target platform APIs. For example, with FFmpeg,
235 there are specific problems with hardware acceleration on Linux targets with
236 ARM architectures.
237
238 Backend-dependent limitations will be documented and their status maintained
239 in the respective classes.
240
241 \section2 Changing backends
242
243 In the case of issues with the default FFmpeg backend, we suggest testing with a native backend.
244 You can switch to native backends by setting the \c{QT_MEDIA_BACKEND} environment variable
245 to \c windows, \c gstreamer (on Linux), \c darwin (on macOS and iOS), or \c android:
246
247 \code
248 export QT_MEDIA_BACKEND=darwin
249 \endcode
250
251 In order to force assign FFmpeg as the used backend, set the variable to \c ffmpeg:
252
253 \code
254 export QT_MEDIA_BACKEND=ffmpeg
255 \endcode
256
257 On the Qt Multimedia compilation stage the default media backend can be configured
258 via cmake variable \c{QT_DEFAULT_MEDIA_BACKEND}.
259
260 \section2 Target platform notes
261 The following pages list issues for specific target platforms that are not
262 related to the multimedia backed.
263
264 \list
265 \li \l{Qt Multimedia on macOS and iOS}{macOS and iOS}
266 \li \l{Qt Multimedia on WebAssembly}{WebAssembly}
267 \endlist
268
269 \section1 Permissions
270
271 Starting from Qt 6.6, the Qt Multimedia module uses new \l QPermission API
272 to handle \l {QCameraPermission}{camera} and
273 \l {QMicrophonePermission}{microphone} permissions. This means that Qt
274 itself no longer queries for these permissions, so this needs to be done
275 directly from the client application.
276
277 Please refer to the \l {Application Permissions} page for an example of how
278 to integrate the new \l QPermission API into the application.
279
280 \section1 Reference and examples
281 \list
282 \li \l{Qt Multimedia QML Types}{QML Types}
283 \li \l{Qt Multimedia C++ Classes}{C++ Classes}
284 \li \l{Qt Multimedia Examples}{Examples}
285 \endlist
286*/