Multimedia Overview
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 devices.
Features
Here are some things you can do with the 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.
- Use a camera, including viewfinder, image capture, and movie recording
- Decode audio media files into memory for processing.
Multimedia Components
The Qt Multimedia APIs are categorized into three main components. More information specific to each component is available in the overview pages. You can also take a look at some recipes.
Multimedia Recipes
For some quick recipes, see this table:
Use case | Examples | QML Types | C++ Classes | |
---|---|---|---|---|
Playing a sound effect | QSoundEffect | |||
Playing low latency audio | audioinput, spectrum | QAudioSink | ||
Playing encoded audio (MP3, AAC etc) | player | Audio, MediaPlayer | QMediaPlayer | |
Accessing raw audio input data | spectrum, audioinput | QAudioSource | ||
Recording encoded audio data | audiorecorder | QAudioRecorder | ||
Discovering raw audio devices | audiodevices | QAudioDevice | ||
Video Playback | player, qmlvideo, qmlvideofx | MediaPlayer, VideoOutput, Video | QMediaPlayer, QVideoWidget, QGraphicsVideoItem | |
Video Processing | qmlvideofx | MediaPlayer, VideoOutput | QMediaPlayer, QVideoFrame | |
Accessing camera viewfinder | camera, declarative-camera | Camera, VideoOutput | QCamera, QVideoWidget, QGraphicsVideoItem | |
Viewfinder processing | Camera, VideoOutput | QCamera, QVideoFrame | ||
Capturing photos | camera, declarative-camera | Camera | QCamera, QImageCapture | |
Capturing movies | camera, declarative-camera | Camera | QCamera, QMediaRecorder | |
3D sound sources | Audio Engine | 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 will vary between machines. This support depends on what the end user has installed.
Changes from Previous Versions
If you previously used Qt Multimedia in Qt 5, see Changes in Qt Multimedia for more information on what has changed, and what you might need to change when porting code to Qt 6.
Reference Documentation
QML Types
The QML types are accessed by using:
import QtMultimedia
Multimedia Classes
Contains enums used by the audio classes | |
Represents a collection of audio samples with a specific format and sample rate | |
Implements decoding audio | |
Information about audio devices and their functionality | |
Stores audio stream parameter information | |
QAudioOutput class represents an input channel for audio | |
Represents an output channel for audio | |
Interface for sending audio data to an audio output device | |
Interface for receiving audio data from an audio input device | |
Interface for system camera devices | |
General information about camera devices | |
The base class for all graphics effects | |
Graphics item which display video produced by a QMediaPlayer or QCamera | |
Used for the recording of media content | |
Allows capturing of audio and video content | |
Information about available multimedia input and output devices | |
Allows the playing of a media files | |
Used for the encoding and recording a capture session | |
Represents a set of zero or more disjoint time intervals | |
QMediaTimeRange::Interval class represents a time interval with integer precision | |
Base class for audio backends | |
Access for QAudioSource to access the audio device provided by the plugin | |
Way to play low latency sound effects | |
Enables optimized drawing of text when the text and its layout is updated rarely | |
Represents a frame of video data | |
Specifies the stream format of a video presentation surface | |
Represents a generic sink for video data | |
Widget which presents video produced by a media object |