Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to configure Qt 6.5.1 QtMultimedia to use custom FFmpeg installation?
Forum Updated to NodeBB v4.3 + New Features

How to configure Qt 6.5.1 QtMultimedia to use custom FFmpeg installation?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
qtmultimediaffmpeg6.5.1configurationubuntu
18 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #2

    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?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      how do i get the pulseaudio backend working/enabled/configured?

      ? 1 Reply Last reply
      0
      • ? A Former User

        how do i get the pulseaudio backend working/enabled/configured?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #4

        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 missing

        this should really be in the documentation somewhere, like in https://doc.qt.io/qt-6/linux-requirements.html

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #6

            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

            ? 1 Reply Last reply
            0
            • ? A Former User

              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

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              although, i already have those things?
              9305004d-2b0b-46b1-8b04-046e0907a06b-image.png ca8d2904-9dae-4faf-9c30-726d71a03a2d-image.png
              (the /usr/local/FFmpeg-n6.0/ folder also has the same contents)

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #8

                well since i got the gstreamer backend working i guess ill just give up on ffmpeg for now and use that instead

                M ? 2 Replies Last reply
                0
                • ? A Former User

                  well since i got the gstreamer backend working i guess ill just give up on ffmpeg for now and use that instead

                  M Offline
                  M Offline
                  Martin Burchell
                  wrote on last edited by
                  #9

                  @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.

                  1 Reply Last reply
                  0
                  • ? A Former User

                    well since i got the gstreamer backend working i guess ill just give up on ffmpeg for now and use that instead

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by A Former User
                    #10

                    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

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #11

                      720c10c6-ce79-41f7-a9ba-8c698a75ff68-image.png

                      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/

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #12

                        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?

                        ? 1 Reply Last reply
                        0
                        • ? A Former User

                          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?

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by A Former User
                          #13

                          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
                          

                          810c5a1b-3f8d-44b6-b2bc-244d60123074-image.png

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #14

                            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

                            14417440-50e8-427d-ba27-7bad26251b84-image.png

                            ? 1 Reply Last reply
                            0
                            • ? A Former User

                              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

                              14417440-50e8-427d-ba27-7bad26251b84-image.png

                              ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #15

                              i guess cmake variables are separate from environment variables
                              since i tried using export 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

                              M 1 Reply Last reply
                              0
                              • ? A Former User

                                i guess cmake variables are separate from environment variables
                                since i tried using export 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

                                M Offline
                                M Offline
                                Martin Burchell
                                wrote on last edited by
                                #16

                                @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
                                
                                ? 1 Reply Last reply
                                1
                                • M Martin Burchell

                                  @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
                                  
                                  ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by
                                  #17

                                  @Martin-Burchell oh! thanks for this

                                  M 1 Reply Last reply
                                  0
                                  • ? A Former User

                                    @Martin-Burchell oh! thanks for this

                                    M Offline
                                    M Offline
                                    Martin Burchell
                                    wrote on last edited by
                                    #18

                                    @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

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved