1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \page qtmultimedia-changes-qt6.html
6 \title Changes to Qt Multimedia
7 \ingroup changes-qt-5-to-6
8 \brief Migrate Qt Multimedia to Qt 6.
10 Qt 6 is a result of the conscious effort to make the framework more
11 efficient and easy to use.
13 We try to maintain binary and source compatibility for all the public
14 APIs in each release. But some changes were inevitable in an effort to
15 make Qt a better framework.
17The module has been refactored significantly and has changed classification,
18from essential to add-on. The Qt Multimedia module in Qt 6 replaces the
19Qt Multimedia module from Qt 5.x. Existing code that uses Qt Multimedia from
20Qt 5 can be ported with limited effort.
23\section1 New features in Qt 6
25There are a number of new features in Qt Multimedia:
27 \li QMediaCaptureSession class is the central object for media capture.
28 \li QMediaRecorder class is now a class limited to recording audio and video.
29 It handles encoding of data produced in a capture session.
30 \li Using QMediaFormat and QMediaRecorder, setting up the desired encoding
31 when recording has changed significantly.
32 \li You can now also monitor the audio recorded by a capture session.
33 \li Support for selection of audio, video and subtitle tracks when playing
34 back media files has been added.
35 \li QAudioDecoder is now supported on all platforms.
39\section1 Removed features
44 \li Notes or suggested alternative
46 \li Playlist in QMediaPlayer
47 \li QMediaPlayer does not do any playlist handling anymore in Qt 6.
50 \li This class has been removed from the API. It does however still exist
51 as part of the \l{Media Player Example}.
53 \li QAudioProbe and QVideoProbe
54 \li The audio and video probing API has been removed.
57 \li Use the QMediaCaptureSession or CaptureSession QML type.
59 \li \l{Audio QML type}
60 \li Use MediaPlayer QML type.
62 \li QMediaObject and QMediaBindableInterface
63 \li These classes have been removed in favor of a more direct API for
64 setting up connections between objects using, for example, setVideoOutput
65 and QMediaCaptureSession.
67 \li QCameraViewFinderSettings
68 \li This class has been removed. Use QCameraFormat to define the
69 resolution and frame rate the camera should be using.
72 \li The class has been removed. Use QUrl for individual media files instead.
75 \li Use QSoundEffect instead.
77 \li QVideoFilterRunnable
78 \li Use \l{shader effects} in QML instead or access the QVideoFrame's
81 \li Public back-end API
82 \li The back-end API of Qt Multimedia is private in Qt 6. This improves
83 response time for supporting new multimedia use cases. Any classes that
84 contain the words "Control" or "Abstract" in the class name in Qt 5 are
88 \li Qt Multimedia in Qt 6 does not use a plugin infrastructure for its
90 This means that users no longer need to ship those back ends with their
91 application. Instead, the back end being used is determined at compile
92 time based on the underlying operating system. Qt uses \l gstreamer on
93 Linux, WMF on Windows, AVFoundation on macOS and iOS and the Android
94 multimedia APIs on Android.
97\section1 Changed features
99A number of classes previously offered in Qt Multimedia have
100changed in ways that may affect previously written code. The following table
101highlights these changes.
108 \li Handling of Camera resolutions and frame rates
109 \li Handling of these has been simplified and a new QCameraFormat class
110 helps with selecting the correct resolution and frame rate for the camera.
112 \li Video output handling on the C++ side has changed significantly.
113 \li QAbstractVideoSurface has been replaced by the QVideoSink class, and
114 generic rendering support has been enhanced to cover all \l{pixel format}s
115 supported by Qt Multimedia.
118 \li QMediaMetaData has changed significantly: mainly moving from string
119 based to enum based keys, and reducing the set of supported keys to the
120 ones that can be supported on most platforms.
123 \li Handling of formats for encoded media and the settings for the media
124 recorder have changed significantly. Qt 5 provides a string-based
125 API, a separated file format, and audio and video codecs into three classes.
126 However, Qt 6 unifies the formats in the QMediaFormat class. Additional
127 settings are directly specified in QMediaRecorder. Setting up file formats
128 and codecs is now implemented with enums and no longer uses strings. This
129 puts some limitations on the set of codecs that can be used, but helps
130 provide a consistent cross-platform API.
132 \li QCameraImageCapture renamed QImageCapture
135 \li Audio inputs and outputs
136 \li QMediaPlayer and QMediaCaptureSession (and the corresponding QML types MediaPlayer and
137 CaptureSession) are not connected to any audio devices by default. Explicitly connect them
138 to a QAudioInput/AudioInput or QAudioOutput/AudioOutput to capture or play back audio.
141 \li A capture session is by default not connected to a Camera. Connect it to a QCamera object
142 (Camera item) to be able to capture video or still images.