Qt 6.x
The Qt SDK
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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-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 \section1 Overviews and important topics
52
53 \list
54 \li \l{Changes to Qt Multimedia}{Changes in Qt 6}
55 \li \l{Multimedia Overview}
56 \li \l{Audio Overview}
57 \li \l{Spatial Audio Overview}
58 \li \l{Video Overview}
59 \li \l{Camera Overview}
60 \li \l{Supported Media Formats}
61 \endlist
62
63 \section1 QML types
64
65 The following table outlines some important QML types.
66
67 \table
68 \header
69 \li Type
70 \li Description
71 \row
72 \li \l{MediaPlayer}
73 \li Add audio/video playback functionality to a scene.
74 \row
75 \li \l {QtMultimedia::CaptureSession}{CaptureSession}
76 \li Create a session for capturing audio/video.
77 \row
78 \li \l {QtMultimedia::Camera}{Camera}
79 \li Access a camera connected to the system.
80 \row
81 \li \l {QtMultimedia::AudioInput}{AudioInput}
82 \li Access an audio input (microphone) connected to the system.
83 \row
84 \li \l {QtMultimedia::AudioOutput}{AudioOutput}
85 \li Access an audio output (speaker, headphone) connected to the system.
86 \row
87 \li \l {QtMultimedia::VideoOutput}{VideoOutput}
88 \li Display video content.
89 \row
90 \li \l {QtMultimedia::MediaRecorder}{MediaRecorder}
91 \li Record audio/video from the CaptureSession.
92 \row
93 \li \l {QtMultimedia::ImageCapture}{ImageCapture}
94 \li Capture still images from the Camera.
95 \row
96 \li \l {QtMultimedia::Video}{Video}
97 \li Add Video playback functionality to a scene. Uses MediaPlayer and
98 VideoOutput types to provide video playback functionality.
99 \row
100 \li \l {QtMultimedia::ScreenCapture}{ScreenCapture}
101 \li Captures a screen.
102 \row
103 \li \l {QtMultimedia::WindowCapture}{WindowCapture}
104 \li Captures a top-level window.
105 \endtable
106
107 \section1 C++ classes
108
109 The following table outlines some important C++ classes
110
111 \table
112 \header
113 \li Class
114 \li Description
115 \row
116 \li QMediaPlayer
117 \li Playback media from a source.
118 \row
119 \li QVideoWidget
120 \li Display video from a media player or a capture session.
121 \row
122 \li QMediaCaptureSession
123 \li Capture audio and video.
124 \row
125 \li QCamera
126 \li Access a camera connected to the system
127 \row
128 \li QAudioInput
129 \li Access an audio input (microphone) connected to the system.
130 \row
131 \li QAudioOutput
132 \li Access an audio output (speaker, headphone) connected to the system.
133 \row
134 \li QImageCapture
135 \li Capture still images with a camera.
136 \row
137 \li QMediaRecorder
138 \li Record media content from a capture session.
139 \row
140 \li QVideoSink
141 \li Access and render individual video frames.
142 \row
143 \li QAudioSink
144 \li Sends raw audio data to an audio output device.
145 \row
146 \li QScreenCapture
147 \li Captures a screen.
148 \row
149 \li QWindowCapture
150 \li Captures a top-level window.
151 \endtable
152
153 For playback QMediaPlayer, QAudioOutput and QVideoOutput contain all the required functionality.
154 The other classes are used for capturing audio and video content, where the QMediaCaptureSession is the central
155 class managing the whole capture/recording process.
156
157 \section1 Licenses and attributions
158
159 The Qt Multimedia module is available under commercial licenses from
160 \l{The Qt Company}.
161 In addition, it is available under free software licenses. Since Qt 5.6,
162 these free software licenses are
163 \l{GNU Lesser General Public License, version 3}, or
164 the \l{GNU General Public License, version 2}.
165 See \l{Qt Licensing} for further details.
166
167 The FFmpeg backend uses the \l {https://ffmpeg.org}{FFmpeg framework}.
168 FFmpeg is licensed under LGPLv2.1, GPLv2, or later versions of the licenses.
169 Some optional components of FFmpeg are only available under GPL. The FFmpeg
170 backend shipped with the Qt binary packages is configured to not contain any
171 of the components that are available under GPLv2 only.
172
173 See the \l {https://ffmpeg.org/legal.html}{FFmpeg licensing page} for further
174 details.
175
176 \section1 Target platform and backend notes
177 We aim to align the behavior on all the platforms but there are some issues
178 to consider.
179
180 \section2 Backends
181 On most platforms, there are two different backends that can be used for
182 Qt Multimedia.
183
184 \section3 FFmpeg as the default backend
185 In this release the \l {http://ffmpeg.org}{FFmpeg framework} is set as the
186 default backend on Windows, macOS, Android, and Linux except Yocto distribution.
187
188 The version shipped with Qt binary packages is \b{FFmpeg 6.0} and is tested
189 by the maintainers.
190
191 \note See \l{Licenses and Attributions} regarding what components are removed
192 in the package shipped by Qt.
193
194 \section3 Native backends
195 These are:
196 \list
197 \li gstreamer on Linux
198 \li AVFoundation on macOS
199 \li WMF Windows
200 \li MediaCodec framework on Android
201 \endlist
202
203 \note These are still available but with \b limited support.
204
205 \section2 Backend support
206 Maintainers will strive to fix critical issues with the native backends but
207 don't guarantee fixing minor issues and won't implement new features for the
208 native backends. Furthermore, even some major issues with the gstreamer
209 backend (on Linux) won't be fixed since gstreamer is difficult to debug and
210 is further complicated as it is dependent on Linux distributions.
211
212 We aim to align the behavior on all the platforms, especially, with the
213 FFmpeg backend. Despite this fact we still have platform-dependent issues
214 with formats, codecs, advanced camera features, and screen capturing due to
215 the Qt Multimedia API relying on target platform APIs. For example, with FFmpeg,
216 there are specific problems with hardware acceleration on Linux targets with
217 ARM architectures.
218
219 Backend-dependent limitations will be documented and their status maintained
220 in the respective classes.
221
222 \section2 Changing backends
223
224 In the case of issues with the default FFmpeg backend, we suggest testing with a native backend.
225 You can switch to native backends by setting the \c{QT_MEDIA_BACKEND} environment variable
226 to \c windows, \c gstreamer (on Linux), \c darwin (on macOS), or \c android:
227
228 \code
229 export QT_MEDIA_BACKEND=darwin
230 \endcode
231
232 In order to force assign FFmpeg as the used backend, set the variable to \c ffmpeg:
233
234 \code
235 export QT_MEDIA_BACKEND=ffmpeg
236 \endcode
237
238 On the Qt Multimedia compilation stage the default media backend can be configured
239 via cmake variable \c{QT_DEFAULT_MEDIA_BACKEND}.
240
241 \section2 Target platform notes
242 The following pages list issues for specific target platforms that are not
243 related to the multimedia backed.
244
245 \list
246 \li \l{Qt Multimedia on macOS and iOS}{macOS and iOS}
247 \li \l{Qt Multimedia on WebAssembly}{WebAssembly}
248 \endlist
249
250 \section1 Permissions
251
252 Starting from Qt 6.6, the Qt Multimedia module uses new \l QPermission API
253 to handle \l {QCameraPermission}{camera} and
254 \l {QMicrophonePermission}{microphone} permissions. This means that Qt
255 itself no longer queries for these permissions, so this needs to be done
256 directly from the client application.
257
258 Please refer to the \l {Application Permissions} page for an example of how
259 to integrate the new \l QPermission API into the application.
260
261 \section1 Reference and examples
262 \list
263 \li \l{Qt Multimedia QML Types}{QML Types}
264 \li \l{Qt Multimedia C++ Classes}{C++ Classes}
265 \li \l{Qt Multimedia Examples}{Examples}
266 \endlist
267*/