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
5 \page qtmultimedia-index.html
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
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.
17 The functionality of this module is divided into the following submodules:
21 \li \l{Multimedia Overview}{Qt Multimedia}
22 \li Provides an API for multimedia-specific use cases.
24 \li \l{Qt Multimedia Widgets}
25 \li Provides a widget-based multimedia API.
27 \li \l{Qt Spatial Audio}
28 \li Provides an API for implementing sound fields in 3D space.
31 \section1 Getting started
32 If you are porting from Qt 5 to Qt 6 see \l{Changes to Qt Multimedia}.
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.
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
47 find_package(Qt6 REQUIRED COMPONENTS Multimedia)
48 target_link_libraries(my_project PRIVATE Qt6::Multimedia)
51 \section1 Overviews and important topics
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}
65 The following table outlines some important QML types.
73 \li Add audio/video playback functionality to a scene.
75 \li \l {QtMultimedia::CaptureSession}{CaptureSession}
76 \li Create a session for capturing audio/video.
78 \li \l {QtMultimedia::Camera}{Camera}
79 \li Access a camera connected to the system.
81 \li \l {QtMultimedia::AudioInput}{AudioInput}
82 \li Access an audio input (microphone) connected to the system.
84 \li \l {QtMultimedia::AudioOutput}{AudioOutput}
85 \li Access an audio output (speaker, headphone) connected to the system.
87 \li \l {QtMultimedia::VideoOutput}{VideoOutput}
88 \li Display video content.
90 \li \l {QtMultimedia::MediaRecorder}{MediaRecorder}
91 \li Record audio/video from the CaptureSession.
93 \li \l {QtMultimedia::ImageCapture}{ImageCapture}
94 \li Capture still images from the Camera.
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.
100 \li \l {QtMultimedia::ScreenCapture}{ScreenCapture}
101 \li Captures a screen.
103 \li \l {QtMultimedia::WindowCapture}{WindowCapture}
104 \li Captures a top-level window.
107 \section1 C++ classes
109 The following table outlines some important C++ classes
117 \li Playback media from a source.
120 \li Display video from a media player or a capture session.
122 \li QMediaCaptureSession
123 \li Capture audio and video.
126 \li Access a camera connected to the system
129 \li Access an audio input (microphone) connected to the system.
132 \li Access an audio output (speaker, headphone) connected to the system.
135 \li Capture still images with a camera.
138 \li Record media content from a capture session.
141 \li Access and render individual video frames.
144 \li Sends raw audio data to an audio output device.
147 \li Captures a screen.
150 \li Captures a top-level window.
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.
157 \section1 Licenses and attributions
159 The Qt Multimedia module is available under commercial licenses from
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.
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.
173 See the \l {https://ffmpeg.org/legal.html}{FFmpeg licensing page} for further
176 \section1 Target platform and backend notes
177 We aim to align the behavior on all the platforms but there are some issues
181 On most platforms, there are two different backends that can be used for
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.
188 The version shipped with Qt binary packages is \b{FFmpeg 6.0} and is tested
191 \note See \l{Licenses and Attributions} regarding what components are removed
192 in the package shipped by Qt.
194 \section3 Native backends
197 \li gstreamer on Linux
198 \li AVFoundation on macOS
200 \li MediaCodec framework on Android
203 \note These are still available but with \b limited support.
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.
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
219 Backend-dependent limitations will be documented and their status maintained
220 in the respective classes.
222 \section2 Changing backends
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:
229 export QT_MEDIA_BACKEND=darwin
232 In order to force assign FFmpeg as the used backend, set the variable to \c ffmpeg:
235 export QT_MEDIA_BACKEND=ffmpeg
238 On the Qt Multimedia compilation stage the default media backend can be configured
239 via cmake variable \c{QT_DEFAULT_MEDIA_BACKEND}.
241 \section2 Target platform notes
242 The following pages list issues for specific target platforms that are not
243 related to the multimedia backed.
246 \li \l{Qt Multimedia on macOS and iOS}{macOS and iOS}
247 \li \l{Qt Multimedia on WebAssembly}{WebAssembly}
250 \section1 Permissions
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.
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.
261 \section1 Reference and examples
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}