Multimedia Overview#

A set of APIs for working with audio, video 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 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 .

If you’re interested in adding spatial audio experiences to your application, have a look at the Qt Spatial Audio module.

Multimedia Recipes#

For some quick recipes, see this table:

Use case

Examples

QML Types

C++ Classes

Playing a sound effect

SoundEffect

QSoundEffect

Playing encoded audio (MP3, AAC etc)

player

MediaPlayer

QMediaPlayer

Playing raw audio data with low latency

audiooutput ,

QAudioSink

Accessing raw audio input data

spectrum , audiosource

QAudioSource

Recording encoded audio data

audiorecorder

CaptureSession , AudioInput , MediaRecorder

QMediaCaptureSession , QAudioInput , QMediaRecorder

Discovering audio and video devices

audiodevices

MediaDevices , audioDevice , cameraDevice

QMediaDevices , QAudioDevice , QCameraDevice

Video Playback

player , mediaplayer

MediaPlayer , VideoOutput , Video

QMediaPlayer , QVideoWidget , QGraphicsVideoItem

Capturing audio and video

camera , recorder

CaptureSession , Camera , AudioInput VideoOutput

QMediaCaptureSession , QCamera , QAudioInput , QVideoWidget

Capturing photos

camera , recorder

CaptureSession , Camera , ImageCapture

QMediaCaptureSession , QCamera , QImageCapture

Capturing movies

camera , recorder

CaptureSession , Camera , MediaRecorder

QMediaCaptureSession , QCamera , QMediaRecorder

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. See Supported Media Formats for more detail.

Changes from Previous Versions#

If you previously used Qt Multimedia in Qt 5, see Changes to 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#

qaudio.html

The QAudio namespace contains enums used by the audio classes.

PySide6.QtMultimedia.QAudioBuffer

The QAudioBuffer class represents a collection of audio samples with a specific format and sample rate.

PySide6.QtMultimedia.QAudioDecoder

The QAudioDecoder class implements decoding audio.

PySide6.QtMultimedia.QAudioDevice

The QAudioDevice class provides an information about audio devices and their functionality.

PySide6.QtMultimedia.QAudioFormat

The QAudioFormat class stores audio stream parameter information.

PySide6.QtMultimedia.QAudioInput

Represents an input channel for audio.

PySide6.QtMultimedia.QAudioOutput

Represents an output channel for audio.

PySide6.QtMultimedia.QAudioSink

The QAudioSink class provides an interface for sending audio data to an audio output device.

PySide6.QtMultimedia.QAudioSource

The QAudioSource class provides an interface for receiving audio data from an audio input device.

PySide6.QtMultimedia.QSoundEffect

The QSoundEffect class provides a way to play low latency sound effects.

PySide6.QtMultimedia.QCamera

The QCamera class provides interface for system camera devices.

PySide6.QtMultimedia.QCameraFormat

The QCameraFormat class describes a video format supported by a camera device.

PySide6.QtMultimedia.QCameraDevice

The QCameraDevice class provides general information about camera devices.

PySide6.QtMultimedia.QImageCapture

The QImageCapture class is used for the recording of media content.

PySide6.QtMultimedia.QMediaPlayer

The QMediaPlayer class allows the playing of a media files.

PySide6.QtMultimedia.QMediaDevices

The QMediaDevices class provides information about available multimedia input and output devices.

PySide6.QtMultimedia.QMediaFormat

Describes an encoding format for a multimedia file or stream.

QMediaTimeRange.Interval

The QMediaTimeRange::Interval class represents a time interval with integer precision.

PySide6.QtMultimedia.QMediaTimeRange

The QMediaTimeRange class represents a set of zero or more disjoint time intervals.

PySide6.QtMultimedia.QMediaCaptureSession

The QMediaCaptureSession class allows capturing of audio and video content.

PySide6.QtMultimedia.QMediaRecorder

The QMediaRecorder class is used for encoding and recording a capture session.

PySide6.QtMultimedia.QVideoFrame

The QVideoFrame class represents a frame of video data.

PySide6.QtMultimedia.QVideoFrameFormat

The QVideoFrameFormat class specifies the stream format of a video presentation surface.

PySide6.QtMultimedia.QVideoSink

The QVideoSink class represents a generic sink for video data.

PySide6.QtMultimediaWidgets.QGraphicsVideoItem

The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaPlayer or QCamera.

PySide6.QtMultimediaWidgets.QVideoWidget

The QVideoWidget class provides a widget which presents video produced by a media object.