Multimedia | Qt Multimedia 5.15.18

- Qt 5.15
- Qt Multimedia
- Multimedia
- Qt 5.15.18 Reference Documentation

# 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:

- Audio Overview
- Video Overview
- Camera Overview
- Radio Overview

## 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 |  |  | QSoundEffect
Playing low latency audio | audioinput, spectrum |  | QAudioOutput
Playing encoded audio (MP3, AAC etc) | player | Audio, MediaPlayer | QMediaPlayer
Accessing raw audio input data | spectrum, audioinput |  | QAudioInput
Recording encoded audio data | audiorecorder |  | QAudioRecorder
Discovering raw audio devices | audiodevices |  | QAudioDeviceInfo
Video Playback | player, qmlvideo, qmlvideofx | MediaPlayer, VideoOutput, Video | QMediaPlayer, QVideoWidget, QGraphicsVideoItem
Video Processing | qmlvideofx | MediaPlayer, VideoOutput | QMediaPlayer, QAbstractVideoSurface, QVideoFrame
Listening to the radio | declarative-radio | Radio, RadioData | QRadioTuner, QRadioData
Accessing camera viewfinder | camera, declarative-camera | Camera, VideoOutput | QCamera, QVideoWidget, QGraphicsVideoItem
Viewfinder processing |  | Camera, VideoOutput | QCamera, QAbstractVideoSurface, QVideoFrame
Capturing photos | camera, declarative-camera | Camera | QCamera, QCameraImageCapture
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 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

Audio | Add audio 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
MediaPlayer | Add media playback to a scene
Playlist | For specifying a list of media to be played
PlaylistItem | Defines an item in a Playlist
QtMultimedia | Provides a global object with useful functions from Qt Multimedia
RadioData | Access RDS data from a QML application
SoundEffect | Type provides a way to play sound effects in QML
Torch | Simple control over torch functionality
Video | A convenience type for showing a specified video
VideoOutput | Render video or camera viewfinder

The following types are accessed by using Qt Audio Engine:

     import QtAudioEngine 1.15

AttenuationModelInverse | Defines a non-linear attenuation curve for a Sound
AttenuationModelLinear | Defines a 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

QAudio | Contains enums used by the audio classes
QAudioBuffer | Represents a collection of audio samples with a specific format and sample rate
QMediaMetaData | Provides identifiers for meta-data attributes
QMultimedia | Contains miscellaneous identifiers used throughout the Qt Multimedia library