Skip to content

Commit 5289668

Browse files
authored
Merge pull request #250 from Stefan-Olt/master
Vulkan/OpenCL support, libs updated, minor fix for build errors in certain configurations
2 parents 4e71acc + 0dd95dd commit 5289668

File tree

2 files changed

+92
-27
lines changed

2 files changed

+92
-27
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,47 @@ $ ./build-ffmpeg --enable-gpl-and-non-free --build
116116
* MPEG2 video `mpeg2_vaapi`
117117
* VP8 `vp8_vaapi`
118118
* VP9 `vp9_vaapi`
119-
* `AMF`: [AMD's Advanced Media Framework](https://github.com/GPUOpen-LibrariesAndSDKs/AMF). These encoders will only
119+
* `AMF`: [AMD's Advanced Media Framework](https://github.com/GPUOpen-LibrariesAndSDKs/AMF). These encoders/decoders will only
120120
be available if `amdgpu` drivers are detected in use on the system with `lspci -v`.
121+
* Decoders
122+
* H264 `h264_amf`
123+
* H265 `hevc_amf`
124+
* AV1 `av1_amf`
125+
* VP9 `vp9_amf`
126+
* Encoders
127+
* H264 `h264_amf`
128+
* H265 `hevc_amf`
129+
* AV1 `av1_amf`
130+
* `Vulkan`: [Cross-platform graphics and compute API](https://www.vulkan.org/). These encoders/decoders will only be available if
131+
Vulkan drivers are detected on the system. Follow the [Wiki](https://trac.ffmpeg.org/wiki/HWAccelIntro#Vulkan) to enable Vulkan decoding.
132+
macOS is supported when MoltenVK is available, but functionality may be limited.
133+
These encoders/decoders will be available using fixed-function blocks in the GPU:
134+
* Decoders
135+
* H264
136+
* H265
137+
* AV1
138+
* VP9
121139
* Encoders
122-
* H264 `h264_amf`
140+
* H264 `h264_vulkan`
141+
* H265 `hevc_vulkan`
142+
* AV1 `av1_vulkan`
123143

144+
Additionally, FFmpeg implements [video filters](https://ffmpeg.org/ffmpeg-filters.html#Vulkan-Video-Filters)
145+
using shaders on the GPU, as well as these encoders/decoders:
146+
* Decoders
147+
* FFV1
148+
* ProRes RAW
149+
* Encoders
150+
* FFV1 `ffv1_vulkan`
151+
* `OpenCL`: [Cross-platform compute API](https://www.khronos.org/opencl/) Several [filters](https://ffmpeg.org/ffmpeg-filters.html#OpenCL-Video-Filters)
152+
are implemented in FFmpeg using OpenCL. As Apple has discontinued support for OpenCL, it is not available on macOS.
153+
154+
* `Video Toolbox`: [Apple API](https://developer.apple.com/documentation/videotoolbox) to access hardware-acclerated enncoders/decoders
155+
on macOS:
156+
* Encoders an decoders
157+
* H264 `h264_videotoolbox`
158+
* H265 `hevc_videotoolbox`
159+
* ProRes `prores_videotoolbox`
124160

125161
## Build Script Usage
126162

build-ffmpeg

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,14 @@ fi
366366
## build tools
367367
##
368368

369-
if build "giflib" "5.2.1"; then
369+
if build "giflib" "5.2.2"; then
370370
download "https://netcologne.dl.sourceforge.net/project/giflib/giflib-$CURRENT_PACKAGE_VERSION.tar.gz"
371-
if [[ "$OSTYPE" == "darwin"* ]]; then
372-
download "https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch"
373-
execute patch -p0 --forward "${PACKAGES}/giflib-$CURRENT_PACKAGE_VERSION/Makefile" "${PACKAGES}/Makefile.patch" || true
374-
fi
375371
cd "${PACKAGES}"/giflib-$CURRENT_PACKAGE_VERSION || exit
372+
#building docs fails if the tools needed are not installed
373+
#there is no option to not build the docs on Linux, we need to modify the Makefile
374+
sed 's/$(MAKE) -C doc//g' Makefile >Makefile.patched
375+
rm Makefile
376+
sed 's/install: all install-bin install-include install-lib install-man/install: all install-bin install-include install-lib/g' Makefile.patched >Makefile
376377
#multicore build disabled for this library
377378
execute make
378379
execute make PREFIX="${WORKSPACE}" install
@@ -457,7 +458,7 @@ if $NONFREE_AND_GPL; then
457458
build_done "gettext" $CURRENT_PACKAGE_VERSION
458459
fi
459460

460-
if build "openssl" "3.5.0"; then
461+
if build "openssl" "3.5.2"; then
461462
download "https://github.com/openssl/openssl/archive/refs/tags/openssl-$CURRENT_PACKAGE_VERSION.tar.gz" "openssl-$CURRENT_PACKAGE_VERSION.tar.gz"
462463
execute ./Configure --prefix="${WORKSPACE}" --openssldir="${WORKSPACE}" --libdir="lib" --with-zlib-include="${WORKSPACE}"/include/ --with-zlib-lib="${WORKSPACE}"/lib no-shared zlib
463464
execute make -j $MJOBS
@@ -483,7 +484,7 @@ else
483484
fi
484485

485486
if [[ ! $ARCH == 'arm64' ]]; then
486-
if build "gnutls" "3.8.5"; then
487+
if build "gnutls" "3.8.10"; then
487488
download "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-$CURRENT_PACKAGE_VERSION.tar.xz"
488489
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static --disable-doc --disable-tools --disable-cxx --disable-tests --disable-gtk-doc-html --disable-libdane --disable-nls --enable-local-libopts --disable-guile --with-included-libtasn1 --with-included-unistring --without-p11-kit CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
489490
execute make -j $MJOBS
@@ -569,7 +570,7 @@ if command_exists "python3"; then
569570
fi
570571
fi
571572

572-
if build "svtav1" "3.0.2"; then
573+
if build "svtav1" "3.1.2"; then
573574
# Last known working commit which passed CI Tests from HEAD branch
574575
download "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v$CURRENT_PACKAGE_VERSION/SVT-AV1-v$CURRENT_PACKAGE_VERSION.tar.gz" "svtav1-$CURRENT_PACKAGE_VERSION.tar.gz"
575576
cd "${PACKAGES}"/svtav1-$CURRENT_PACKAGE_VERSION//Build/linux || exit
@@ -584,7 +585,7 @@ CONFIGURE_OPTIONS+=("--enable-libsvtav1")
584585

585586
if command_exists "cargo"; then
586587
if [[ ! "$SKIPRAV1E" == "yes" ]]; then
587-
if build "rav1e" "0.8.0"; then
588+
if build "rav1e" "0.8.1"; then
588589
echo "if you get the message 'cannot be built because it requires rustc x.xx or newer, try to run 'rustup update'"
589590
execute cargo install cargo-c
590591
download "https://github.com/xiph/rav1e/archive/refs/tags/v$CURRENT_PACKAGE_VERSION.tar.gz"
@@ -717,8 +718,8 @@ if $NONFREE_AND_GPL; then
717718
CONFIGURE_OPTIONS+=("--enable-libvidstab")
718719
fi
719720

720-
if build "av1" "10aece4157eb79315da205f39e19bf6ab3ee30d0"; then
721-
# 10aece4157eb79315da205f39e19bf6ab3ee30d0 == v3.12.1
721+
if build "av1" "d9c115ce0951324dee243041ef810e27202de20f"; then
722+
# d9c115ce0951324dee243041ef810e27202de20f == v3.13.0
722723
download "https://aomedia.googlesource.com/aom/+archive/$CURRENT_PACKAGE_VERSION.tar.gz" "av1.tar.gz" "av1"
723724
make_dir "$PACKAGES"/aom_build
724725
cd "$PACKAGES"/aom_build || exit
@@ -734,7 +735,7 @@ if build "av1" "10aece4157eb79315da205f39e19bf6ab3ee30d0"; then
734735
fi
735736
CONFIGURE_OPTIONS+=("--enable-libaom")
736737

737-
if build "zimg" "3.0.5"; then
738+
if build "zimg" "3.0.6"; then
738739
download "https://github.com/sekrit-twc/zimg/archive/refs/tags/release-$CURRENT_PACKAGE_VERSION.tar.gz" "zimg-$CURRENT_PACKAGE_VERSION.tar.gz" "zimg"
739740
cd zimg-release-$CURRENT_PACKAGE_VERSION || exit
740741
execute "${WORKSPACE}/bin/libtoolize" -i -f -q
@@ -798,14 +799,14 @@ if ! $DISABLE_LV2 ; then
798799
fi
799800
if build "sratom" "0.6.16"; then
800801
download "https://gitlab.com/lv2/sratom/-/archive/v$CURRENT_PACKAGE_VERSION/sratom-v$CURRENT_PACKAGE_VERSION.tar.gz" "sratom-v$CURRENT_PACKAGE_VERSION.tar.gz"
801-
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib
802+
execute meson build --prefix="${WORKSPACE}" -Ddocs=disabled --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib
802803
execute ninja -C build
803804
execute ninja -C build install
804805
build_done "sratom" $CURRENT_PACKAGE_VERSION
805806
fi
806807
if build "lilv" "0.24.16"; then
807808
download "https://gitlab.com/lv2/lilv/-/archive/v$CURRENT_PACKAGE_VERSION/lilv-v$CURRENT_PACKAGE_VERSION.tar.gz" "lilv-v$CURRENT_PACKAGE_VERSION.tar.gz"
808-
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib -Dcpp_std=c++11
809+
execute meson build --prefix="${WORKSPACE}" -Ddocs=disabled --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib -Dcpp_std=c++11
809810
execute ninja -C build
810811
execute ninja -C build install
811812
build_done "lilv" $CURRENT_PACKAGE_VERSION
@@ -848,7 +849,7 @@ if build "opus" "1.5.2"; then
848849
fi
849850
CONFIGURE_OPTIONS+=("--enable-libopus")
850851

851-
if build "libogg" "1.3.5"; then
852+
if build "libogg" "1.3.6"; then
852853
download "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-$CURRENT_PACKAGE_VERSION.tar.xz"
853854
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
854855
execute make -j $MJOBS
@@ -903,7 +904,7 @@ if build "libtiff" "4.7.0"; then
903904
execute make install
904905
build_done "libtiff" $CURRENT_PACKAGE_VERSION
905906
fi
906-
if build "libpng" "1.6.48"; then
907+
if build "libpng" "1.6.50"; then
907908
download "https://sourceforge.net/projects/libpng/files/libpng16/$CURRENT_PACKAGE_VERSION/libpng-$CURRENT_PACKAGE_VERSION.tar.gz" "libpng-$CURRENT_PACKAGE_VERSION.tar.gz"
908909
export LDFLAGS="${LDFLAGS}"
909910
export CPPFLAGS="${CFLAGS}"
@@ -930,7 +931,7 @@ if build "libjxl" "0.11.1"; then
930931
fi
931932
CONFIGURE_OPTIONS+=("--enable-libjxl")
932933

933-
if build "libwebp" "1.5.0"; then
934+
if build "libwebp" "1.6.0"; then
934935
# libwebp can fail to compile on Ubuntu if these flags were left set to CFLAGS
935936
CPPFLAGS=
936937
download "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$CURRENT_PACKAGE_VERSION.tar.gz" "libwebp-$CURRENT_PACKAGE_VERSION.tar.gz"
@@ -948,7 +949,7 @@ CONFIGURE_OPTIONS+=("--enable-libwebp")
948949
## other library
949950
##
950951

951-
if build "libsdl" "2.32.8"; then
952+
if build "libsdl" "2.32.10"; then
952953
download "https://github.com/libsdl-org/SDL/releases/download/release-$CURRENT_PACKAGE_VERSION/SDL2-$CURRENT_PACKAGE_VERSION.tar.gz"
953954
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
954955
execute make -j $MJOBS
@@ -1029,6 +1030,27 @@ fi
10291030
## HWaccel library
10301031
##
10311032

1033+
if build "vulkan-headers" "1.4.326"; then
1034+
download "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v$CURRENT_PACKAGE_VERSION.tar.gz" "Vulkan-Headers-$CURRENT_PACKAGE_VERSION.tar.gz"
1035+
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -B build/
1036+
execute cmake --install build --prefix "${WORKSPACE}"
1037+
build_done "vulkan-headers" $CURRENT_PACKAGE_VERSION
1038+
fi
1039+
CONFIGURE_OPTIONS+=("--enable-vulkan")
1040+
1041+
# vulkan filters and some encoders/decorders are implemented using shaders, for those we need a shader compiler
1042+
if command_exists "python3"; then
1043+
if build "glslang" "15.4.0"; then
1044+
download "https://github.com/KhronosGroup/glslang/archive/refs/tags/$CURRENT_PACKAGE_VERSION.tar.gz" "glslang-$CURRENT_PACKAGE_VERSION.tar.gz"
1045+
execute ./update_glslang_sources.py
1046+
execute cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" .
1047+
execute make -j $MJOBS
1048+
execute make install
1049+
build_done "glslang" $CURRENT_PACKAGE_VERSION
1050+
fi
1051+
CONFIGURE_OPTIONS+=("--enable-libglslang")
1052+
fi
1053+
10321054
if [[ "$OSTYPE" == "linux-gnu" ]]; then
10331055
if command_exists "nvcc"; then
10341056
if build "nv-codec" "11.1.5.3"; then
@@ -1075,6 +1097,20 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
10751097
build_done "amf" $CURRENT_PACKAGE_VERSION
10761098
fi
10771099
CONFIGURE_OPTIONS+=("--enable-amf")
1100+
1101+
if build "opencl-headers" "2025.07.22"; then
1102+
download "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v$CURRENT_PACKAGE_VERSION.tar.gz" "OpenCL-Headers-$CURRENT_PACKAGE_VERSION.tar.gz"
1103+
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -B build/
1104+
execute cmake --build build --target install
1105+
build_done "opencl-headers" $CURRENT_PACKAGE_VERSION
1106+
fi
1107+
if build "opencl-icd-loader" "2025.07.22"; then
1108+
download "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v$CURRENT_PACKAGE_VERSION.tar.gz" "OpenCL-ICD-Loader-$CURRENT_PACKAGE_VERSION.tar.gz"
1109+
execute cmake -DCMAKE_PREFIX_PATH="${WORKSPACE}" -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DENABLE_SHARED=OFF -DBUILD_SHARED_LIBS=OFF -B build/
1110+
execute cmake --build build --target install
1111+
build_done "opencl-icd-loader" $CURRENT_PACKAGE_VERSION
1112+
fi
1113+
CONFIGURE_OPTIONS+=("--enable-opencl")
10781114
fi
10791115

10801116
##
@@ -1096,13 +1132,6 @@ build "ffmpeg" "$FFMPEG_VERSION"
10961132
download "https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n$FFMPEG_VERSION.tar.gz" "FFmpeg-release-$FFMPEG_VERSION.tar.gz"
10971133
# shellcheck disable=SC2086
10981134

1099-
# this is a temporary fix to allow building ffmpeg 7.1.x with svtav1 >= 3.0.0
1100-
# (API change in svtav1 3.0: one unused parameter removed)
1101-
# the patch already in ffmpeg master branch was not backported to 7.1.x
1102-
sed 's/svt_av1_enc_init_handle(\&svt_enc->svt_handle, svt_enc, \&svt_enc->enc_params);/svt_av1_enc_init_handle(\&svt_enc->svt_handle, \&svt_enc->enc_params);/g' libavcodec/libsvtav1.c >libavcodec/libsvtav1.c.patched
1103-
execute rm libavcodec/libsvtav1.c
1104-
execute mv libavcodec/libsvtav1.c.patched libavcodec/libsvtav1.c
1105-
11061135
execute ./configure "${CONFIGURE_OPTIONS[@]}" \
11071136
--disable-debug \
11081137
--disable-shared \

0 commit comments

Comments
 (0)