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
Playing low latency audio
Playing encoded audio (MP3, AAC etc)
Audio , MediaPlayer
Accessing raw audio input data
Recording encoded audio data
Discovering raw audio devices
Video Playback
player , qmlvideo , qmlvideofx
MediaPlayer , VideoOutput , Video
Video Processing
MediaPlayer , VideoOutput
Listening to the radio
Radio , RadioData
Accessing camera viewfinder
Camera , VideoOutput
Viewfinder processing
Camera , VideoOutput
Capturing photos
Capturing movies
3D 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.
The QAudioBuffer class represents a collection of audio samples with a specific format and sample rate.
QAudioBuffer.StereoFrame
The StereoFrame class provides a simple wrapper for a stereo audio frame.
The QAudioDecoder class allows decoding audio.
The QAudioDeviceInfo class provides an interface to query audio devices and their functionality.
The QAudioFormat class stores audio stream parameter information.
The QAudioInput class provides an interface for receiving audio data from an audio input device.
The QAudioOutput class provides an interface for sending audio data to an audio output device.
The QAudioProbe class allows you to monitor audio being played or recorded.
The QAbstractAudioDeviceInfo class is a base class for audio backends.
The QAbstractAudioOutput class is a base class for audio backends.
The QAbstractAudioInput class provides access for QAudioInput to access the audio device provided by the plugin.
QAudioSystemPlugin
The QAudioSystemPlugin class provides an abstract base for audio plugins.
The QSound class provides a method to play .wav sound files.
The QSoundEffect class provides a way to play low latency sound effects.
The QCamera class provides interface for system camera devices.
QCamera.FrameRateRange
A FrameRateRange represents a range of frame rates as minimum and maximum rate.
PySide2.QtMultimedia.QCameraExposure
The QCameraExposure class provides interface for exposure related camera settings.
The QCameraFocusZone class provides information on zones used for autofocusing a camera.
PySide2.QtMultimedia.QCameraFocus
The QCameraFocus class provides an interface for focus and zoom related camera settings.
The QCameraImageCapture class is used for the recording of media content.
PySide2.QtMultimedia.QCameraImageProcessing
The QCameraImageProcessing class provides an interface for image processing related camera settings.
The QCameraInfo class provides general information about camera devices.
The QCameraViewfinderSettings class provides a set of viewfinder settings.
The QMediaContent class provides access to the resource relating to a media content.
The QMediaPlayer class allows the playing of a media source.
The 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.
The QMediaResource class provides a description of a media resource.
The QMediaBindableInterface class is the base class for objects extending media objects functionality.
The QMediaControl class provides a base interface for media service controls.
qmediametadata.html
Provides identifiers for meta-data attributes.
The QMediaObject class provides a common base for multimedia objects.
The 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.
The QMediaTimeInterval class represents a time interval with integer precision.
The 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.
The QRadioData class provides interfaces to the RDS functionality of the system radio.
The QRadioTuner class provides an interface to the systems analog radio device.
The QAudioRecorder class is used for the recording of audio.
The QAudioEncoderSettings class provides a set of audio encoder settings.
The QVideoEncoderSettings class provides a set of video encoder settings.
The QImageEncoderSettings class provides a set of image encoder settings.
The QMediaRecorder class is used for the recording of media content.
The QAbstractVideoBuffer class is an abstraction for video data.
QAbstractPlanarVideoBuffer
The QAbstractPlanarVideoBuffer class is an abstraction for planar video data.
The QAbstractVideoFilter class represents a filter that is applied to the video frames received by a VideoOutput type.
The QVideoFilterRunnable class represents the implementation of a filter that owns all graphics and computational resources, and performs the actual filtering or calculations.
The QAbstractVideoSurface class is a base class for video presentation surfaces.
The QVideoFrame class represents a frame of video data.
The QVideoProbe class allows you to monitor video frames being played or recorded.
The QVideoSurfaceFormat class specifies the stream format of a video presentation surface.
The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
The QVideoWidget class provides a widget which presents video produced by a media object.
© 2020 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.