To support dynamic linking of FFmpeg in compliance with the LGPL license, Qt Multimedia uses stub libraries to handle optional external dependencies on Linux and Android platforms.
On these platforms, FFmpeg may require additional shared libraries that are not shipped with Qt:
These libraries are often not available or cannot be bundled due to licensing constraints. To ensure FFmpeg-based features remain functional (excluding the unsupported parts), Qt delivers stub libraries as fallbacks.
If these dependencies are not present at runtime, FFmpeg will fail to load or function properly. The stub mechanism allows:
Stub libraries mimic the interfaces of the real libraries (e.g.,
libssl.so
,
libva.so
) but do not implement full functionality. Instead, they:
QLibrary::load
/
QLibrary::resolve
.
Qt ships these stubs under the names:
libQt6FFmpegStub-ssl.so.x
libQt6FFmpegStub-crypto.so.x
libQt6FFmpegStub-va.so.x
libQt6FFmpegStub-va-drm.so.x
libQt6FFmpegStub-va-x11.so.x
When FFmpeg is dynamically linked:
libssl.so.3
or
libva.so.2
.
patchelf
tool to replace these real dependencies with stub equivalents.
范例:
# Original linkage libffmpegmediaplugin.so: needs libavcodec.so (depends on the FFmpeg libs) libavcodec.so: needs libssl.so.3 # After patching libffmpegmediaplugin.so: needs libavcodec.so (no changes) libavcodec.so: needs libQt6FFmpegStub-ssl.so.3 libQt6FFmpegStub-ssl.so.3: optionally needs libssl.so.3 (no explicit linkage)
This patching is performed automatically as part of the build/distribution process.
dlopen(..., RTLD_LOCAL)
, so stub symbols do not leak into the global symbol table.
@OPENSSL_3.0.0
)
To completely remove the use of stub libraries, there are two options:
patchelf
to restore FFmpeg's dependencies back to the system libraries (e.g., replace
libQt6FFmpegStub-ssl.so.3
with
libssl.so.3
). This must be done for all FFmpeg libraries:
libavcodec
,
libavformat
,
libavutil
,
libswresample
,和
libswscale
.