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?

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.2k Views
  • 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.
  • ? 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