Video Overview

Video playback

Video Features

Qt Multimedia offers both high and low level C++ classes for playing and manipulating video data, and QML types for playback and recording. Some of the classes presented here overlap with what is presented in the Camera Overview and Audio Overview .

Video Implementation Details

Playing Video in C++

You can use the QMediaPlayer class to decode a video file, and display it using QVideoWidget , QGraphicsVideoItem , or a custom class.

Here’s an example of using QVideoWidget :

player = QMediaPlayer
videoWidget = QVideoWidget

And an example with QGraphicsVideoItem :

player = QMediaPlayer(self)
item = QGraphicsVideoItem()

Playing Video in QML

You can use VideoOutput to render content that is provided by either a MediaPlayer or a Camera . The VideoOutput is a visual component that can be embedded into a QQuickScene or Window , while all media decoding and playback control is handled by the MediaPlayer or CaptureSession . A Video element has been provided for convenience. It combines MediaPlayer , VideoOutput and AudioOutput elements in one item.

Working with Low Level Video Frames

Qt Multimedia offers a number of low level classes to make handling video frames a bit easier. These classes are primarily used when writing code that processes video or camera frames (for example, detecting barcodes, or applying a fancy vignette effect), or needs to display video in a special way that is otherwise unsupported.

The QVideoFrame class encapsulates a video frame and allows the contents to be mapped into system memory for manipulation or processing. Using your own QVideoSink allows you to receive these frames from QMediaPlayer and QCamera .

Recording Video

The central class for any type of capturing or recording of audio and video is QMediaCaptureSession (or the CaptureSession QML type). You can connect a QCamera (Camera in QML) and a QMediaRecorder ( MediaRecorder )to the session and then ask the media recorder to start recording.


There are both C++ and QML examples available.

C++ Examples

Camera Example

Shows how to capture a still image or record video. or video.

Media Player Example

Playing audio and video.

QML Examples

QML Media Player Example

Playing audio and video using Qt Quick.

QML Recorder Example

Recording audio and video using Qt Quick.

Reference Documentation

C++ Classes


The QMediaPlayer class allows the playing of a media files.


The QMediaCaptureSession class allows capturing of audio and video content.


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


The QVideoFrame class represents a frame of video data.


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


The QVideoSink class represents a generic sink for video data.


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

QML Types


Describes a video format supported by a camera device.


Describes a camera device.


Adds media playback to a scene.


Provides meta-data for media files.


Allows capturing of audio and video content.


For encoding and recording media generated in a CaptureSession.


A convenience type for showing a specified video.

Defines an item in a Playlist.


Render video or camera viewfinder.