1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
6\page videooverview.html
10\section1 Video Features
12Qt Multimedia offers both high and low level C++ classes for playing and
13manipulating video data, and QML types for playback and recording. Some
14of the classes presented here overlap with what is presented in the \l {Camera Overview} and
17\section1 Video Implementation Details
19\target multimedia-playing-video
20\section2 Playing Video in C++
22You can use the \l QMediaPlayer class to decode a video file, and display
23it using \l QVideoWidget, \l QGraphicsVideoItem, or a custom class.
25Here's an example of using QVideoWidget:
26 \snippet multimedia-snippets/video.cpp Video widget
28And an example with QGraphicsVideoItem:
29 \snippet multimedia-snippets/video.cpp Video graphics item
31\section2 Playing Video in QML
33You can use \l VideoOutput to render content that is provided by
34either a \l MediaPlayer or a \l Camera. The VideoOutput is a visual
35component that can be embedded into a QQuickScene or \l Window, while
36all media decoding and playback control is handled by the \l MediaPlayer
37or \l CaptureSession. A \l Video element has been provided for convenience.
38It combines MediaPlayer, VideoOutput and AudioOutput elements in one item.
40\section2 Working with Low Level Video Frames
42Qt Multimedia offers a number of low level classes to make handling
43video frames a bit easier. These classes are primarily used when
44writing code that processes video or camera frames (for example,
45detecting barcodes, or applying a fancy vignette effect), or needs
46to display video in a special way that is otherwise unsupported.
48The \l QVideoFrame class encapsulates a video frame and allows the
49contents to be mapped into system memory for manipulation or
50processing. Using your own QVideoSink
51allows you to receive these frames from \l QMediaPlayer and
54\section2 Recording Video
55The central class for any type of capturing or recording of audio and video is QMediaCaptureSession
56(or the CaptureSession QML type). You can connect a QCamera (Camera in QML) and a QMediaRecorder
57(MediaRecorder)to the session and then ask the media recorder to start recording.
59\section1 Supported Media Formats
61What media formats are supported ultimately depends on the configuration of the
65By default what is available on a MS Windows target depends on the version of
66\l{Windows Media Player} that was packaged with the OS. See the
67\l{Windows Media Player documentation} for official information.
69Independent of Windows Media Player, there are of course numerous codec packs
70that could be installed. See the \l{codec guide} site for some examples.
73See \l{Android supported media formats} for this information.
76On Linux this is about installing the correct \l{GStreamer} plugins.
78\section3 Minimum Required GStreamer Plugins
80\li gstreamer1.0-plugins-base
81\li gstreamer1.0-plugins-good
82\li gstreamer1.0-plugins-pulseaudio
85For a Linux desktop target, it is strongly recommended to have \c gstreamer1.0-libav
86for good codec coverage and \c gstreamer1.0-vaapi to get hardware acceleration.
88On embedded Linux, the required set of plugins could be somewhat different.
90\section2 Determining Supported Media Formats at Runtime
91You can determine what formats are available on a target system at runtime using
92the static QMediaFormat API.
95\li Use \l QMediaFormat::isSupported() on a QMediaFormat::ConversionMode to query a
97\li Use \l QMediaFormat::supportedFileFormats() on a default constructed QMediaFormat
98 to get all the supported file formats.
103There are both C++ and QML examples available.
105\section2 C++ Examples
107\annotatedlist video_examples
109\section2 QML Examples
111\annotatedlist video_examples_qml
113\section1 Reference Documentation
117\annotatedlist multimedia_video
121\annotatedlist multimedia_video_qml