Multimedia¶
A set of APIs for working with audio, video, radio and camera devices.
Multimedia support in Qt is provided by the Qt Multimedia module. The Qt Multimedia module provides a rich feature set that enables you to easily take advantage of a platform’s multimedia capabilities such as media playback and the use of camera and radio devices.
Features¶
Here are some examples of what can be done with Qt Multimedia APIs:
Access raw audio devices for input and output
Play low latency sound effects
Play media files in playlists (such as compressed audio or video files)
Record audio and compress it
Tune and listen to radio stations
Use a camera, including viewfinder, image capture, and movie recording
Play 3D positional audio with Qt Audio Engine
Decode audio media files into memory for processing
Accessing video frames or audio buffers as they are played or recorded
Multimedia Components¶
Qt’s multimedia APIs are categorized into four main components. More information (including background information and class references) is available here:
Multimedia Recipes¶
For some quick recipes, look at the overviews above and consult this table:
Use case
Examples
QML Types
C++ Classes
Playing a sound effect
QSoundEffectPlaying low latency audio
QAudioOutputPlaying encoded audio (MP3, AAC etc)
Audio , MediaPlayer
QMediaPlayerAccessing raw audio input data
QAudioInputRecording encoded audio data
QAudioRecorderDiscovering raw audio devices
QAudioDeviceInfoVideo Playback
player , qmlvideo , qmlvideofx
MediaPlayer , VideoOutput , Video
QMediaPlayer,QVideoWidget,QGraphicsVideoItemVideo Processing
MediaPlayer , VideoOutput
QMediaPlayer,QAbstractVideoSurface,QVideoFrameListening to the radio
Radio , RadioData
QRadioTuner,QRadioDataAccessing camera viewfinder
Camera , VideoOutput
QCamera,QVideoWidget,QGraphicsVideoItemViewfinder processing
Camera , VideoOutput
QCamera,QAbstractVideoSurface,QVideoFrameCapturing photos
QCamera,QCameraImageCaptureCapturing movies
QCamera,QMediaRecorder3D sound sources
AudioEngine , Sound
Limitations¶
The Qt Multimedia APIs build upon the multimedia framework of the underlying platform. This can mean that support for various codecs or containers can vary between machines, depending on what the end user has installed.
Advanced Usage¶
For developers wishing to access some platform specific settings, or to port the Qt Multimedia APIs to a new platform or technology, see Multimedia Backend Development .
Changes from Previous Versions¶
If you previously used Qt Multimedia in Qt 4, or used Qt Multimedia Kit in Qt Mobility, please see Changes in Qt Multimedia for more information on what changed, and what you might need to change when porting code.
Reference Documentation¶
QML Types¶
The QML types are accessed by using:
import QtMultimedia 5.8
qml-qtmultimedia-video.html
A convenience type for showing a specified video.
qml-qtmultimedia-audio.html
Add audio playback to a scene.
qml-qtmultimedia-mediaplayer.html
Add media playback to a scene.
qml-qtmultimedia-camera.html
Access viewfinder frames, and take photos and movies.
qml-qtmultimedia-cameracapture.html
An interface for capturing camera images.
qml-qtmultimedia-cameraexposure.html
An interface for exposure related camera settings.
qml-qtmultimedia-cameraflash.html
An interface for flash related camera settings.
qml-qtmultimedia-camerafocus.html
An interface for focus related camera settings.
qml-qtmultimedia-cameraimageprocessing.html
An interface for camera capture related settings.
qml-qtmultimedia-camerarecorder.html
Controls video recording with the Camera.
qml-qtmultimedia-qtmultimedia.html
Provides a global object with useful functions from Qt Multimedia.
qml-qtmultimedia-playlistitem.html
Defines an item in a Playlist.
qml-qtmultimedia-playlist.html
For specifying a list of media to be played.
qml-qtmultimedia-radio.html
Access radio functionality from a QML application.
qml-qtmultimedia-radiodata.html
Access RDS data from a QML application.
qml-qtmultimedia-torch.html
Simple control over torch functionality.
qml-qtmultimedia-soundeffect.html
The SoundEffect type provides a way to play sound effects in QML.
qml-qtmultimedia-videooutput.html
Render video or camera viewfinder.
The following types are accessed by using Qt Audio Engine :
qml-qtaudioengine-attenuationmodellinear.html
Defines a linear attenuation curve for a Sound.
qml-qtaudioengine-attenuationmodelinverse.html
Defines a non-linear attenuation curve for a Sound.
qml-qtaudioengine-audiocategory.html
Control all active sound instances by group.
qml-qtaudioengine-audioengine.html
Organize all your 3d audio content in one place.
qml-qtaudioengine-audiolistener.html
Control global listener parameters.
qml-qtaudioengine-audiosample.html
Load audio samples, mostly .wav.
qml-qtaudioengine-playvariation.html
Define a playback variation for sounds. So each time the playback of the same sound can be a slightly different even with the same AudioSample.
qml-qtaudioengine-sound.html
Define a variety of samples and parameters to be used for SoundInstance.
qml-qtaudioengine-soundinstance.html
Play 3d audio content.
Multimedia Classes¶
qaudio.html
The QAudio namespace contains enums used by the audio classes.
PySide2.QtMultimedia.QAudioBufferThe QAudioBuffer class represents a collection of audio samples with a specific format and sample rate.
QAudioBuffer.StereoFrameThe StereoFrame class provides a simple wrapper for a stereo audio frame.
PySide2.QtMultimedia.QAudioDecoderThe QAudioDecoder class allows decoding audio.
PySide2.QtMultimedia.QAudioDeviceInfoThe QAudioDeviceInfo class provides an interface to query audio devices and their functionality.
PySide2.QtMultimedia.QAudioFormatThe QAudioFormat class stores audio stream parameter information.
PySide2.QtMultimedia.QAudioInputThe QAudioInput class provides an interface for receiving audio data from an audio input device.
PySide2.QtMultimedia.QAudioOutputThe QAudioOutput class provides an interface for sending audio data to an audio output device.
PySide2.QtMultimedia.QAudioProbeThe QAudioProbe class allows you to monitor audio being played or recorded.
PySide2.QtMultimedia.QAbstractAudioDeviceInfoThe QAbstractAudioDeviceInfo class is a base class for audio backends.
PySide2.QtMultimedia.QAbstractAudioOutputThe QAbstractAudioOutput class is a base class for audio backends.
PySide2.QtMultimedia.QAbstractAudioInputThe QAbstractAudioInput class provides access for QAudioInput to access the audio device provided by the plugin.
QAudioSystemPluginThe QAudioSystemPlugin class provides an abstract base for audio plugins.
PySide2.QtMultimedia.QSoundThe QSound class provides a method to play .wav sound files.
PySide2.QtMultimedia.QSoundEffectThe QSoundEffect class provides a way to play low latency sound effects.
PySide2.QtMultimedia.QCameraThe QCamera class provides interface for system camera devices.
QCamera.FrameRateRangeA FrameRateRange represents a range of frame rates as minimum and maximum rate.
PySide2.QtMultimedia.QCameraExposureThe QCameraExposure class provides interface for exposure related camera settings.
PySide2.QtMultimedia.QCameraFocusZoneThe QCameraFocusZone class provides information on zones used for autofocusing a camera.
PySide2.QtMultimedia.QCameraFocusThe QCameraFocus class provides an interface for focus and zoom related camera settings.
PySide2.QtMultimedia.QCameraImageCaptureThe QCameraImageCapture class is used for the recording of media content.
PySide2.QtMultimedia.QCameraImageProcessingThe QCameraImageProcessing class provides an interface for image processing related camera settings.
PySide2.QtMultimedia.QCameraInfoThe QCameraInfo class provides general information about camera devices.
PySide2.QtMultimedia.QCameraViewfinderSettingsThe QCameraViewfinderSettings class provides a set of viewfinder settings.
PySide2.QtMultimedia.QMediaContentThe QMediaContent class provides access to the resource relating to a media content.
PySide2.QtMultimedia.QMediaPlayerThe QMediaPlayer class allows the playing of a media source.
PySide2.QtMultimedia.QMediaPlaylistThe QMediaPlaylist class provides a list of media content to play.
The QMediaPlaylistReader class provides an interface for reading a playlist file.
The QMediaPlaylistNavigator class provides navigation for a media playlist.
The QMediaPlaylistProvider class provides an abstract list of media.
PySide2.QtMultimedia.QMediaResourceThe QMediaResource class provides a description of a media resource.
PySide2.QtMultimedia.QMediaBindableInterfaceThe QMediaBindableInterface class is the base class for objects extending media objects functionality.
PySide2.QtMultimedia.QMediaControlThe QMediaControl class provides a base interface for media service controls.
qmediametadata.html
Provides identifiers for meta-data attributes.
PySide2.QtMultimedia.QMediaObjectThe QMediaObject class provides a common base for multimedia objects.
PySide2.QtMultimedia.QMediaServiceThe QMediaService class provides a common base class for media service implementations.
The QMediaServiceProviderHint class describes what is required of a QMediaService.
The QMediaServiceProvider class provides an abstract allocator for media services.
PySide2.QtMultimedia.QMediaTimeIntervalThe QMediaTimeInterval class represents a time interval with integer precision.
PySide2.QtMultimedia.QMediaTimeRangeThe QMediaTimeRange class represents a set of zero or more disjoint time intervals.
qmultimedia.html
The QMultimedia namespace contains miscellaneous identifiers used throughout the Qt Multimedia library.
PySide2.QtMultimedia.QRadioDataThe QRadioData class provides interfaces to the RDS functionality of the system radio.
PySide2.QtMultimedia.QRadioTunerThe QRadioTuner class provides an interface to the systems analog radio device.
PySide2.QtMultimedia.QAudioRecorderThe QAudioRecorder class is used for the recording of audio.
PySide2.QtMultimedia.QAudioEncoderSettingsThe QAudioEncoderSettings class provides a set of audio encoder settings.
PySide2.QtMultimedia.QVideoEncoderSettingsThe QVideoEncoderSettings class provides a set of video encoder settings.
PySide2.QtMultimedia.QImageEncoderSettingsThe QImageEncoderSettings class provides a set of image encoder settings.
PySide2.QtMultimedia.QMediaRecorderThe QMediaRecorder class is used for the recording of media content.
PySide2.QtMultimedia.QAbstractVideoBufferThe QAbstractVideoBuffer class is an abstraction for video data.
QAbstractPlanarVideoBufferThe QAbstractPlanarVideoBuffer class is an abstraction for planar video data.
PySide2.QtMultimedia.QAbstractVideoFilterThe QAbstractVideoFilter class represents a filter that is applied to the video frames received by a VideoOutput type.
PySide2.QtMultimedia.QVideoFilterRunnableThe QVideoFilterRunnable class represents the implementation of a filter that owns all graphics and computational resources, and performs the actual filtering or calculations.
PySide2.QtMultimedia.QAbstractVideoSurfaceThe QAbstractVideoSurface class is a base class for video presentation surfaces.
PySide2.QtMultimedia.QVideoFrameThe QVideoFrame class represents a frame of video data.
PySide2.QtMultimedia.QVideoProbeThe QVideoProbe class allows you to monitor video frames being played or recorded.
PySide2.QtMultimedia.QVideoSurfaceFormatThe QVideoSurfaceFormat class specifies the stream format of a video presentation surface.
PySide2.QtMultimediaWidgets.QGraphicsVideoItemThe QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
PySide2.QtMultimediaWidgets.QVideoWidgetThe QVideoWidget class provides a widget which presents video produced by a media object.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.