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
9\ingroup explanations-graphicsandmultimedia
11\section1 Video Features
13Qt Multimedia offers both high and low level C++ classes for playing and
14manipulating video data, and QML types for playback and recording. Some
15of the classes presented here overlap with what is presented in the \l {Camera Overview} and
18\section1 Video Implementation Details
20\target multimedia-playing-video
21\section2 Playing Video in C++
23You can use the \l QMediaPlayer class to decode a video file, and display
24it using \l QVideoWidget, \l QGraphicsVideoItem, or a custom class.
26Here's an example of using QVideoWidget:
27 \snippet multimedia-snippets/video.cpp Video widget
29And an example with QGraphicsVideoItem:
30 \snippet multimedia-snippets/video.cpp Video graphics item
32\section2 Playing Video in QML
34You can use \l VideoOutput to render content that is provided by
35either a \l MediaPlayer or a \l Camera. The VideoOutput is a visual
36component that can be embedded into a QQuickScene or \l Window, while
37all media decoding and playback control is handled by the \l MediaPlayer
38or \l CaptureSession. A \l Video element has been provided for convenience.
39It combines MediaPlayer, VideoOutput and AudioOutput elements in one item.
41\section2 Working with Low Level Video Frames
43Qt Multimedia offers a number of low level classes to make handling
44video frames a bit easier. These classes are primarily used when
45writing code that processes video or camera frames (for example,
46detecting barcodes, or applying a fancy vignette effect), or needs
47to display video in a special way that is otherwise unsupported.
49The \l QVideoFrame class encapsulates a video frame and allows the
50contents to be mapped into system memory for manipulation or
51processing. Using your own QVideoSink
52allows you to receive these frames from \l QMediaPlayer and
55\section2 Recording Video
56The central class for any type of capturing or recording of audio and video is QMediaCaptureSession
57(or the CaptureSession QML type). You can connect a QCamera (Camera in QML) and a QMediaRecorder
58(MediaRecorder)to the session and then ask the media recorder to start recording.
60\section1 Supported Media Formats
62What media formats are supported ultimately depends on the configuration of the
66By default what is available on a MS Windows target depends on the version of
67\l{Windows Media Player} that was packaged with the OS. See the
68\l{Windows Media Player documentation} for official information.
70Independent of Windows Media Player, there are of course numerous codec packs
71that could be installed. See the \l{codec guide} site for some examples.
74See \l{Android supported media formats} for this information.
77On Linux this is about installing the correct \l{GStreamer} plugins.
79\section3 Minimum Required GStreamer Plugins
81\li gstreamer1.0-plugins-base
82\li gstreamer1.0-plugins-good
83\li gstreamer1.0-plugins-pulseaudio
86For a Linux desktop target, it is strongly recommended to have \c gstreamer1.0-libav
87for good codec coverage and \c gstreamer1.0-vaapi to get hardware acceleration.
89On embedded Linux, the required set of plugins could be somewhat different.
91\section2 Determining Supported Media Formats at Runtime
92You can determine what formats are available on a target system at runtime using
93the static QMediaFormat API.
96\li Use \l QMediaFormat::isSupported() on a QMediaFormat::ConversionMode to query a
98\li Use \l QMediaFormat::supportedFileFormats() on a default constructed QMediaFormat
99 to get all the supported file formats.
104There are both C++ and QML examples available.
106\section2 C++ Examples
108\annotatedlist video_examples
110\section2 QML Examples
112\annotatedlist video_examples_qml
114\section1 Reference Documentation
118\annotatedlist multimedia_video
122\annotatedlist multimedia_video_qml