Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
13
Qt Multimedia offers both high and low level C++ classes for playing and
14
manipulating video data, and QML types for playback and recording. Some
15
of 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
23
You can use the \l QMediaPlayer class to decode a video file, and display
24
it using \l QVideoWidget, \l QGraphicsVideoItem, or a custom class.
25
26
Here's an example of using QVideoWidget:
27
\snippet multimedia-snippets/video.cpp Video widget
28
29
And an example with QGraphicsVideoItem:
30
\snippet multimedia-snippets/video.cpp Video graphics item
31
32
\section2 Playing Video in QML
33
34
You can use \l VideoOutput to render content that is provided by
35
either a \l MediaPlayer or a \l Camera. The VideoOutput is a visual
36
component that can be embedded into a QQuickScene or \l Window, while
37
all media decoding and playback control is handled by the \l MediaPlayer
38
or \l CaptureSession. A \l Video element has been provided for convenience.
39
It combines MediaPlayer, VideoOutput and AudioOutput elements in one item.
40
41
\section2 Working with Low Level Video Frames
42
43
Qt Multimedia offers a number of low level classes to make handling
44
video frames a bit easier. These classes are primarily used when
45
writing code that processes video or camera frames (for example,
46
detecting barcodes, or applying a fancy vignette effect), or needs
47
to display video in a special way that is otherwise unsupported.
48
49
The \l QVideoFrame class encapsulates a video frame and allows the
50
contents to be mapped into system memory for manipulation or
51
processing. Using your own QVideoSink
52
allows you to receive these frames from \l QMediaPlayer and
53
\l QCamera.
54
55
\section2 Recording Video
56
The 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
62
What media formats are supported ultimately depends on the configuration of the
63
target system.
64
65
\section2 Windows
66
By 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
70
Independent of Windows Media Player, there are of course numerous codec packs
71
that could be installed. See the \l{codec guide} site for some examples.
72
73
\section2 Android
74
See \l{Android supported media formats} for this information.
75
76
\section2 Linux
77
On 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
86
For a Linux desktop target, it is strongly recommended to have \c gstreamer1.0-libav
87
for good codec coverage and \c gstreamer1.0-vaapi to get hardware acceleration.
88
89
On embedded Linux, the required set of plugins could be somewhat different.
90
91
\section2 Determining Supported Media Formats at Runtime
92
You can determine what formats are available on a target system at runtime using
93
the 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
104
There 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
*/
qtmultimedia
src
multimedia
doc
src
videooverview.qdoc
Generated on
for Qt by
1.14.0