mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 21:40:15 +00:00
CI Linux FFmpeg: consolidate to a single script
in similar fashion as already done for install_sdl.sh As a bonus, we do not need to depend on whole prepare.sh for cache rebuild but only on this script, which is perhaps cleaner and may yield less rebuilds. Also prepare.sh is slightly easier.
This commit is contained in:
75
.github/scripts/Linux/download_build_ffmpeg.sh
vendored
75
.github/scripts/Linux/download_build_ffmpeg.sh
vendored
@@ -1,75 +0,0 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
install_aom() {(
|
||||
git clone --depth 1 https://aomedia.googlesource.com/aom
|
||||
mkdir -p aom/build
|
||||
cd aom/build
|
||||
cmake -DBUILD_SHARED_LIBS=1 ..
|
||||
cmake --build . --parallel "$(nproc)"
|
||||
sudo cmake --install .
|
||||
)}
|
||||
|
||||
install_libvpx() {
|
||||
(
|
||||
git clone --depth 1 https://github.com/webmproject/libvpx.git
|
||||
cd libvpx
|
||||
./configure --enable-pic --disable-examples --disable-install-bins --disable-install-srcs --enable-vp9-highbitdepth
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
)
|
||||
}
|
||||
|
||||
FFMPEG_GIT_DEPTH=5000 # greater depth is useful for 3-way merges
|
||||
install_svt() {
|
||||
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-HEVC && cd SVT-HEVC/Build/linux && ./build.sh release && cd Release && sudo cmake --install . || exit 1 )
|
||||
( git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git && cd SVT-AV1 && cd Build && cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && cmake --build . --parallel && sudo cmake --install . || exit 1 )
|
||||
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-VP9.git && cd SVT-VP9/Build && cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . --parallel && sudo cmake --install . || exit 1 )
|
||||
# libsvtav1 in FFmpeg upstream, for SVT-HEVC now our custom patch in ffmpeg-patches
|
||||
# if patch apply fails, try increasing $FFMPEG_GIT_DEPTH
|
||||
git am -3 SVT-VP9/ffmpeg_plugin/master-*.patch
|
||||
# TOD TOREMOVE when not needed
|
||||
sed 's/\* avctx->ticks_per_frame//' libavcodec/libsvt_vp9.c >fix
|
||||
mv fix libavcodec/libsvt_vp9.c
|
||||
}
|
||||
|
||||
# The NV Video Codec SDK headers version 12.0 implies driver v520.56.06 in Linux
|
||||
install_nv_codec_headers() {
|
||||
git clone --depth 1 -b sdk/12.0 https://github.com/FFmpeg/nv-codec-headers
|
||||
( cd nv-codec-headers && make && sudo make install || exit 1 )
|
||||
}
|
||||
|
||||
install_onevpl() {(
|
||||
git clone --depth 1 https://github.com/oneapi-src/oneVPL
|
||||
mkdir oneVPL/build
|
||||
cd oneVPL/build
|
||||
cmake -DBUILD_TOOLS=OFF ..
|
||||
cmake --build . --config Release --parallel
|
||||
sudo cmake --build . --config Release --target install
|
||||
)}
|
||||
|
||||
rm -rf /var/tmp/ffmpeg
|
||||
git clone --depth $FFMPEG_GIT_DEPTH https://github.com/FFmpeg/FFmpeg.git \
|
||||
/var/tmp/ffmpeg
|
||||
cd /var/tmp/ffmpeg
|
||||
install_aom
|
||||
install_libvpx
|
||||
install_nv_codec_headers
|
||||
install_onevpl
|
||||
install_svt
|
||||
# apply patches
|
||||
find "$GITHUB_WORKSPACE/.github/scripts/Linux/ffmpeg-patches" -name '*.patch' -print0 | sort -z | xargs -0 -n 1 git am -3
|
||||
./configure --disable-static --enable-shared --enable-gpl --enable-libx264 --enable-libx265 --enable-libopus --enable-nonfree --enable-nvenc --enable-libaom --enable-libvpx --enable-libspeex --enable-libmp3lame \
|
||||
--enable-libdav1d \
|
||||
--enable-libde265 \
|
||||
--enable-libopenh264 \
|
||||
--enable-librav1e \
|
||||
--enable-libsvtav1 \
|
||||
--enable-libsvthevc \
|
||||
--enable-libsvtvp9 \
|
||||
--enable-libvpl \
|
||||
--disable-sdl2 \
|
||||
--enable-vulkan \
|
||||
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
134
.github/scripts/Linux/install_ffmpeg.sh
vendored
134
.github/scripts/Linux/install_ffmpeg.sh
vendored
@@ -1,13 +1,127 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
cd /var/tmp/ffmpeg
|
||||
( cd libvpx && sudo make install )
|
||||
( cd nv-codec-headers && sudo make install )
|
||||
( cd aom/build && sudo cmake --install . )
|
||||
sudo cmake --install SVT-AV1/Build
|
||||
sudo cmake --install SVT-HEVC/Build/linux/Release
|
||||
sudo cmake --install SVT-VP9/Build
|
||||
sudo cmake --build oneVPL/build --config Release --target install
|
||||
dir=$(dirname "$0")
|
||||
# shellcheck source=/dev/null
|
||||
. "$dir/common.sh" # for get_build_deps_excl
|
||||
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
# build dir that will be restored from cache
|
||||
cache_dir=/var/tmp/ffmpeg
|
||||
|
||||
# install the deps - runs always (regardless the cache)
|
||||
deps() {
|
||||
ffmpeg_build_dep=$(get_build_deps_excl ffmpeg 'libsdl')
|
||||
# shellcheck disable=SC2086 # intentional
|
||||
sudo apt install $ffmpeg_build_dep libdav1d-dev libde265-dev \
|
||||
libopenh264-dev
|
||||
sudo apt-get -y remove 'libavcodec*' 'libavutil*' 'libswscale*' \
|
||||
libvpx-dev nginx
|
||||
}
|
||||
|
||||
install_aom() {(
|
||||
git clone --depth 1 https://aomedia.googlesource.com/aom
|
||||
mkdir -p aom/build
|
||||
cd aom/build
|
||||
cmake -DBUILD_SHARED_LIBS=1 ..
|
||||
cmake --build . --parallel "$(nproc)"
|
||||
sudo cmake --install .
|
||||
)}
|
||||
|
||||
install_libvpx() {(
|
||||
git clone --depth 1 https://github.com/webmproject/libvpx.git
|
||||
cd libvpx
|
||||
./configure --enable-pic --disable-examples --disable-install-bins \
|
||||
--disable-install-srcs --enable-vp9-highbitdepth
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
)}
|
||||
|
||||
install_svt() {
|
||||
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-HEVC &&
|
||||
cd SVT-HEVC/Build/linux && ./build.sh release && cd Release &&
|
||||
sudo cmake --install . || exit 1 )
|
||||
( git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git &&
|
||||
cd SVT-AV1 && cd Build &&
|
||||
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release &&
|
||||
cmake --build . --parallel && sudo cmake --install . || exit 1 )
|
||||
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-VP9.git &&
|
||||
cd SVT-VP9/Build && cmake .. -DCMAKE_BUILD_TYPE=Release &&
|
||||
cmake --build . --parallel && sudo cmake --install . || exit 1 )
|
||||
# libsvtav1 in FFmpeg upstream, for SVT-HEVC now our custom patch in ffmpeg-patches
|
||||
# if patch apply fails, try increasing $FFMPEG_GIT_DEPTH
|
||||
git am -3 SVT-VP9/ffmpeg_plugin/master-*.patch
|
||||
# TOD TOREMOVE when not needed
|
||||
sed 's/\* avctx->ticks_per_frame//' libavcodec/libsvt_vp9.c >fix
|
||||
mv fix libavcodec/libsvt_vp9.c
|
||||
}
|
||||
|
||||
# The NV Video Codec SDK headers version 12.0 implies driver v520.56.06 in Linux
|
||||
install_nv_codec_headers() {
|
||||
git clone --depth 1 -b sdk/12.0 https://github.com/FFmpeg/nv-codec-headers
|
||||
( cd nv-codec-headers && make && sudo make install || exit 1 )
|
||||
}
|
||||
|
||||
install_onevpl() {(
|
||||
git clone --depth 1 https://github.com/oneapi-src/oneVPL
|
||||
mkdir oneVPL/build
|
||||
cd oneVPL/build
|
||||
cmake -DBUILD_TOOLS=OFF ..
|
||||
cmake --build . --config Release --parallel
|
||||
sudo cmake --build . --config Release --target install
|
||||
)}
|
||||
|
||||
# build FFmpeg deps + FFmpeg itself
|
||||
build_install() {
|
||||
rm -rf $cache_dir
|
||||
FFMPEG_GIT_DEPTH=5000 # greater depth is useful for 3-way merges
|
||||
git clone --depth $FFMPEG_GIT_DEPTH https://github.com/FFmpeg/FFmpeg.git \
|
||||
$cache_dir
|
||||
cd $cache_dir
|
||||
install_aom
|
||||
install_libvpx
|
||||
install_nv_codec_headers
|
||||
install_onevpl
|
||||
install_svt
|
||||
# apply patches
|
||||
find "$GITHUB_WORKSPACE/.github/scripts/Linux/ffmpeg-patches" \
|
||||
-name '*.patch' -print0 | sort -z | xargs -0 -n 1 git am -3
|
||||
./configure --disable-static --enable-shared --enable-gpl --enable-nonfree \
|
||||
--disable-sdl2 \
|
||||
--enable-libaom \
|
||||
--enable-libdav1d \
|
||||
--enable-libde265 \
|
||||
--enable-libmp3lame \
|
||||
--enable-libopenh264 \
|
||||
--enable-libopus \
|
||||
--enable-librav1e \
|
||||
--enable-libspeex \
|
||||
--enable-libsvtav1 \
|
||||
--enable-libsvthevc \
|
||||
--enable-libsvtvp9 \
|
||||
--enable-libvpl \
|
||||
--enable-libvpx \
|
||||
--enable-libx264 \
|
||||
--enable-libx265 \
|
||||
--enable-nvenc \
|
||||
--enable-vulkan \
|
||||
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
}
|
||||
|
||||
# if cache is successfully restored, just install the builds
|
||||
install_cached() {
|
||||
cd $cache_dir
|
||||
( cd libvpx && sudo make install )
|
||||
( cd nv-codec-headers && sudo make install )
|
||||
( cd aom/build && sudo cmake --install . )
|
||||
sudo cmake --install SVT-AV1/Build
|
||||
sudo cmake --install SVT-HEVC/Build/linux/Release
|
||||
sudo cmake --install SVT-VP9/Build
|
||||
sudo cmake --build oneVPL/build --config Release --target install
|
||||
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
}
|
||||
|
||||
"${1?action required!}"
|
||||
|
||||
8
.github/scripts/Linux/prepare.sh
vendored
8
.github/scripts/Linux/prepare.sh
vendored
@@ -1,8 +1,6 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
dir=$(dirname "$0")
|
||||
# shellcheck source=/dev/null
|
||||
. "$dir/common.sh" # for get_build_deps_excl
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/qt/lib/pkgconfig:/usr/local/lib/pkgconfig
|
||||
export LIBRARY_PATH=/usr/local/lib:/usr/local/qt/lib
|
||||
@@ -38,11 +36,7 @@ sudo apt install libcurl4-openssl-dev # for RTSP client (vidcap)
|
||||
sudo apt install i965-va-driver-shaders libva-dev # instead of i965-va-driver
|
||||
|
||||
"$dir/install_sdl.sh" deps
|
||||
|
||||
ffmpeg_build_dep=$(get_build_deps_excl ffmpeg 'libsdl')
|
||||
# shellcheck disable=SC2086 # intentional
|
||||
sudo apt install $ffmpeg_build_dep libdav1d-dev libde265-dev libopenh264-dev
|
||||
sudo apt-get -y remove 'libavcodec*' 'libavutil*' 'libswscale*' libvpx-dev nginx
|
||||
"$dir/install_ffmpeg.sh" deps
|
||||
|
||||
sudo apt install qt6-base-dev qt6-wayland
|
||||
. /etc/os-release # source ID and VERSION_ID
|
||||
|
||||
Reference in New Issue
Block a user