Changes in Qt Multimedia

The Qt Multimedia module in Qt 6 replaces the Qt Multimedia module from Qt 5.x. Existing code that uses Qt Multimedia from Qt 5 can be ported with limited effort. The changed features section highlights changes relevant to porting.

New features in Qt 6

There are a number of new features in Qt Multimedia:

  • QMediaCaptureSession class is the central object for media capture.
  • Changed QMediaRecorder class to be a high level class for audio/video recording.
  • new QMediaRecorder class to handle encoding of data produced in a capture session.
  • Setting up the desired encoding when recording has changed significantly. see QMediaFormat and QMediaRecorder for details.
  • Support for selection of audio, video and subtitle tracks when playing back media files has been added.
  • QAudioDecoder is now supported on all platforms.

Removed Features

Removed featureNotes or suggested alternative
Playlist in QMediaPlayerQMediaPlayer does not do any playlist handling anymore in Qt 6. The QMediaPlayList class does however still exist and provides this functionality. Users will need to connect the playlist to the mediaplayer themselves to handle playlists.
QAudioProbe and QVideoProbeThe audio and video probing API has been removed.
QAudioRecorder and the Audio QML typeUse a QMediaCaptureSession or the CaptureSession QML type.
QMediaObject and QMediaBindableInterfaceThese classes have been removed in favor of a more direct API for setting up connections between objects using e.g. setVideoOutput and QMediaCaptureSession.
QCameraViewFinderSettingsThis class has been removed. Use QCameraFormat to define the resolution and frame rate the camera should be using.
QMediaContentThe class has been removed. Use QMediaPlayList for playlists and QUrl for individual media files instead.
QSoundUse QSoundEffect instead.
QVideoFilterRunnableUse shader effects in QML instead or access the QVideoFrame's content in C++.
Public back end APIThe back end API of Qt Multimedia is private in Qt 6. This improves response time for supporting new multimedia use cases. This includes all classes that contain "Control" or "Abstract" in the class name in Qt 5.
Back ends as pluginsQt Multimedia in Qt 6 does not use a plugin infrastructure for its back ends anymore. This means that users no longer need to ship those back ends with their application. Instead, the back end being used is determined at compile time based on the underlying operating system. Qt uses gstreamer on Linux, WMF on Windows, AVFoundation on macOS and iOS and the Android multimedia APIs on Android.

Changed features

A number of classes previously offered in Qt Multimedia or Qt Multimedia Kit have changed in ways that may affect previously written code. The following table highlights these changes.

Changed featureNotes
Handling of Camera resolutions and frame ratesHandling of these has been simplified and a new QCameraFormat class helps with selecting the correct resolution and frame rate for the camera.
Video output handling on the C++ side has changed significantly.QAbstractVideoSurface has been replaced by the QVideoSink class, and generic rendering support has been enhanced to cover all pixel formats supported by Qt Multimedia.
Metadata typesQMediaMetaData has changed significantly: mainly moving from string based to enum based keys, and reducing the set of supported keys to the ones that can be supported on most platforms.
QMediaFormatHandling of formats for encoded media and the settings for the media recorder have changed significantly. Qt 5 provides a string based API, a separated file format, and audio and video codecs into 3 classes. However, Qt 6 unifies the formats in the QMediaFormat class. Additional settings are directly specified in QMediaRecorder. Setting up file formats and codecs is now enum based and no longer uses strings. This puts some limitations on the set of codecs that can be used, but helps provide a consistent cross-platform API.
QCameraImageCapture renamed QImageCaptureNone