Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
videooverview.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5
6\page videooverview.html
7\title Video Overview
8\brief Video playback
9\ingroup explanations-graphicsandmultimedia
10
11\section1 Video Features
12
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
16\l {Audio Overview}.
17
18\section1 Video Implementation Details
19
20\target multimedia-playing-video
21\section2 Playing Video in C++
22
23You can use the \l QMediaPlayer class to decode a video file, and display
24it using \l QVideoWidget, \l QGraphicsVideoItem, or a custom class.
25
26Here's an example of using QVideoWidget:
27 \snippet multimedia-snippets/video.cpp Video widget
28
29And an example with QGraphicsVideoItem:
30 \snippet multimedia-snippets/video.cpp Video graphics item
31
32\section2 Playing Video in QML
33
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.
40
41\section2 Working with Low Level Video Frames
42
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.
48
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
53\l QCamera.
54
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.
59
60\section1 Supported Media Formats
61
62What media formats are supported ultimately depends on the configuration of the
63target system.
64
65\section2 Windows
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.
69
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.
72
73\section2 Android
74See \l{Android supported media formats} for this information.
75
76\section2 Linux
77On Linux this is about installing the correct \l{GStreamer} plugins.
78
79\section3 Minimum Required GStreamer Plugins
80\list
81\li gstreamer1.0-plugins-base
82\li gstreamer1.0-plugins-good
83\li gstreamer1.0-plugins-pulseaudio
84\endlist
85
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.
88
89On embedded Linux, the required set of plugins could be somewhat different.
90
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.
94
95\list
96\li Use \l QMediaFormat::isSupported() on a QMediaFormat::ConversionMode to query a
97 specific format.
98\li Use \l QMediaFormat::supportedFileFormats() on a default constructed QMediaFormat
99 to get all the supported file formats.
100\endlist
101
102\section1 Examples
103
104There are both C++ and QML examples available.
105
106\section2 C++ Examples
107
108\annotatedlist video_examples
109
110\section2 QML Examples
111
112\annotatedlist video_examples_qml
113
114\section1 Reference Documentation
115
116\section2 C++ Classes
117
118\annotatedlist multimedia_video
119
120\section2 QML Types
121
122\annotatedlist multimedia_video_qml
123
124*/