Cześć :) Piszę aplikacje z użyciem biblioteki ffmpeg za pomocą narzędzia Cmake z wykorzystaniem package-config. Mimo poprawnie zainstalowanego ffmpega, package-config nie może znaleźć bibliotek należących do ffmpeg. Po wpisaniu ffmpeg do cmd wyskakuje:
ffmpeg version N-99488-gbc43588a71 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3-win32 (GCC) 20200320
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-debug --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvmaf --enable-vulkan --enable-libvorbis --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
libavutil 56. 60.100 / 56. 60.100
libavcodec 58.110.100 / 58.110.100
libavformat 58. 62.100 / 58. 62.100
libavdevice 58. 11.102 / 58. 11.102
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg
Jednak przy próbie zbudowania projektu uzyskuje taki efekt:
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Using Win32 for window creation
-- Checking for module 'libavcodec'
-- No package 'libavcodec' found
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:545 (message):
A required package was not found
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:733 (_pkg_check_modules_internal)
lib/FFmpeg/CMakeLists.txt:5 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
See also "C:/Users/mswar/Desktop/App Video/video-app/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/mswar/Desktop/App Video/video-app/build/CMakeFiles/CMakeError.log".
Pod ścieżką C:\Users\mswar\Desktop\App Video\video-app znajduje sie plik CMakeLists.txt o zawartości:
project(video-app C CXX)
set (CMAKE_CXX_STANDARD 14)
add_subdirectory(lib/glfw)
add_subdirectory(lib/FFmpeg)
add_definitions(-DGL_SILENCE_DEPRECATION)
if(WIN32)
list(APPEND EXTRA_LIBS
"-lglu32 -lopengl32")
set(CMAKE_EXE_LINKER_FLAGS "-std=gnu99 -static -static-libgcc -static-libstdc++ -mwindows")
else()
list(APPEND EXTRA_LIBS"-lGL -lGLU -lX11")
endif()
list(APPEND SOURCES
src/main.cpp
src/load_frame.cpp
)
add_executable(video-app ${SOURCES})
target_link_libraries(video-app FFmpeg glfw ${EXTRA_LIBS})
Natomiast w lokalizacji: C:\Users\mswar\Desktop\App Video\video-app\lib\FFmpeg znajduje sie drugi plik CMakeLists.txt :
cmake_minimum_required(VERSION 3.14)
project(FFmpeg)
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat)
pkg_check_modules(AVFILTER REQUIRED IMPORTED_TARGET libavfilter)
pkg_check_modules(AVDEVICE REQUIRED IMPORTED_TARGET libavdevice)
pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil)
pkg_check_modules(ASWRESAMPLE REQUIRED IMPORTED_TARGET libswresample)
pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswrescale)
add_library(FFmpeg INTERFACE IMPORTED GLOBAL)
target_include_directories(FFmpeg INTERFACE
${AVCODEC_INCLUDE_DIRS}
${AVFORMAT_INCLUDE_DIRS}
${AVFILTER_INCLUDE_DIRS}
${AVDEVICE_INCLUDE_DIRS}
${AVUTIL_INCLUDE_DIRS}
${SWRESAMPLE_INCLUDE_DIRS}
${SWSCALE_INCLUDE_DIRS}
)
target_link_options(FFmpeg INTERFACE
${AVCODEC_LDFLAGS}
${AVFORMAT_LDFLAGS}
${AVFILTER_LDFLAGS}
${AVDEVICE_LDFLAGS}
${AVUTIL_LDFLAGS}
${SWRESAMPLE_LDFLAGS}
${SWSCALE_LDFLAGS}
)
Bardzo proszę o pomoc, nie bardzo wiem co zrobić by ffmpeg był znaleziony przez pkg-config.
Z góry dziękuję :)