Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bundle FFmpeg with Qt6 application using CMake
QtWS25 Last Chance

Bundle FFmpeg with Qt6 application using CMake

Scheduled Pinned Locked Moved Solved General and Desktop
qt6c++17ffmpegcmake
17 Posts 5 Posters 4.1k 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 Offline
    A Offline
    Ali Fadel
    wrote on last edited by
    #1

    I'm trying to bundle FFmpeg with my Qt6 application that uses CMake as build system on Mac OS system (Apple chip). I tried the following:

    FetchContent_Declare(
        ffmpeg
        GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git
        GIT_TAG        n5.1.2
    )
    
    FetchContent_MakeAvailable(ffmpeg)
    
    include_directories(
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil"
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec"
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat"
    )
    
    target_link_libraries(
        taqtie
        PRIVATE
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil/libavutil.h"
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec/libavcodec.h"
        "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat/libavformat.h"
    )
    

    But when I include FFmpeg libraries like this:

    extern "C" {
    #ifndef __STDC_CONSTANT_MACROS
    #define __STDC_CONSTANT_MACROS
    #endif
    #include <avutil.h>
    }
    

    I got the following error:

    main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found
    

    I spent like 1 month on this issue and I can't find any solution. I even asked ChatGPT :)

    Do you have any idea?

    The code of the project could be found here: https://github.com/ieasybooks/taqtie.

    JonBJ Christian EhrlicherC 2 Replies Last reply
    0
    • A Offline
      A Offline
      Ali Fadel
      wrote on last edited by
      #17

      Ok, just to finalize this. Instead of the cmake code I attached above to link FFmpeg libraries, I used the same FindFFmpeg.cmake file that used by OBS Studio project on GitHub, and it worked as expected!

      I don't know what is the difference yet, I need to read through it carefully and find the differences.

      1 Reply Last reply
      0
      • A Ali Fadel

        I'm trying to bundle FFmpeg with my Qt6 application that uses CMake as build system on Mac OS system (Apple chip). I tried the following:

        FetchContent_Declare(
            ffmpeg
            GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git
            GIT_TAG        n5.1.2
        )
        
        FetchContent_MakeAvailable(ffmpeg)
        
        include_directories(
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil"
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec"
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat"
        )
        
        target_link_libraries(
            taqtie
            PRIVATE
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil/libavutil.h"
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec/libavcodec.h"
            "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat/libavformat.h"
        )
        

        But when I include FFmpeg libraries like this:

        extern "C" {
        #ifndef __STDC_CONSTANT_MACROS
        #define __STDC_CONSTANT_MACROS
        #endif
        #include <avutil.h>
        }
        

        I got the following error:

        main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found
        

        I spent like 1 month on this issue and I can't find any solution. I even asked ChatGPT :)

        Do you have any idea?

        The code of the project could be found here: https://github.com/ieasybooks/taqtie.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @Ali-Fadel
        Well I presume avutil.h goes #include "libavutil/avconfig.h" or similar and that file can't be found? Does it not exist, or is it somewhere but not on included path?

        1 Reply Last reply
        0
        • A Ali Fadel

          I'm trying to bundle FFmpeg with my Qt6 application that uses CMake as build system on Mac OS system (Apple chip). I tried the following:

          FetchContent_Declare(
              ffmpeg
              GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git
              GIT_TAG        n5.1.2
          )
          
          FetchContent_MakeAvailable(ffmpeg)
          
          include_directories(
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil"
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec"
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat"
          )
          
          target_link_libraries(
              taqtie
              PRIVATE
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavutil/libavutil.h"
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavcodec/libavcodec.h"
              "/Volumes/ieasybooks/taqtie/build-repo-Qt_6_4_0_for_macOS-Debug/_deps/ffmpeg-src/libavformat/libavformat.h"
          )
          

          But when I include FFmpeg libraries like this:

          extern "C" {
          #ifndef __STDC_CONSTANT_MACROS
          #define __STDC_CONSTANT_MACROS
          #endif
          #include <avutil.h>
          }
          

          I got the following error:

          main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found
          

          I spent like 1 month on this issue and I can't find any solution. I even asked ChatGPT :)

          Do you have any idea?

          The code of the project could be found here: https://github.com/ieasybooks/taqtie.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #3

          @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

          I even asked ChatGPT :)

          wtf?

          main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

          As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          JonBJ A 2 Replies Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

            I even asked ChatGPT :)

            wtf?

            main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

            As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @Christian-Ehrlicher said in Bundle FFmpeg with Qt6 application using CMake:

            I even asked ChatGPT :)

            Yeah, we're going to be out of business soon, no longer needed....

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

              I even asked ChatGPT :)

              wtf?

              main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

              As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

              A Offline
              A Offline
              Ali Fadel
              wrote on last edited by
              #5

              @Christian-Ehrlicher said in Bundle FFmpeg with Qt6 application using CMake:

              @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

              I even asked ChatGPT :)

              wtf?

              main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

              As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

              As you can see in the CMake configs I attached above I'm including libavutil directory. The other issue that I can't find avconfig.h file when I navigate to the folder.

              I found some people saying that this file is auto-generated by running ./configure executable within FFmpeg source code. I don't have any idea about this TBH.

              JoeCFDJ Christian EhrlicherC 2 Replies Last reply
              0
              • A Ali Fadel

                @Christian-Ehrlicher said in Bundle FFmpeg with Qt6 application using CMake:

                @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

                I even asked ChatGPT :)

                wtf?

                main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

                As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

                As you can see in the CMake configs I attached above I'm including libavutil directory. The other issue that I can't find avconfig.h file when I navigate to the folder.

                I found some people saying that this file is auto-generated by running ./configure executable within FFmpeg source code. I don't have any idea about this TBH.

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #6

                @Ali-Fadel if you can not find the header files which your project needs, that means your fetch might grab only libs., but not the all dev packages which have include dir and all header files. clone FFmpeg manually and see what you get.

                A 1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @Ali-Fadel if you can not find the header files which your project needs, that means your fetch might grab only libs., but not the all dev packages which have include dir and all header files. clone FFmpeg manually and see what you get.

                  A Offline
                  A Offline
                  Ali Fadel
                  wrote on last edited by
                  #7

                  @JoeCFD I'm working with a clone from GitHub

                  1 Reply Last reply
                  0
                  • Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    ffmpeg is not a CMake based project, so just fetching source from GitHub and including some headers is not gonna work.

                    You need to build ffmpeg first. This includes running the configure script and then make and make install. See here. This will create a directory which will have a set of header files for including and built shared libraries. It will also generate that missing config header.

                    With ffmpeg built you can then populate target_include_directories and target_link_libraries with paths to that build artifacts. Also target_link_libraries is for linking libraries. Adding header files there like you did makes no sense.

                    If you don't want to build ffmpeg yourself you can look for a prebuilt version that you can fetch or use a package manager that will take care of the fetch and build for you.

                    1 Reply Last reply
                    1
                    • A Ali Fadel

                      @Christian-Ehrlicher said in Bundle FFmpeg with Qt6 application using CMake:

                      @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

                      I even asked ChatGPT :)

                      wtf?

                      main.cpp:6:10: In included file: 'libavutil/avconfig.h' file not found

                      As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

                      As you can see in the CMake configs I attached above I'm including libavutil directory. The other issue that I can't find avconfig.h file when I navigate to the folder.

                      I found some people saying that this file is auto-generated by running ./configure executable within FFmpeg source code. I don't have any idea about this TBH.

                      Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @Ali-Fadel said in Bundle FFmpeg with Qt6 application using CMake:

                      As you can see you have to add the include directory which contains the libavutil directory so the compiler can find libavutil/avconfig.h

                      As you can see in the CMake configs I attached above I'm including libavutil directory.

                      And now re-read my answer and your response and adjust your target_include_directories() call to include the correct directory.

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      1
                      • A Offline
                        A Offline
                        Ali Fadel
                        wrote on last edited by
                        #10

                        Thanks all for your explanation!
                        I will give it another try and see what happens, I tried to build ffmpeg myself on macos but it failed with multiple errors related to missing packages while they are already installed.
                        I will try to find a prebuilt version and use it.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          Ali Fadel
                          wrote on last edited by
                          #11

                          Hello everyone, I found this FFmpeg setup: https://github.com/thomas-moulard/visp-deb/blob/master/CMakeModules/FindFFMPEG.cmake, and I used it in my project and it works fine now.

                          I used it in this way:

                          FIND_PATH(FFMPEG_INCLUDE_DIR_AVUTIL NAMES libavutil/avutil.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_AVCODEC NAMES libavcodec/avcodec.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_AVFORMAT NAMES libavformat/avformat.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_AVDEVICE NAMES libavdevice/avdevice.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_AVFILTER NAMES libavfilter/avfilter.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_SWSCALE NAMES libswscale/swscale.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_SWRESAMPLE NAMES libswresample/swresample.h)
                          FIND_PATH(FFMPEG_INCLUDE_DIR_POSTPROC NAMES libpostproc/postprocess.h)
                          
                          target_include_directories(taqtie PRIVATE
                              ${FFMPEG_INCLUDE_DIR_AVUTIL}
                              ${FFMPEG_INCLUDE_DIR_AVCODEC}
                              ${FFMPEG_INCLUDE_DIR_AVFORMAT}
                              ${FFMPEG_INCLUDE_DIR_AVDEVICE}
                              ${FFMPEG_INCLUDE_DIR_AVFILTER}
                              ${FFMPEG_INCLUDE_DIR_SWSCALE}
                              ${FFMPEG_INCLUDE_DIR_SWRESAMPLE}
                              ${FFMPEG_INCLUDE_DIR_POSTPROC}
                          )
                          
                          FIND_LIBRARY(FFMPEG_AVUTIL_LIBRARY NAMES avutil)
                          FIND_LIBRARY(FFMPEG_AVCODEC_LIBRARY NAMES avcodec)
                          FIND_LIBRARY(FFMPEG_AVFORMAT_LIBRARY NAMES avformat)
                          FIND_LIBRARY(FFMPEG_AVDEVICE_LIBRARY NAMES avdevice)
                          FIND_LIBRARY(FFMPEG_AVFILTER_LIBRARY NAMES avfilter)
                          FIND_LIBRARY(FFMPEG_SWSCALE_LIBRARY NAMES swscale)
                          FIND_LIBRARY(FFMPEG_SWRESAMPLE_LIBRARY NAMES swresample)
                          FIND_LIBRARY(FFMPEG_POSTPROC_LIBRARY NAMES postproc)
                          
                          target_link_libraries(taqtie PRIVATE
                              ${FFMPEG_AVUTIL_LIBRARY}
                              ${FFMPEG_AVCODEC_LIBRARY}
                              ${FFMPEG_AVFORMAT_LIBRARY}
                              ${FFMPEG_AVDEVICE_LIBRARY}
                              ${FFMPEG_AVFILTER_LIBRARY}
                              ${FFMPEG_SWSCALE_LIBRARY}
                              ${FFMPEG_SWRESAMPLE_LIBRARY}
                              ${FFMPEG_POSTPROC_LIBRARY}
                          )
                          

                          And finally I can import the libraries like this:

                          #include <libavutil/avutil.h>
                          #include <libavcodec/avcodec.h>
                          #include <libavformat/avformat.h>
                          #include <libavdevice/avdevice.h>
                          #include <libavfilter/avfilter.h>
                          #include <libswscale/swscale.h>
                          #include <libswresample/swresample.h>
                          #include <libpostproc/postprocess.h>
                          

                          Thanks for your help! Very appreciated.

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            Ali Fadel
                            wrote on last edited by
                            #12

                            I faced a weird issue after including FFmpeg directories and libraries. When I start my application in debug mode and try to use QFileDialog::getOpenFileName, it crashes immediately, but when I run the executable, it works fine. I don't know why. Any thoughts?

                            JoeCFDJ 1 Reply Last reply
                            0
                            • A Ali Fadel

                              I faced a weird issue after including FFmpeg directories and libraries. When I start my application in debug mode and try to use QFileDialog::getOpenFileName, it crashes immediately, but when I run the executable, it works fine. I don't know why. Any thoughts?

                              JoeCFDJ Offline
                              JoeCFDJ Offline
                              JoeCFD
                              wrote on last edited by
                              #13

                              @Ali-Fadel can you try to change your cmake file for debug build to ?
                              set( CMAKE_BUILD_TYPE Debug )

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                Ali Fadel
                                wrote on last edited by
                                #14

                                I added set( CMAKE_BUILD_TYPE Debug ) to my CMakeLists.txt, but nothing changed.

                                JoeCFDJ 1 Reply Last reply
                                0
                                • A Ali Fadel

                                  I added set( CMAKE_BUILD_TYPE Debug ) to my CMakeLists.txt, but nothing changed.

                                  JoeCFDJ Offline
                                  JoeCFDJ Offline
                                  JoeCFD
                                  wrote on last edited by
                                  #15

                                  @Ali-Fadel remove everything in the build dir and rebuild your project.

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    Ali Fadel
                                    wrote on last edited by
                                    #16

                                    I tried that also, and nothing changed. Here is my CMakeLists.txt:

                                    include(FetchContent)
                                    
                                    cmake_minimum_required(VERSION 3.5)
                                    
                                    project(taqtie VERSION 0.1 LANGUAGES CXX)
                                    
                                    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
                                    
                                    set(CMAKE_INCLUDE_CURRENT_DIR ON)
                                    
                                    set(CMAKE_AUTOUIC ON)
                                    set(CMAKE_AUTOMOC ON)
                                    set(CMAKE_AUTORCC ON)
                                    
                                    set(CMAKE_CXX_STANDARD 17)
                                    set(CMAKE_CXX_STANDARD_REQUIRED ON)
                                    
                                    set(CMAKE_BUILD_TYPE Debug)
                                    
                                    find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Core)
                                    find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core LinguistTools)
                                    
                                    # For more information, see https://github.com/pedrolcl/qt-i18n
                                    include(TranslationUtils)
                                    
                                    set(PROJECT_SOURCES
                                        main.cpp
                                    
                                        enums/section_columns.h
                                    
                                        helpers/file_helpers.h
                                        helpers/file_helpers.cpp
                                        helpers/process_helpers.h
                                        helpers/process_helpers.cpp
                                        helpers/time_helpers.h
                                        helpers/time_helpers.cpp
                                    
                                        models/section_info.h
                                        models/section_info.cpp
                                    
                                        readers/sections_reader.h
                                        readers/sections_reader.cpp
                                    
                                        windows/main_window.h
                                        windows/main_window.cpp
                                        windows/main_window.ui
                                        windows/about_window.h
                                        windows/about_window.cpp
                                        windows/about_window.ui
                                    
                                        wrappers/ffmpeg_wrapper.h
                                        wrappers/ffmpeg_wrapper.cpp
                                    )
                                    
                                    # set(TS_FILES
                                    #     i18n_ar.ts
                                    #     i18n_en.ts
                                    # )
                                    
                                    # qt_add_translation(QM_FILES ${TS_FILES})
                                    # add_app_translations_resource(APP_RES ${QM_FILES})
                                    add_qt_translations_resource(QT_RES ar)
                                    
                                    if (WIN32)
                                        set(app_icon "${CMAKE_CURRENT_SOURCE_DIR}/resources/taqtie.rc")
                                    elseif (APPLE)
                                        set(MACOSX_BUNDLE_ICON_FILE taqtie.icns)
                                        set(app_icon "${CMAKE_CURRENT_SOURCE_DIR}/resources/taqtie.icns")
                                    
                                        set_source_files_properties(${app_icon} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
                                    endif()
                                    
                                    qt_add_executable(taqtie
                                        MANUAL_FINALIZATION
                                        ${PROJECT_SOURCES}
                                    #    ${APP_RES}
                                        ${QT_RES}
                                        ${app_icon}
                                    )
                                    
                                    target_link_libraries(taqtie PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
                                    target_link_libraries(taqtie PRIVATE Qt${QT_VERSION_MAJOR}::Core)
                                    
                                    set_target_properties(taqtie PROPERTIES
                                        MACOSX_BUNDLE_GUI_IDENTIFIER taqtie.ieasybooks.com
                                        MACOSX_BUNDLE_BUNDLE_NAME تقطيع
                                        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                                        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                                        OUTPUT_NAME تقطيع
                                        MACOSX_BUNDLE TRUE
                                        WIN32_EXECUTABLE TRUE
                                    )
                                    
                                    set(taqtie_resource_files
                                        "resources/taqtie.png"
                                    )
                                    
                                    qt6_add_resources(taqtie "taqtie"
                                        PREFIX
                                            "/"
                                        FILES
                                            ${taqtie_resource_files}
                                    )
                                    
                                    install(TARGETS taqtie
                                        BUNDLE DESTINATION .
                                        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                                    )
                                    
                                    qt_finalize_executable(taqtie)
                                    
                                    # QXlsx Setup
                                    
                                    FetchContent_Declare(
                                        QXlsx
                                        GIT_REPOSITORY https://github.com/QtExcel/QXlsx.git
                                        GIT_TAG        b5585decd4e1d30ddd6563556c1c6a8da6753492
                                        SOURCE_SUBDIR  QXlsx
                                    )
                                    FetchContent_MakeAvailable(QXlsx)
                                    target_link_libraries(taqtie PRIVATE QXlsx::QXlsx)
                                    
                                    # FFmpeg Setup
                                    # This setup was found here: https://github.com/thomas-moulard/visp-deb/blob/master/CMakeModules/FindFFMPEG.cmake.
                                    # For more information, check the discussion here: https://forum.qt.io/topic/141950/bundle-ffmpeg-with-qt6-application-using-cmake.
                                    
                                    FIND_PATH(FFMPEG_INCLUDE_DIR_AVUTIL NAMES libavutil/avutil.h)
                                    FIND_PATH(FFMPEG_INCLUDE_DIR_AVCODEC NAMES libavcodec/avcodec.h)
                                    FIND_PATH(FFMPEG_INCLUDE_DIR_AVFORMAT NAMES libavformat/avformat.h)
                                    
                                    target_include_directories(taqtie PRIVATE
                                        ${FFMPEG_INCLUDE_DIR_AVUTIL}
                                        ${FFMPEG_INCLUDE_DIR_AVCODEC}
                                        ${FFMPEG_INCLUDE_DIR_AVFORMAT}
                                    )
                                    
                                    FIND_LIBRARY(FFMPEG_AVUTIL_LIBRARY NAMES avutil)
                                    FIND_LIBRARY(FFMPEG_AVCODEC_LIBRARY NAMES avcodec)
                                    FIND_LIBRARY(FFMPEG_AVFORMAT_LIBRARY NAMES avformat)
                                    
                                    target_link_libraries(taqtie PRIVATE
                                        ${FFMPEG_AVUTIL_LIBRARY}
                                        ${FFMPEG_AVCODEC_LIBRARY}
                                        ${FFMPEG_AVFORMAT_LIBRARY}
                                    )
                                    

                                    And this is the crash report from MacOS: https://justpaste.it/ap67u.

                                    Sorry for the long post, but I can post every 5 minutes only, that is why I put all information I have here.

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      Ali Fadel
                                      wrote on last edited by
                                      #17

                                      Ok, just to finalize this. Instead of the cmake code I attached above to link FFmpeg libraries, I used the same FindFFmpeg.cmake file that used by OBS Studio project on GitHub, and it worked as expected!

                                      I don't know what is the difference yet, I need to read through it carefully and find the differences.

                                      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