Multimedia

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 caseExamplesQML TypesC++ Classes
Playing a sound effectQSoundEffect
Playing low latency audioaudioinput, spectrumQAudioOutput
Playing encoded audio (MP3, AAC etc)playerAudio, MediaPlayerQMediaPlayer
Accessing raw audio input dataspectrum, audioinputQAudioInput
Recording encoded audio dataaudiorecorderQAudioRecorder
Discovering raw audio devicesaudiodevicesQAudioDeviceInfo
Video Playbackplayer, qmlvideo, qmlvideofxMediaPlayer, VideoOutput, VideoQMediaPlayer, QVideoWidget, QGraphicsVideoItem
Video ProcessingqmlvideofxMediaPlayer, VideoOutputQMediaPlayer, QAbstractVideoSurface, QVideoFrame
Listening to the radiodeclarative-radioRadio, RadioDataQRadioTuner, QRadioData
Accessing camera viewfindercamera, declarative-cameraCamera, VideoOutputQCamera, QVideoWidget, QGraphicsVideoItem
Viewfinder processingCamera, VideoOutputQCamera, QAbstractVideoSurface, QVideoFrame
Capturing photoscamera, declarative-cameraCameraQCamera, QCameraImageCapture
Capturing moviescamera, declarative-cameraCameraQCamera, QMediaRecorder
3D sound sourcesAudio EngineAudioEngine, 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.0

Video

A convenience type for showing a specified video.

Audio

Add audio playback to a scene.

MediaPlayer

Add media playback to a scene.

Camera

Access viewfinder frames, and take photos and movies.

CameraCapture

An interface for capturing camera images

CameraExposure

An interface for exposure related camera settings.

CameraFlash

An interface for flash related camera settings.

CameraFocus

An interface for focus related camera settings.

CameraImageProcessing

An interface for camera capture related settings.

CameraRecorder

Controls video recording with the Camera.

Radio

Access radio functionality from a QML application.

RadioData

Access RDS data from a QML application.

Torch

Simple control over torch functionality

VideoOutput

Render video or camera viewfinder.

SoundEffect

The SoundEffect type provides a way to play sound effects in QML.

The following types are accessed by using Qt Audio Engine:

import QtAudioEngine 1.0

AttenuationModelLinear

Defines a linear attenuation curve for a Sound.

AttenuationModelInverse

Defines a non-linear attenuation curve for a Sound.

AudioCategory

Control all active sound instances by group.

AudioEngine

Organize all your 3d audio content in one place.

AudioListener

Control global listener parameters.

AudioSample

Load audio samples, mostly .wav.

PlayVariation

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.

Sound

Define a variety of samples and parameters to be used for SoundInstance.

SoundInstance

Play 3d audio content.

Multimedia Classes

QGraphicsVideoItem

The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.

QVideoWidget

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

QAudio

Contains enums used by the audio classes

QAudioBuffer

Represents a collection of audio samples with a specific format and sample rate

QAudioBuffer::StereoFrame

Simple wrapper for a stereo audio frame

QAudioDecoder

Allows decoding audio

QAudioDeviceInfo

Interface to query audio devices and their functionality

QAudioFormat

Stores audio stream parameter information

QAudioInput

Interface for receiving audio data from an audio input device

QAudioOutput

Interface for sending audio data to an audio output device

QAudioProbe

Allows you to monitor audio being played or recorded

QSound

Method to play .wav sound files

QSoundEffect

Way to play low latency sound effects

QCamera

Interface for system camera devices

QCameraExposure

Interface for exposure related camera settings

QCameraFocusZone

Information on zones used for autofocusing a camera

QCameraFocus

Interface for focus and zoom related camera settings

QCameraImageCapture

Used for the recording of media content

QCameraImageProcessing

Interface for image processing related camera settings

QMediaContent

Access to the resources relating to a media content

QMediaPlayer

Allows the playing of a media source

QMediaPlaylist

List of media content to play

QMediaResource

Description of a media resource

QMediaBindableInterface

The base class for objects extending media objects functionality

QMediaControl

Base interface for media service controls

QMediaMetaData

QMediaObject

Common base for multimedia objects

QMediaService

Common base class for media service implementations

QMediaTimeInterval

Represents a time interval with integer precision

QMediaTimeRange

Represents a set of zero or more disjoint time intervals

QMultimedia

Contains miscellaneous identifiers used throughout the Qt Multimedia library

QRadioData

Interfaces to the RDS functionality of the system radio

QRadioTuner

Interface to the systems analog radio device

QAudioRecorder

Used for the recording of audio

QAudioEncoderSettings

Set of audio encoder settings

QVideoEncoderSettings

Set of video encoder settings

QImageEncoderSettings

Set of image encoder settings

QMediaRecorder

Used for the recording of media content

QAbstractVideoBuffer

Abstraction for video data

QAbstractVideoSurface

Base class for video presentation surfaces

QVideoFrame

Represents a frame of video data

QVideoProbe

Allows you to monitor video frames being played or recorded

QVideoSurfaceFormat

Specifies the stream format of a video presentation surface

Notes provided by the Qt Community

No notes