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-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,
14
as well as a comprehensive API for recording audio and video from various
15
sources, including system cameras and microphones, screen or window
16
captures, and audio or video memory buffers.
17
18
The functionality of this module is divided into the following submodules:
19
20
\table
21
\row
22
\li \l{Multimedia Overview}{Qt Multimedia}
23
\li Provides an API for multimedia-specific use cases.
24
\row
25
\li \l{Qt Multimedia Widgets}
26
\li Provides a widget-based multimedia API.
27
\row
28
\li \l{Qt Spatial Audio}
29
\li Provides an API for implementing sound fields in 3D space.
30
\endtable
31
32
\section1 Getting started
33
If you are porting from Qt 5 to Qt 6, see \l{Changes to Qt Multimedia}.
34
35
If you are new to Qt Multimedia, the QML types can be
36
\l{qtqml import syntax}{imported} into an application using the following
37
statement in your \c {.qml} file.
38
39
\qml
40
import QtMultimedia
41
\endqml
42
43
To link against the C++ libraries, add the following to your project's
44
\c CMakeLists.txt file. Substitute \c my_project with the name of your
45
project.
46
47
\code
48
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
49
target_link_libraries(my_project PRIVATE Qt6::Multimedia)
50
\endcode
51
52
See \l {Building Qt Multimedia from sources} for guidance on building
53
Qt Multimedia from sources.
54
55
\section1 Overviews and important topics
56
57
\list
58
\li \l{Changes to Qt Multimedia}{Changes in Qt 6}
59
\li \l{Multimedia Overview}
60
\li \l{Audio Overview}
61
\li \l{Spatial Audio Overview}
62
\li \l{Video Overview}
63
\li \l{Camera Overview}
64
\li \l{Supported Media Formats}
65
\endlist
66
67
\section1 QML types
68
69
The following table outlines some important QML types.
70
71
\table
72
\header
73
\li Type
74
\li Description
75
\row
76
\li \l{MediaPlayer}
77
\li Add audio/video playback functionality to a scene.
78
\row
79
\li \l {QtMultimedia::CaptureSession}{CaptureSession}
80
\li Create a session for capturing audio/video.
81
\row
82
\li \l {QtMultimedia::Camera}{Camera}
83
\li Access a camera connected to the system.
84
\row
85
\li \l {QtMultimedia::AudioInput}{AudioInput}
86
\li Access an audio input (microphone) connected to the system.
87
\row
88
\li \l {QtMultimedia::AudioOutput}{AudioOutput}
89
\li Access an audio output (speaker, headphone) connected to the system.
90
\row
91
\li \l {QtMultimedia::VideoOutput}{VideoOutput}
92
\li Display video content.
93
\row
94
\li \l {QtMultimedia::MediaRecorder}{MediaRecorder}
95
\li Record audio/video from the CaptureSession.
96
\row
97
\li \l {QtMultimedia::ImageCapture}{ImageCapture}
98
\li Capture still images from the Camera.
99
\row
100
\li \l {QtMultimedia::Video}{Video}
101
\li Add Video playback functionality to a scene. Uses MediaPlayer and
102
VideoOutput types to provide video playback functionality.
103
\row
104
\li \l {QtMultimedia::ScreenCapture}{ScreenCapture}
105
\li Captures a screen.
106
\row
107
\li \l {QtMultimedia::WindowCapture}{WindowCapture}
108
\li Captures a top-level window.
109
\row
110
\li \l {QtMultimedia::GStreamerVideoSource}{GStreamerVideoSource}
111
\li Custom GStreamer video source (with the GStreamer media backend).
112
\endtable
113
114
\section1 C++ classes
115
116
The following table outlines some important C++ classes.
117
118
\table
119
\header
120
\li Class
121
\li Description
122
\row
123
\li QMediaPlayer
124
\li Playback media from a source.
125
\row
126
\li QVideoWidget
127
\li Display video from a media player or a capture session.
128
\row
129
\li QMediaCaptureSession
130
\li Capture audio and video.
131
\row
132
\li QCamera
133
\li Access a camera connected to the system
134
\row
135
\li QAudioInput
136
\li Access an audio input (microphone) connected to the system.
137
\row
138
\li QAudioOutput
139
\li Access an audio output (speaker, headphone) connected to the system.
140
\row
141
\li QImageCapture
142
\li Capture still images with a camera.
143
\row
144
\li QMediaRecorder
145
\li Record media content from a capture session.
146
\row
147
\li QVideoSink
148
\li Access and render individual video frames.
149
\row
150
\li QAudioSink
151
\li Sends raw audio data to an audio output device.
152
\row
153
\li QScreenCapture
154
\li Captures a screen.
155
\row
156
\li QWindowCapture
157
\li Captures a top-level window.
158
\row
159
\li QVideoFrameInput
160
\li Used to display or record video frames from memory buffers.
161
\row
162
\li QAudioBufferInput
163
\li Supports playing or recording audio from memory buffers.
164
\row
165
\li QGStreamerVideoSource
166
\li Custom GStreamer video source (with the GStreamer media backend).
167
168
\endtable
169
170
For playback of audio and video, QMediaPlayer, QAudioOutput, and
171
QVideoWidget contain all necessary functionality. Other classes are
172
dedicated to capturing audio and video content, with
173
QMediaCaptureSession serving as the central class that manages the
174
entire capture and recording process.
175
176
\section1 Licenses and attributions
177
178
The Qt Multimedia module is available under commercial licenses from
179
\l{The Qt Company}.
180
In addition, it is available under free software licenses. Since Qt 5.6,
181
these free software licenses are
182
\l{GNU Lesser General Public License, version 3}, or
183
the \l{GNU General Public License, version 2}.
184
See \l{Qt Licensing} for further details.
185
186
Furthermore, Qt Multimedia in Qt \QtVersion may contain third-party modules
187
under the following permissive licenses:
188
189
\annotatedlist attributions-qtmultimedia
190
191
Note that video compression standards, such as the H.264 media compression
192
standard, may be covered by patents and can incur royalty fees. This can
193
apply to any implementation, also if the implementation is provided as an
194
operating system service, through a third-party library, or any of
195
Qt Multimedia's backends. The Qt licenses do not cover such fees.
196
197
\section1 Target platform and backend notes
198
Qt Multimedia offers user-friendly, cross-platform APIs for media
199
playback, recording, and device management. The implementation of
200
core APIs, including QMediaDevices, QAudioDevice, QSoundEffect,
201
QAudioSink, and QAudioSource are integrated into the main Qt
202
Multimedia library, eliminating the need for additional libraries.
203
Other Qt Multimedia APIs are implemented using plugin libraries
204
known as media backends. The main media backend, built on \l
205
{http://ffmpeg.org}{FFmpeg}, ensures seamless cross-platform
206
functionality, and is the default on all platforms except
207
WebAssembly and embedded Linux/Boot2Qt. With Boot2Qt, the default
208
backend is built on top of \l
209
{https://gstreamer.freedesktop.org/}{GStreamer}, but the FFmpeg
210
media backend can be enabled using the \c{QT_MEDIA_BACKEND}
211
environment variable.
212
213
\section2 The FFmpeg backend
214
215
The FFmpeg media backend relies on the \b{FFmpeg \ffmpegversion} libraries,
216
which are included with the Qt Online Installer and tested by the
217
maintainers. The binary packages from the online installer use
218
dynamic linking to FFmpeg. Therefore, applications must either
219
bundle FFmpeg binaries in their installer or depend on FFmpeg being
220
installed on the operating system. The FFmpeg libraries are
221
automatically deployed using Qt's deployment tools as described in
222
the \l{Deploying Qt Applications} documentation, except for \l{Qt
223
for Linux/X11 - Deployment}{Linux/X11}. Applications can also deploy
224
their own build of FFmpeg, either as shared or static libraries,
225
provided the FFmpeg major version matches the version used by Qt.
226
227
While Qt Multimedia leverages the FFmpeg media backend on most
228
operating systems, platform specific functional or visual
229
differences may arise between applications on different platforms.
230
FFmpeg does not provide identical codec and format support across
231
all platforms, and the performance of Qt Multimedia features may
232
depend on hardware support that is only available on certain
233
platforms. For instance, FFmpeg encounters specific issues with
234
hardware acceleration on Linux targets with ARM architectures.
235
Therefore, it is recommended to test Qt Multimedia applications on
236
all target platforms.
237
238
\note The FFmpeg project provides features under various licenses.
239
The pre-built FFmpeg libraries that are provided through the Online
240
Installer are only including features that agree with the permissive
241
licenses listed under \l{Licenses and Attributions}.
242
243
To ease development and debugging, some FFmpeg functionality is
244
configurable via \l {advanced-ffmpeg-configuration}{environment
245
varibles} which are part of the private Qt Multimedia API.
246
247
\section2 Native backends
248
249
For compatibility with existing applications, we maintain native
250
media backends for each operating system:
251
252
\list
253
\li \l{Qt Multimedia GStreamer Backend}{GStreamer backend} on Embedded Linux
254
\li AVFoundation on macOS and iOS
255
\li Windows Media Foundation on Windows (deprecated since Qt 6.10)
256
\li MediaCodec framework on Android
257
\li WebAudio and WebVideo on WebAssembly
258
\endlist
259
260
\note The FFmpeg media backend is the default backend except on WebAssembly,
261
native backends are still available but with \b limited support. The
262
GStreamer backend is only available on Linux, and is only
263
recommended for embedded applications.
264
\note MediaCodec on Android is deprecated as of Qt 6.8 and will be
265
removed in the next major release.
266
\note The Windows media backend built on top of Windows Media
267
Foundation is deprecated as of Qt 6.10 and will be removed in the
268
next major release.
269
270
Qt Maintainers will strive to fix critical issues with the native
271
backends but don't guarantee fixing minor issues, including
272
inconsistent behavior across platforms. New features will only be
273
implemented on the FFmpeg media backend, with the exception of WebAssembly.
274
275
The GStreamer backend has some private APIs to allow more fine-grained control.
276
However, there are known bugs in the GStreamer backend. More details can be found
277
in \l{Qt Multimedia GStreamer Backend}{platform notes for the GStreamer backend}.
278
279
Backend limitations will be documented, and their status will be maintained in the
280
respective classes.
281
282
\section2 Changing backends
283
284
In the case of issues with the default FFmpeg backend, we suggest testing with a native backend.
285
You can switch to native backends by setting the \c{QT_MEDIA_BACKEND} environment variable
286
to \c windows, \c gstreamer (on Embedded Linux), \c darwin (on macOS and iOS), or \c android:
287
288
\code
289
export QT_MEDIA_BACKEND=darwin
290
\endcode
291
292
To force assign FFmpeg as the used backend, set the variable to \c ffmpeg:
293
294
\code
295
export QT_MEDIA_BACKEND=ffmpeg
296
\endcode
297
298
On the Qt Multimedia compilation stage, the default media backend can be configured
299
via cmake variable \c{QT_DEFAULT_MEDIA_BACKEND}.
300
301
\section2 Target platform notes
302
The following pages list issues for specific target platforms.
303
304
\list
305
\li \l{Qt Multimedia on macOS and iOS}{macOS and iOS}
306
\li \l{Qt Multimedia on WebAssembly}{WebAssembly}
307
\li \l{Qt Multimedia on Windows}{Windows}
308
\li \l{Qt Multimedia on Linux}{Linux}
309
\li \l{Qt Multimedia GStreamer Backend}{GStreamer backend for embedded Linux}
310
\endlist
311
312
\section1 Permissions
313
314
Starting from Qt 6.6, the Qt Multimedia module uses the new \l QPermission API
315
to handle \l {QCameraPermission}{camera} and
316
\l {QMicrophonePermission}{microphone} permissions. This means that Qt
317
itself no longer queries for these permissions, so this needs to be done
318
directly from the client application.
319
320
Please refer to the \l {Application Permissions} page for an example of how
321
to integrate the new \l QPermission API into the application.
322
323
\section1 Reference and examples
324
\list
325
\li \l{Qt Multimedia QML Types}{QML Types}
326
\li \l{Qt Multimedia C++ Classes}{C++ Classes}
327
\li \l{Qt Multimedia Examples}{Examples}
328
\endlist
329
*/
qtmultimedia
src
multimedia
doc
src
qtmultimedia-index.qdoc
Generated on
for Qt by
1.16.1