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
advanced-ffmpeg-configuration.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page advanced-ffmpeg-configuration.html
6
\title Advanced FFmpeg Configuration
7
\brief Lists the FFmpeg media backend's configurable features.
8
\ingroup explanations-graphicsandmultimedia
9
10
This page lists the FFmpeg media backend's configurable features. All the features are a part of
11
the private API and can be changed or removed in the future without confirmation. Be aware
12
that environment variables are by default inherited by child processes and can have unintended
13
consequences.
14
15
\section1 Enable logging from FFmpeg and the Qt FFmpeg media backend
16
17
You can configure advanced FFmpeg log output via environment variables.
18
19
\list
20
\li \c QT_FFMPEG_DEBUG=1 enables extra logging from the FFmpeg library and can help
21
you understand issues that involve the FFmpeg library.
22
23
\li \c QT_LOGGING_RULES="*.ffmpeg.*=true" turns on Qt developer logs in the FFmpeg plugin.
24
Logging categories in the FFmpeg plugin are usually called "qt.multimedia.ffmpeg.XXX".
25
To enable developer logs from all of Qt Multimedia, set
26
\c QT_LOGGING_RULES="*.multimedia.*=true"
27
28
\li If you set both \c QT_FFMPEG_DEBUG and \c QT_LOGGING_RULES, all available FFmpeg codecs
29
will be printed the first time encoding or decoding functionality is used from
30
\l QMediaPlayer, \l QAudioDecoder, or \l QMediaRecorder. This information
31
can help you understand situations where Qt Multimedia doesn't find a proper FFmpeg
32
decoder or encoder. We recommend attaching the codec dump to Qt bug reports if you
33
encounter codec-specific issues.
34
\endlist
35
36
\section1 Enable experimental FFmpeg codecs
37
38
FFmpeg exposes a few codecs, such as Opus or Vorbis, as experimental ones. Experimental
39
codecs don't strictly follow the standard and may be unstable. They are disabled by default.
40
To enable them, set the environment variable \c QT_ENABLE_EXPERIMENTAL_CODECS=1.
41
42
\section1 Configuring allowed network protocols
43
44
For security reasons, the FFmpeg library restricts use of nested protocols, meaning protocols
45
used by other protocols; see
46
\l {https://www.ffmpeg.org/ffmpeg-protocols.html}{FFmpeg protocols documentation}.
47
You may explicitly override the allowed protocols via the environment variable
48
\c QT_FFMPEG_PROTOCOL_WHITELIST, for example:
49
50
\code
51
export QT_FFMPEG_PROTOCOL_WHITELIST=file,crypto,rtp,udp
52
\endcode
53
54
\warning Note that nested protocols can introduce security vulnerabilities when used with
55
untrusted data. Only allow protocols that align with your security and business
56
requirements.
57
58
\section1 Configure hardware acceleration in backends
59
60
\list
61
\li Explicit decoding and encoding hardware acceleration backends.
62
63
The FFmpeg plugin chooses the hardware acceleration backend for decoding and encoding
64
based on availability, stability, efficiency, and implementation details. If the selected
65
hardware backend doesn't work as expected, you can try setting a custom priority list or
66
disable all the hardware backends via the environment variables
67
\c QT_FFMPEG_DECODING_HW_DEVICE_TYPES and \c QT_FFMPEG_ENCODING_HW_DEVICE_TYPES.
68
The available hardware backends include:
69
70
\list
71
\li cuda
72
\li drm
73
\li dxva2
74
\li d3d11va
75
\li d3d12va,
76
\li opencl
77
\li qsv
78
\li vaapi
79
\li vdpau
80
\li videotoolbox
81
\li mediacodec
82
\li vulkan
83
\endlist
84
85
However, the availability of hardware backends depends on the OS, installed drivers,
86
the FFmpeg version, and configuration. It's important to keep in mind that some device
87
types have not been tested with Qt Multimedia by the Qt maintainers, and may not
88
operate as intended. At the time of writing, these backends include:
89
90
\list
91
\li drm
92
\li opencl
93
\li qsv
94
\li vdpau
95
\li vulkan
96
\endlist
97
98
Examples:
99
100
\code
101
# Set vdpau or cuda encoding hardware backends
102
export QT_FFMPEG_ENCODING_HW_DEVICE_TYPES=vdpau,cuda
103
104
# Set only d3d12va decoding hardware backend
105
export QT_FFMPEG_DECODING_HW_DEVICE_TYPES=d3d12va
106
107
# Disable decoding hw backends (set an empty list)
108
export QT_FFMPEG_DECODING_HW_DEVICE_TYPES=,
109
\endcode
110
111
\li Hardware textures conversion.
112
113
Utilizing GPU-based conversion for decoded and rendered video frames can significantly
114
reduce CPU usage. We aim to make use of this reature feature with as many hardware backends
115
as possible. If you notice any rendering issues, consider testing the rendering without GPU
116
texture conversion to identify the cause. You can disable GPU texture conversion by using
117
the \c QT_DISABLE_HW_TEXTURES_CONVERSION environment variable:
118
\c QT_DISABLE_HW_TEXTURES_CONVERSION=1. With the \c VAAPI hardware backend, hardware
119
texture conversion is disabled by default. Set \c QT_XCB_GL_INTEGRATION=xcb_egl to
120
enable it.
121
122
\li Allow codec profile mismatch.
123
124
If the codec profile does not match the reported capabilities of the hardware, you may
125
ignore the mismatch and allow hardware decoding via
126
\c QT_FFMPEG_HW_ALLOW_PROFILE_MISMATCH=1. Setting this option may be helpful, for example,
127
when you use the hardware accelerated decoding for baseline profile H.264 with
128
the \c VAAPI hardware backend because most of such streams satisfy the constraints
129
of the existing H.264 hardware decoder.
130
131
\warning If the stream is not supported, the enforced hardware decoding can cause entirely
132
incorrect video output.
133
134
\endlist
135
*/
qtmultimedia
src
multimedia
doc
src
advanced-ffmpeg-configuration.qdoc
Generated on
for Qt by
1.14.0