How to configure Qt 6.5.1 QtMultimedia to use custom FFmpeg installation?
-
I tried using Qt's own script with
cd /home/eramne/Qt/6.5.1/Src/ && source "coin/provisioning/common/unix/install-ffmpeg.sh" "linux"
I saw that it printed out
Setting environment variable FFMPEG_DIR to /usr/local/FFmpeg-n6.0.
, so I tried configuring Qt with./configure -prefix "/home/eramne/Qt6.5.1/" -DFFMPEG_DIR="/usr/local/FFmpeg-n6.0" -release -openssl -openssl-linked -no-widgets -submodules qt5compat,qtbase,qtdeclarative,qtimageformats,qtmultimedia,qtshadertools,qtsvg,qttranslations
and then with./configure -prefix "/home/eramne/Qt6.5.1/" -release -openssl -openssl-linked -no-widgets -submodules qt5compat,qtbase,qtdeclarative,qtimageformats,qtmultimedia,qtshadertools,qtsvg,qttranslations
, both still didn't work.maybe i need a low-level audio backend for the ffmpeg backend to show as enabled?
-
how do i get the pulseaudio backend working/enabled/configured?
-
oh! i installed the
libpulse-dev
package, now the pulseaudio backend is shown as enabled, but the ffmpeg backend still isn't.
i'll check https://github.com/qt/qt5/blob/6.5.1/coin/provisioning/qtci-linux-Ubuntu-20.04-x86_64/02-apt.sh and see if there's any other packages that I'm missingthis should really be in the documentation somewhere, like in https://doc.qt.io/qt-6/linux-requirements.html
-
i ran this script https://github.com/qt/qt5/blob/6.5.1/coin/provisioning/qtci-linux-Ubuntu-20.04-x86_64/02-apt.sh
now the gstreamer backend is shown as enabled, but still not ffmpeg -
ok, i don't remember what i did differently, but now the configure script is actually giving me useful information
it's printing out a lot more than before, although im running the exact same command
-- Checking for module 'libavdevice' -- No package 'libavdevice' found -- Checking for module 'libavfilter' -- No package 'libavfilter' found -- Checking for module 'libpostproc' -- No package 'libpostproc' found -- Could NOT find FFmpeg (missing: AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIRS) -- Generated QtModulePlugins.cmake files for the following modules: Multimedia
that's something that i can work with
-
although, i already have those things?
(the/usr/local/FFmpeg-n6.0/
folder also has the same contents) -
well since i got the gstreamer backend working i guess ill just give up on ffmpeg for now and use that instead
-
@eramne This is working for me (Ubuntu 20.04), in so much as Qt detects FFmpeg during configuration:
cd /home/martinb/workspace/qt6_local_build/ffmpeg_linux_x86_64_build/FFmpeg-n6.0 /home/martinb/workspace/qt6_local_build/ffmpeg_linux_x86_64_build/FFmpeg-n6.0/configure --disable-programs --disable-doc --disable-debug --enable-network --disable-lzma --enable-pic --prefix=/FFmpeg-n6.0 make make install DESTDIR=/home/martinb/workspace/qt6_local_build/ffmpeg_linux_x86_64_build/FFmpeg-n6.0/installed/FFmpeg-n6.0 /home/martinb/workspace/qt6_local_build/src/qt6/qtbase/configure -top-level -prefix /home/martinb/workspace/qt6_local_build/qt_linux_x86_64_install -static -gstreamer -I /home/martinb/workspace/qt6_local_build/openssl_linux_x86_64_build/openssl-1.1.1s/include -L /home/martinb/workspace/qt6_local_build/openssl_linux_x86_64_build/openssl-1.1.1s -ccache -no-sql-sqlite -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -qt-doubleconversion -qt-libjpeg -qt-libpng -qt-zlib -no-warnings-are-errors -nomake examples -nomake tests -release -openssl-linked -- -DOPENSSL_USE_STATIC_LIBS=ON -DOPENSSL_ROOT_DIR=/home/martinb/workspace/qt6_local_build/openssl_linux_x86_64_build/openssl-1.1.1s -DFFMPEG_DIR=/home/martinb/workspace/qt6_local_build/ffmpeg_linux_x86_64_build/FFmpeg-n6.0/installed/FFmpeg-n6.0
I have a problem further down the line whereby the linker is trying to link the FFmpeg libraries both with and without the lib prefix. I'm currently investigating this.
-
nevermind the gstreamer backend is not working
giving me "Internal data stream error." when i try to play most files, other files it just crashes
back to trying to get the ffmpeg backend to work i guess -
that's weird, since i have all the libav/ffmpeg libraries built and installed at /usr/local/FFmpeg-n6.0, including libavdevice, libavfilter, and libpostproc
this is after running:
./configure -prefix "/home/eramne/Qt6.5.1/" -release -openssl -openssl-linked -no-widgets -submodules qt5compat,qtbase,qtdeclarative,qtimageformats,qtmultimedia,qtshadertools,qtsvg,qttranslations -DFFMPEG_DIR=/usr/local/FFmpeg-n6.0/
-
maybe its just trying to use the ffmpeg packages i have installed via apt instead of the ones i've built and linked to with
-DFFMPEG_DIR=/usr/local/FFmpeg-n6.0/
? If so, how do i stop it from doing that? -
yeah, it's doing that. I tried building/installing ffmpeg 5.1, using the
-DFFMPEG_DIR
thing to point to that, and in the output of the configure script it still showed that it's using the same versions of the av/ffmpeg libraries./configure -prefix "/home/eramne/Qt6.5.1/" -top-level -release -openssl -openssl-linked -no-widgets -submodules qt5compat,qtbase,qtdeclarative,qtimageformats,qtmultimedia,qtshadertools,qtsvg,qttranslations -DFFMPEG_DIR=/home/eramne/Desktop/ffmpeg/installed/ffmpeg-5.1 ./configure -redo
-
i modified the https://github.com/qt/qtmultimedia/blob/6.5.1/cmake/FindFFmpeg.cmake file like this
### Macro: set_component_found # # Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. # macro(set_component_found _component ) if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) # message(STATUS " - ${_component} found.") set(${_component}_FOUND TRUE) set(${CMAKE_FIND_PACKAGE_NAME}_${_component}_FOUND TRUE) else () # message(STATUS " - ${_component} not found.") endif () endmacro() find_package(PkgConfig QUIET) #if (NOT PKG_CONFIG_FOUND AND NOT FFMPEG_DIR) # set(FFMPEG_DIR "/usr/local") #endif() set(FFMPEG_DIR "/home/eramne/Desktop/ffmpeg/installed/ffmpeg-6.0")
to explicitly force it to use my own ffmpeg installation
and that worked -
i guess cmake variables are separate from environment variables
since i tried usingexport FFMPEG_DIR=/home/eramne/Desktop/ffmpeg/installed/ffmpeg-6.0
, but that didn't work
i guess i probably could've used the configure.cmake file in some way to set that variable? but i don't use cmake and i don't know how to do that, and i didn't feel like figuring out how -
@eramne You need the -- in the Qt configure line to separate the CMake options from the Qt ones:
./configure -prefix "/home/eramne/Qt6.5.1/" -top-level -release -openssl -openssl-linked -no-widgets -submodules qt5compat,qtbase,qtdeclarative,qtimageformats,qtmultimedia,qtshadertools,qtsvg,qttranslations -- -DFFMPEG_DIR=/home/eramne/Desktop/ffmpeg/installed/ffmpeg-5.1
-
@Martin-Burchell oh! thanks for this
-
@eramne Is it working for you now? I've got a problem linking FFmpeg with static Qt, which I've logged at https://bugreports.qt.io/browse/QTBUG-115052 but if it's working for you, feel free to mark this as Solved