feat: nvenc and amf support for windows
parent
96da216d55
commit
110166203b
|
@ -9,3 +9,7 @@ This project builds the LGPL 2.1 version of ffmpeg, including OpenH264
|
|||
|
||||
./build.sh # build ffmpeg from source
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
- mfx_dispatch patches from [vcpkg](https://github.com/microsoft/vcpkg)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TOOLCHAIN=i686-w64-mingw32
|
||||
source win-env.sh
|
||||
|
||||
FFMPEG_OS=win32 FFMPEG_MSBUILD=1 OPENH264_ARCH=i686 OPENH264_OS=msvc CC=cl CXX=cl AR=lib bash build.sh --arch i686
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TOOLCHAIN=x86_64-w64-mingw32
|
||||
source win-env.sh
|
||||
|
||||
FFMPEG_OS=win64 FFMPEG_MSBUILD=1 OPENH264_ARCH=x86_64 OPENH264_OS=msvc CC=cl CXX=cl AR=lib bash build.sh --arch x86_64
|
||||
|
|
12
build.sh
12
build.sh
|
@ -22,11 +22,19 @@ export PREFIX=$workDir/prefix
|
|||
export PKG_CONFIG_DIR=$PREFIX/lib/pkgconfig
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_DIR
|
||||
|
||||
rm -rf $PREFIX
|
||||
mkdir -p $PREFIX
|
||||
#rm -rf $PREFIX
|
||||
#mkdir -p $PREFIX
|
||||
|
||||
mkdir -p $workDir
|
||||
mkdir -p $outDir
|
||||
|
||||
case $FFBUILD_PLATFORM in
|
||||
win)
|
||||
bash scripts/build-ffnvcodec.sh
|
||||
# disabled due to build error
|
||||
# bash scripts/build-libmfx.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
bash scripts/build-openh264.sh
|
||||
bash scripts/build-ffmpeg.sh
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
Subject: [PATCH] fix for vcpkg
|
||||
fix missing mfx_driver_store_loader related symbols
|
||||
---
|
||||
Index: CMakeLists.txt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
|
||||
+++ b/CMakeLists.txt (revision 5ebef171699530ca01594a5cef10a68811f4d105)
|
||||
@@ -40,6 +39,7 @@
|
||||
src/mfx_load_plugin.cpp
|
||||
src/mfx_plugin_hive.cpp
|
||||
src/mfx_win_reg_key.cpp
|
||||
+ src/mfx_driver_store_loader.cpp
|
||||
)
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
||||
@@ -56,6 +56,12 @@
|
||||
configure_file (${CMAKE_SOURCE_DIR}/libmfx.pc.cmake ${CMAKE_BINARY_DIR}/libmfx.pc @ONLY)
|
||||
|
||||
add_library( mfx STATIC ${SOURCES} )
|
||||
+
|
||||
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
+ set_target_properties(mfx
|
||||
+ PROPERTIES PREFIX lib)
|
||||
+endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
+
|
||||
install (DIRECTORY ${CMAKE_SOURCE_DIR}/mfx DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h")
|
||||
install (FILES ${CMAKE_BINARY_DIR}/libmfx.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
|
||||
install (TARGETS mfx ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
Index: libmfx.pc.cmake
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
|
||||
--- a/libmfx.pc.cmake (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
|
||||
+++ b/libmfx.pc.cmake (revision 388559e9e8234eb0989e1598a9beea4035a04132)
|
||||
@@ -9,6 +9,6 @@
|
||||
Requires:
|
||||
Requires.private:
|
||||
Conflicts:
|
||||
-Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.a
|
||||
+Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
|
||||
Libs.private:
|
||||
Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
|
||||
Index: src/mfx_driver_store_loader.cpp
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/mfx_driver_store_loader.cpp b/src/mfx_driver_store_loader.cpp
|
||||
--- a/src/mfx_driver_store_loader.cpp (revision 388559e9e8234eb0989e1598a9beea4035a04132)
|
||||
+++ b/src/mfx_driver_store_loader.cpp (revision 5ebef171699530ca01594a5cef10a68811f4d105)
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
+#pragma comment(lib, "Ole32.lib")
|
||||
+
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
|
||||
===================================================================
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9446bc4..a8a3288 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -3,16 +3,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
project( libmfx )
|
||||
|
||||
# FIXME Adds support for using system/other install of intel media sdk
|
||||
-find_path ( INTELMEDIASDK_PATH mfx/mfxvideo.h
|
||||
- HINTS "${CMAKE_SOURCE_DIR}"
|
||||
-)
|
||||
-
|
||||
-if (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
- message( FATAL_ERROR "Intel MEDIA SDK include not found" )
|
||||
-else (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
- message(STATUS "Intel Media SDK is here: ${INTELMEDIASDK_PATH}")
|
||||
-endif (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
-
|
||||
+set(INTELMEDIASDK_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
|
||||
index fabb541..5d248fe 100644
|
||||
--- a/libmfx.pc.cmake
|
||||
+++ b/libmfx.pc.cmake
|
||||
@@ -11,4 +11,4 @@ Requires.private:
|
||||
Conflicts:
|
||||
Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
|
||||
Libs.private:
|
||||
-Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
|
||||
+Cflags: -I${includedir}
|
|
@ -1,9 +1,15 @@
|
|||
export ffmpegPath=$workDir/ffmpeg
|
||||
export amfPath=$workDir/amf
|
||||
# export CFLAGS=-L$PREFIX/lib
|
||||
|
||||
git clone https://github.com/FFmpeg/FFmpeg -b release/6.0 $ffmpegPath --depth 1
|
||||
|
||||
git clone https://github.com/GPUOpen-LibrariesAndSDKs/AMF -b v1.4.29 $amfPath --depth 1
|
||||
|
||||
cd $ffmpegPath
|
||||
|
||||
cp -r $amfPath/amf/public/include $PREFIX/include/AMF
|
||||
|
||||
make distclean
|
||||
|
||||
flags="--cc=$CC --cxx=$CXX"
|
||||
|
@ -17,7 +23,9 @@ fi
|
|||
--enable-libopenh264 \
|
||||
--prefix=$PREFIX --enable-cross-compile --arch=$ARCH \
|
||||
--pkg-config-flags="--static" --target-os=$FFMPEG_OS \
|
||||
${flags}
|
||||
--extra-ldflags="-libpath:$PREFIX/lib" \
|
||||
--extra-cflags="-I$PREFIX/include/mfx" \
|
||||
${flags} ${FFBUILD_FLAGS}
|
||||
|
||||
make -j$JOBS
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
projectPath=$workDir/nv-codec-headers
|
||||
|
||||
git clone https://github.com/FFmpeg/nv-codec-headers $projectPath --depth 1
|
||||
|
||||
cd $projectPath
|
||||
|
||||
make install PREFIX=$PREFIX
|
|
@ -0,0 +1,26 @@
|
|||
projectDir=$workDir/mfx
|
||||
|
||||
# git clone https://github.com/lu-zero/mfx_dispatch $projectDir --depth 1
|
||||
|
||||
rm -rf $projectDir
|
||||
|
||||
mkdir $projectDir
|
||||
cd $projectDir
|
||||
|
||||
git init
|
||||
git remote add origin https://github.com/lu-zero/mfx_dispatch
|
||||
git fetch --depth 1 origin 5a3f178be7f406cec920b9f52f46c1ae29f29bb2
|
||||
git checkout FETCH_HEAD
|
||||
|
||||
git apply ../../patches/mfx.patch
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 -DCMAKE_GENERATOR_PLATFORM=x86 ..
|
||||
|
||||
cmake --build . --config Release
|
||||
|
||||
cmake --install .
|
|
@ -18,7 +18,7 @@ cd $projectDir
|
|||
|
||||
args="PREFIX=$PREFIX OS=$OPENH264_OS ARCH=$OPENH264_ARCH CC=$CC CXX=$CXX AR=$AR"
|
||||
|
||||
make clean
|
||||
# make clean
|
||||
|
||||
make -j$JOBS $args
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
export FFBUILD_FLAGS="--enable-ffnvcodec --enable-dxva2 --enable-amf"
|
||||
export FFBUILD_PLATFORM="win"
|
Loading…
Reference in New Issue