mirror of
https://github.com/levogevo/ffmpeg-av1-builder.git
synced 2026-01-15 16:56:18 +00:00
update script
This commit is contained in:
18
.gitignore
vendored
18
.gitignore
vendored
@@ -1,18 +1,4 @@
|
|||||||
ffmpeg*
|
|
||||||
rav1e
|
|
||||||
svt*
|
|
||||||
dovi
|
|
||||||
aom
|
|
||||||
vmaf
|
|
||||||
dav1d
|
|
||||||
opus
|
|
||||||
benchmark
|
benchmark
|
||||||
graphs
|
repos
|
||||||
rkmpp
|
out
|
||||||
rkrga
|
|
||||||
x264
|
|
||||||
x265*
|
|
||||||
googletest
|
|
||||||
vpx
|
|
||||||
hdr10plus
|
|
||||||
.last_opts
|
.last_opts
|
||||||
|
|||||||
330
scripts/build.sh
330
scripts/build.sh
@@ -1,14 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "./scripts/build.sh [-h] [-A] [-s] [-o] [-r] [-O n]"
|
echo "./scripts/build.sh [options]"
|
||||||
echo -e "\th: display this help output"
|
echo -e "\th:\tdisplay this help output"
|
||||||
echo -e "\tA: build all AV1 encoders (default is only svt-av1-psy)"
|
echo -e "\tA:\tbuild all AV1 encoders (default is only svt-av1-psy)"
|
||||||
echo -e "\ts: build svt-av1 (default is svt-av1-psy)"
|
echo -e "\ts:\tbuild svt-av1 (default is svt-av1-psy)"
|
||||||
echo -e "\to: build other encoders (x264/5 and vpx)"
|
echo -e "\to:\tbuild other encoders (x264/5 and vpx)"
|
||||||
echo -e "\tr: build rockchip media libraries"
|
echo -e "\tr:\tbuild rockchip media libraries"
|
||||||
echo -e "\tv: build libvmaf"
|
echo -e "\tv:\tbuild libvmaf"
|
||||||
echo -e "\tO n: build at optimization n (1, 2, 3)"
|
echo -e "\tl:\tcompile without lto (default is enabled)"
|
||||||
|
echo -e "\tO n:\tbuild optimization level (default is 3)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# global path variables
|
# global path variables
|
||||||
@@ -17,10 +18,24 @@ SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
|||||||
BUILDER_DIR="$(dirname "$SCRIPT_DIR")"
|
BUILDER_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
cd "$BUILDER_DIR" || exit
|
cd "$BUILDER_DIR" || exit
|
||||||
|
|
||||||
# build with psy as default
|
# build with psy and lto as default
|
||||||
export BUILD_PSY="true"
|
BUILD_PSY='Y'
|
||||||
|
BUILD_LTO='Y'
|
||||||
|
|
||||||
|
# options for ffmpeg configure
|
||||||
|
FFMPEG_CONFIGURE_OPT=""
|
||||||
|
|
||||||
|
# compilation job count
|
||||||
|
THREADS="$(nproc)"
|
||||||
|
|
||||||
|
# for MacOs / Darwin
|
||||||
|
if [ "$(uname)" == "Darwin" ] ; then
|
||||||
|
FFMPEG_CONFIGURE_OPT+="--enable-rpath "
|
||||||
|
THREADS="$(sysctl -n hw.ncpu)"
|
||||||
|
fi
|
||||||
|
|
||||||
GREP_FILTER="av1"
|
GREP_FILTER="av1"
|
||||||
OPTS='hAsvorO:'
|
OPTS='hAsvorlO:'
|
||||||
NUM_OPTS=$(echo -n $OPTS | wc -m)
|
NUM_OPTS=$(echo -n $OPTS | wc -m)
|
||||||
MIN_OPT=0
|
MIN_OPT=0
|
||||||
# using all
|
# using all
|
||||||
@@ -34,32 +49,40 @@ while getopts "$OPTS" flag; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
p)
|
p)
|
||||||
export BUILD_PSY="true"
|
BUILD_PSY='Y'
|
||||||
echo "building psy"
|
echo "building psy"
|
||||||
;;
|
;;
|
||||||
A)
|
A)
|
||||||
export BUILD_ALL_AV1="true"
|
BUILD_ALL_AV1='Y'
|
||||||
|
FFMPEG_CONFIGURE_OPT+="--enable-libaom --enable-librav1e "
|
||||||
echo "building all other av1 encoders"
|
echo "building all other av1 encoders"
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
export BUILD_SVT="true"
|
BUILD_SVT='Y'
|
||||||
export BUILD_PSY="false"
|
BUILD_PSY=false
|
||||||
echo "building svt-av1"
|
echo "building svt-av1"
|
||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
export BUILD_VMAF="true"
|
BUILD_VMAF='Y'
|
||||||
|
FFMPEG_CONFIGURE_OPT+="--enable-libvmaf "
|
||||||
echo "building libvmaf"
|
echo "building libvmaf"
|
||||||
;;
|
;;
|
||||||
o)
|
o)
|
||||||
export BUILD_OTHERS="true"
|
BUILD_OTHERS='Y'
|
||||||
GREP_FILTER+="|x26|libvpx"
|
GREP_FILTER+="|x26|libvpx"
|
||||||
|
FFMPEG_CONFIGURE_OPT+="--enable-libx264 --enable-libx265 --enable-libvpx "
|
||||||
echo "building other encoders"
|
echo "building other encoders"
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
export BUILD_ROCKCHIP="true"
|
BUILD_ROCKCHIP='Y'
|
||||||
GREP_FILTER+="|rkmpp"
|
GREP_FILTER+="|rkmpp"
|
||||||
|
FMPEG_CONFIGURE_OPT+="--enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga "
|
||||||
echo "building rockchip media platform"
|
echo "building rockchip media platform"
|
||||||
;;
|
;;
|
||||||
|
l)
|
||||||
|
BUILD_LTO='N'
|
||||||
|
echo "building without lto"
|
||||||
|
;;
|
||||||
O)
|
O)
|
||||||
if [[ ${OPTARG} != ?(-)+([[:digit:]]) || ${OPTARG} -lt 0 ]]; then
|
if [[ ${OPTARG} != ?(-)+([[:digit:]]) || ${OPTARG} -lt 0 ]]; then
|
||||||
echo "${OPTARG} is not a positive integer"
|
echo "${OPTARG} is not a positive integer"
|
||||||
@@ -72,7 +95,7 @@ while getopts "$OPTS" flag; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# set optimization level
|
# set optimization level
|
||||||
export OPT_LVL="$OPTARG"
|
OPT_LVL=$OPTARG
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'unsupported flag(s)'
|
echo 'unsupported flag(s)'
|
||||||
@@ -103,23 +126,25 @@ echo "building with O${OPT_LVL}"
|
|||||||
# wait a sec for outputs to show
|
# wait a sec for outputs to show
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
BASE_DIR=$(pwd)
|
BASE_DIR="$(pwd)"
|
||||||
SVT_DIR="$BASE_DIR/svt"
|
REPOS_DIR="$BASE_DIR/repos"
|
||||||
RAV1E_DIR="$BASE_DIR/rav1e"
|
SVT_DIR="$REPOS_DIR/svt"
|
||||||
FFMPEG_DIR="$BASE_DIR/ffmpeg"
|
RAV1E_DIR="$REPOS_DIR/rav1e"
|
||||||
AOM_DIR="$BASE_DIR/aom"
|
FFMPEG_DIR="$REPOS_DIR/ffmpeg"
|
||||||
VMAF_DIR="$BASE_DIR/vmaf"
|
AOM_DIR="$REPOS_DIR/aom"
|
||||||
DAV1D_DIR="$BASE_DIR/dav1d"
|
VMAF_DIR="$REPOS_DIR/vmaf"
|
||||||
OPUS_DIR="$BASE_DIR/opus"
|
DAV1D_DIR="$REPOS_DIR/dav1d"
|
||||||
RKMPP_DIR="$BASE_DIR/rkmpp"
|
OPUS_DIR="$REPOS_DIR/opus"
|
||||||
RKRGA_DIR="$BASE_DIR/rkrga"
|
RKMPP_DIR="$REPOS_DIR/rkmpp"
|
||||||
DOVI_DIR="$BASE_DIR/dovi"
|
RKRGA_DIR="$REPOS_DIR/rkrga"
|
||||||
HDR10_DIR="$BASE_DIR/hdr10plus"
|
DOVI_DIR="$REPOS_DIR/dovi"
|
||||||
SVT_PSY_DIR="$BASE_DIR/svt-psy"
|
HDR10_DIR="$REPOS_DIR/hdr10plus"
|
||||||
X264_DIR="$BASE_DIR/x264"
|
SVT_PSY_DIR="$REPOS_DIR/svt-psy"
|
||||||
X265_DIR="$BASE_DIR/x265"
|
X264_DIR="$REPOS_DIR/x264"
|
||||||
GTEST_DIR="$BASE_DIR/googletest"
|
X265_DIR="$REPOS_DIR/x265"
|
||||||
VPX_DIR="$BASE_DIR/vpx"
|
GTEST_DIR="$REPOS_DIR/googletest"
|
||||||
|
VPX_DIR="$REPOS_DIR/vpx"
|
||||||
|
mkdir "$REPOS_DIR"
|
||||||
|
|
||||||
# save options use
|
# save options use
|
||||||
echo "$@" > "$BASE_DIR/.last_opts"
|
echo "$@" > "$BASE_DIR/.last_opts"
|
||||||
@@ -127,8 +152,24 @@ echo "$@" > "$BASE_DIR/.last_opts"
|
|||||||
# prefix to install
|
# prefix to install
|
||||||
PREFIX='/usr/local'
|
PREFIX='/usr/local'
|
||||||
|
|
||||||
export ARCH=$(uname -m)
|
# lto mess
|
||||||
export COMP_FLAGS="-I${PREFIX}/include"
|
if [[ "$BUILD_LTO" == 'Y' ]]; then
|
||||||
|
LTO_SWITCH='ON'
|
||||||
|
LTO_FLAG='-flto'
|
||||||
|
LTO_BOOL='true'
|
||||||
|
LTO_CONFIGURE='--enable-lto'
|
||||||
|
FFMPEG_CONFIGURE_OPT+="${LTO_CONFIGURE} "
|
||||||
|
elif [[ "$BUILD_LTO" == 'N' ]]; then
|
||||||
|
LTO_SWITCH='OFF'
|
||||||
|
LTO_FLAG=''
|
||||||
|
LTO_BOOL='false'
|
||||||
|
LTO_CONFIGURE=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# architecture/cpu compile flags
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
COMP_FLAGS="-I${PREFIX}/include"
|
||||||
|
COMP_FLAGS=""
|
||||||
if [[ "$ARCH" == "x86_64" ]]
|
if [[ "$ARCH" == "x86_64" ]]
|
||||||
then
|
then
|
||||||
COMP_FLAGS+=" -march=native"
|
COMP_FLAGS+=" -march=native"
|
||||||
@@ -136,41 +177,41 @@ elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]
|
|||||||
then
|
then
|
||||||
COMP_FLAGS+=" -mcpu=native"
|
COMP_FLAGS+=" -mcpu=native"
|
||||||
fi
|
fi
|
||||||
echo "COMP_FLAGS: [$COMP_FLAGS]"
|
echo "COMP_FLAGS: [${COMP_FLAGS}]"
|
||||||
|
|
||||||
# for ccache
|
# for ccache
|
||||||
export PATH="/usr/lib/ccache:$PATH"
|
export PATH="/usr/lib/ccache:$PATH"
|
||||||
|
|
||||||
# options for ffmpeg configure
|
|
||||||
FFMPEG_CONFIGURE_OPT=""
|
|
||||||
|
|
||||||
# clone
|
|
||||||
git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/xiph/rav1e "$RAV1E_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://aomedia.googlesource.com/aom "$AOM_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/Netflix/vmaf "$VMAF_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/dav1d.git "$DAV1D_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/xiph/opus.git "$OPUS_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/FFmpeg/FFmpeg "$FFMPEG_DIR"
|
|
||||||
|
|
||||||
# check for required local directories
|
# check for required local directories
|
||||||
sudo mkdir ${PREFIX}/bin \
|
REQ_DIRS=(
|
||||||
${PREFIX}/lib \
|
"${PREFIX}/bin"
|
||||||
${PREFIX}/include
|
"${PREFIX}/lib"
|
||||||
|
"${PREFIX}/include"
|
||||||
|
"${PREFIX}/share"
|
||||||
|
)
|
||||||
|
|
||||||
|
for DIR in "${REQ_DIRS[@]}"
|
||||||
|
do
|
||||||
|
test -d "$DIR" || \
|
||||||
|
mkdir -p "$DIR" || \
|
||||||
|
sudo mkdir -p "$DIR"
|
||||||
|
done
|
||||||
|
|
||||||
|
# WSL2 hardware clock skew
|
||||||
|
if [[ "$(uname -r)" =~ "WSL" ]] ; then
|
||||||
|
sudo hwclock -s
|
||||||
|
fi
|
||||||
|
|
||||||
# rockchip ffmpeg libs
|
# rockchip ffmpeg libs
|
||||||
# IS_ROCKCHIP=$(uname -r | grep "rockchip" > /dev/null && echo "yes" || echo "no")
|
# IS_ROCKCHIP=$(uname -r | grep "rockchip" > /dev/null && echo "yes" || echo "no")
|
||||||
if [[ "$BUILD_ROCKCHIP" == "true" ]]
|
if [[ "$BUILD_ROCKCHIP" == "Y" ]]
|
||||||
then
|
then
|
||||||
FFMPEG_CONFIGURE_OPT+="--enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga "
|
# override default ffmpeg directory
|
||||||
FFMPEG_DIR="$BASE_DIR/ffmpeg-rkmpp"
|
FFMPEG_DIR+="-rkmpp"
|
||||||
|
|
||||||
# clone rockchip specific repos
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/nyanmisaka/ffmpeg-rockchip.git "$FFMPEG_DIR"
|
git clone --depth "$GIT_DEPTH" https://github.com/nyanmisaka/ffmpeg-rockchip.git "$FFMPEG_DIR"
|
||||||
git clone --depth "$GIT_DEPTH" -b jellyfin-mpp https://github.com/nyanmisaka/mpp.git "$RKMPP_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" -b jellyfin-rga https://github.com/nyanmisaka/rk-mirrors.git "$RKRGA_DIR"
|
|
||||||
|
|
||||||
# build mpp
|
# build mpp
|
||||||
|
git clone --depth "$GIT_DEPTH" -b jellyfin-mpp https://github.com/nyanmisaka/mpp.git "$RKMPP_DIR"
|
||||||
cd "$RKMPP_DIR/" || exit
|
cd "$RKMPP_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf mpp_build.user
|
rm -rf mpp_build.user
|
||||||
@@ -178,111 +219,112 @@ then
|
|||||||
cd mpp_build.user || exit
|
cd mpp_build.user || exit
|
||||||
make clean
|
make clean
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_INSTALL_RPEFIX="$PREFIX" \
|
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DBUILD_TEST=OFF -DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
-DBUILD_TEST=OFF -DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
||||||
-DCMAKE_C_FLAGS="-O${OPT_LVL} $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
|
|
||||||
# build rga
|
# build rga
|
||||||
|
git clone --depth "$GIT_DEPTH" -b jellyfin-rga https://github.com/nyanmisaka/rk-mirrors.git "$RKRGA_DIR"
|
||||||
cd "$RKRGA_DIR" || exit
|
cd "$RKRGA_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf rga_build.user
|
rm -rf rga_build.user
|
||||||
mkdir rga_build.user
|
mkdir rga_build.user
|
||||||
meson setup . rga_build.user --buildtype release -Db_lto=true \
|
meson setup . rga_build.user --buildtype release -Db_lto=true \
|
||||||
--default-library=shared -Dlibdrm=false -Dlibrga_demo=false \
|
--default-library=shared -Dlibdrm=false -Dlibrga_demo=false \
|
||||||
--prefix "$PREFIX" --optimization="$OPT_LVL" \
|
--prefix "${PREFIX}" --optimization="$OPT_LVL" \
|
||||||
-Dc_args="$COMP_FLAGS" -Dcpp_args="-fpermissive $COMP_FLAGS" || exit
|
-Dc_args="${COMP_FLAGS}" -Dcpp_args="-fpermissive ${COMP_FLAGS}" || exit
|
||||||
ninja -vC rga_build.user || exit
|
ccache ninja -vC rga_build.user || exit
|
||||||
sudo ninja -vC rga_build.user install || exit
|
sudo ninja -vC rga_build.user install || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$BUILD_PSY" == "true" ]];
|
if [[ "$BUILD_PSY" == "Y" ]];
|
||||||
then
|
then
|
||||||
# clone svt specific repos
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/dovi_tool "$DOVI_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/hdr10plus_tool "$HDR10_DIR"
|
|
||||||
# clear svt because of unrelated histories error
|
|
||||||
rm -rf "$SVT_PSY_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/gianni-rosato/svt-av1-psy "$SVT_PSY_DIR"
|
|
||||||
|
|
||||||
# build dovi_tool
|
# build dovi_tool
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/dovi_tool "$DOVI_DIR"
|
||||||
cd "$DOVI_DIR/" || exit
|
cd "$DOVI_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
||||||
source "$HOME/.cargo/env" # for good measure
|
source "$HOME/.cargo/env" # for good measure
|
||||||
cargo clean
|
cargo clean
|
||||||
RUSTFLAGS="-C target-cpu=native" ccache cargo build --release
|
RUSTFLAGS="-C target-cpu=native" ccache cargo build --release
|
||||||
sudo cp target/release/dovi_tool ${PREFIX}/bin/ || exit
|
sudo cp target/release/dovi_tool "${PREFIX}/bin/" || exit
|
||||||
|
|
||||||
# build libdovi
|
# build libdovi
|
||||||
cd dolby_vision || exit
|
cd dolby_vision || exit
|
||||||
RUSTFLAGS="-C target-cpu=native" ccache cargo cbuild --release
|
RUSTFLAGS="-C target-cpu=native" ccache cargo cbuild --release
|
||||||
sudo cargo cinstall --release
|
sudo cargo cinstall --prefix="${PREFIX}" --release
|
||||||
|
|
||||||
# build hdr10plus_tool
|
# build hdr10plus_tool
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/hdr10plus_tool "$HDR10_DIR"
|
||||||
cd "$HDR10_DIR/" || exit
|
cd "$HDR10_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
||||||
source "$HOME/.cargo/env" # for good measure
|
source "$HOME/.cargo/env" # for good measure
|
||||||
cargo clean
|
cargo clean
|
||||||
RUSTFLAGS="-C target-cpu=native" ccache cargo build --release
|
RUSTFLAGS="-C target-cpu=native" ccache cargo build --release
|
||||||
sudo cp target/release/hdr10plus_tool ${PREFIX}/bin/ || exit
|
sudo cp target/release/hdr10plus_tool "${PREFIX}/bin/" || exit
|
||||||
|
|
||||||
# build libhdr10plus
|
# build libhdr10plus
|
||||||
cd hdr10plus || exit
|
cd hdr10plus || exit
|
||||||
RUSTFLAGS="-C target-cpu=native" ccache cargo cbuild --release
|
RUSTFLAGS="-C target-cpu=native" ccache cargo cbuild --release
|
||||||
sudo cargo cinstall --release
|
sudo cargo cinstall --prefix="${PREFIX}" --release
|
||||||
|
|
||||||
# build svt-avt-psy
|
# build svt-avt-psy
|
||||||
|
# clear svt because of unrelated histories error
|
||||||
|
rm -rf "$SVT_PSY_DIR"
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/gianni-rosato/svt-av1-psy "$SVT_PSY_DIR"
|
||||||
cd "$SVT_PSY_DIR/" || exit
|
cd "$SVT_PSY_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
sudo rm -rf build_svt.user
|
sudo rm -rf build_svt.user
|
||||||
mkdir build_svt.user
|
mkdir build_svt.user
|
||||||
cd build_svt.user || exit
|
cd build_svt.user || exit
|
||||||
make clean
|
make clean
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO="${LTO_SWITCH}" \
|
||||||
-DCMAKE_INSTALL_RPEFIX="$PREFIX" \
|
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
|
||||||
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
||||||
-DCOVERAGE=OFF -DLIBDOVI_FOUND=1 \
|
-DCOVERAGE=OFF -DLIBDOVI_FOUND=1 \
|
||||||
-DLIBHDR10PLUS_RS_FOUND=1 \
|
-DLIBHDR10PLUS_RS_FOUND=1 \
|
||||||
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
||||||
-DCMAKE_C_FLAGS="-O${OPT_LVL} $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
ccache make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install
|
sudo make install
|
||||||
else
|
else
|
||||||
# build svt-av1
|
# build svt-av1
|
||||||
|
git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR"
|
||||||
cd "$SVT_DIR/" || exit
|
cd "$SVT_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf build_svt.user
|
rm -rf build_svt.user
|
||||||
mkdir build_svt.user
|
mkdir build_svt.user
|
||||||
cd build_svt.user || exit
|
cd build_svt.user || exit
|
||||||
make clean
|
make clean
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO="${LTO_SWITCH}" \
|
||||||
-DCMAKE_INSTALL_RPEFIX="$PREFIX" \
|
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
|
||||||
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
||||||
-DCOVERAGE=OFF -DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
-DCOVERAGE=OFF -DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
|
||||||
-DCMAKE_C_FLAGS="-O${OPT_LVL} $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$BUILD_ALL_AV1" == "true" ]]; then
|
if [[ "$BUILD_ALL_AV1" == "Y" ]]; then
|
||||||
FFMPEG_CONFIGURE_OPT+="--enable-libaom --enable-librav1e "
|
|
||||||
|
|
||||||
# build rav1e
|
# build rav1e
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/xiph/rav1e "$RAV1E_DIR"
|
||||||
cd "$RAV1E_DIR/" || exit
|
cd "$RAV1E_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit
|
||||||
source "$HOME/.cargo/env" # for good measure
|
source "$HOME/.cargo/env" # for good measure
|
||||||
cargo clean
|
cargo clean
|
||||||
RUSTFLAGS="-C target-cpu=native" sudo ccache cargo cinstall --release
|
RUSTFLAGS="-C target-cpu=native" ccache cargo cbuild --release
|
||||||
|
sudo cargo cinstall --prefix="${PREFIX}" --release
|
||||||
|
|
||||||
# build aom
|
# build aom
|
||||||
|
git clone --depth "$GIT_DEPTH" https://aomedia.googlesource.com/aom "$AOM_DIR"
|
||||||
cd "$AOM_DIR/" || exit
|
cd "$AOM_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf build_aom.user
|
rm -rf build_aom.user
|
||||||
@@ -290,72 +332,69 @@ if [[ "$BUILD_ALL_AV1" == "true" ]]; then
|
|||||||
cd build_aom.user || exit
|
cd build_aom.user || exit
|
||||||
make clean
|
make clean
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
|
||||||
-DENABLE_TESTS=OFF -DCMAKE_INSTALL_RPEFIX="$PREFIX" \
|
-DENABLE_TESTS=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
|
||||||
-DCMAKE_C_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="${LTO_FLAG} -O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
-DCMAKE_CXX_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="${LTO_FLAG} -O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$BUILD_VMAF" == "true" ]]; then
|
if [[ "$BUILD_VMAF" == "Y" ]]; then
|
||||||
FFMPEG_CONFIGURE_OPT+="--enable-libvmaf "
|
|
||||||
|
|
||||||
# build libvmaf
|
# build libvmaf
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/Netflix/vmaf "$VMAF_DIR"
|
||||||
cd "$VMAF_DIR/libvmaf" || exit
|
cd "$VMAF_DIR/libvmaf" || exit
|
||||||
update_git
|
update_git
|
||||||
python3 -m virtualenv .venv
|
python3 -m virtualenv .venv
|
||||||
source .venv/bin/activate
|
(
|
||||||
rm -rf build.user
|
source .venv/bin/activate
|
||||||
mkdir build.user
|
rm -rf build.user
|
||||||
pip install meson
|
mkdir build.user
|
||||||
meson setup . build.user --buildtype release -Denable_float=true \
|
pip install meson
|
||||||
-Db_lto=true --optimization="$OPT_LVL" -Dc_args="$COMP_FLAGS" \
|
meson setup . build.user --buildtype release -Denable_float=true \
|
||||||
--prefix "$PREFIX" -Dcpp_args="$COMP_FLAGS" || exit
|
-Db_lto="${LTO_BOOL}" --optimization="$OPT_LVL" -Dc_args="${COMP_FLAGS}" \
|
||||||
ninja -vC build.user || exit
|
--prefix "${PREFIX}" -Dcpp_args="${COMP_FLAGS}" || exit
|
||||||
sudo ninja -vC build.user install || exit
|
ccache ninja -vC build.user || exit
|
||||||
|
sudo ninja -vC build.user install || exit
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build dav1d
|
# build dav1d
|
||||||
|
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/dav1d.git "$DAV1D_DIR"
|
||||||
cd "$DAV1D_DIR" || exit
|
cd "$DAV1D_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf build.user
|
rm -rf build.user
|
||||||
mkdir build.user
|
mkdir build.user
|
||||||
meson setup . build.user --buildtype release -Db_lto=true --prefix "$PREFIX" \
|
meson setup . build.user --buildtype release -Db_lto="${LTO_BOOL}" --prefix "${PREFIX}" \
|
||||||
--optimization="$OPT_LVL" -Dc_args="$COMP_FLAGS" -Dcpp_args="$COMP_FLAGS" || exit
|
--optimization="$OPT_LVL" -Dc_args="${COMP_FLAGS}" -Dcpp_args="${COMP_FLAGS}" || exit
|
||||||
ccache ninja -vC build.user || exit
|
ccache ninja -vC build.user || exit
|
||||||
sudo ninja -vC build.user install || exit
|
sudo ninja -vC build.user install || exit
|
||||||
|
|
||||||
# build opus
|
# build opus
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/xiph/opus.git "$OPUS_DIR"
|
||||||
cd "$OPUS_DIR" || exit
|
cd "$OPUS_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
./autogen.sh || exit
|
./autogen.sh || exit
|
||||||
export CFLAGS="-O${OPT_LVL} -flto $COMP_FLAGS"
|
CFLAGS="-O${OPT_LVL} ${LTO_FLAG} ${COMP_FLAGS}"
|
||||||
make clean
|
make clean
|
||||||
ccache ./configure --prefix="$PREFIX" || exit
|
./configure --prefix="${PREFIX}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
unset CFLAGS
|
unset CFLAGS
|
||||||
|
|
||||||
if [[ "$BUILD_OTHERS" == "true" ]]; then
|
if [[ "$BUILD_OTHERS" == "Y" ]]; then
|
||||||
# clone other encoder specific repos
|
|
||||||
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/x264.git "$X264_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://bitbucket.org/multicoreware/x265_git.git "$X265_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/google/googletest "$GTEST_DIR"
|
|
||||||
git clone --depth "$GIT_DEPTH" https://chromium.googlesource.com/webm/libvpx.git "$VPX_DIR"
|
|
||||||
|
|
||||||
FFMPEG_CONFIGURE_OPT+="--enable-libx264 --enable-libx265 --enable-libvpx "
|
|
||||||
|
|
||||||
# build x264
|
# build x264
|
||||||
|
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/x264.git "$X264_DIR"
|
||||||
cd "$X264_DIR" || exit
|
cd "$X264_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
make clean
|
make clean
|
||||||
./configure --enable-static --enable-pic \
|
./configure --enable-static --enable-pic \
|
||||||
--enable-shared --enable-lto --prefix="$PREFIX" \
|
--enable-shared "${LTO_CONFIGURE}" --prefix="${PREFIX}" \
|
||||||
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" || exit
|
--extra-cflags="-O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
|
|
||||||
# build x265
|
# build x265
|
||||||
|
git clone --depth "$GIT_DEPTH" https://bitbucket.org/multicoreware/x265_git.git "$X265_DIR"
|
||||||
cd "$X265_DIR" || exit
|
cd "$X265_DIR" || exit
|
||||||
test -d ".no_git" && mv .no_git .git
|
test -d ".no_git" && mv .no_git .git
|
||||||
test -d ".git" && git stash && git stash drop
|
test -d ".git" && git stash && git stash drop
|
||||||
@@ -369,36 +408,38 @@ if [[ "$BUILD_OTHERS" == "true" ]]; then
|
|||||||
cd build.user || exit
|
cd build.user || exit
|
||||||
cmake ../source -DCMAKE_BUILD_TYPE=Release -DNATIVE_BUILD=ON \
|
cmake ../source -DCMAKE_BUILD_TYPE=Release -DNATIVE_BUILD=ON \
|
||||||
-G "Unix Makefiles" -DHIGH_BIT_DEPTH=ON \
|
-G "Unix Makefiles" -DHIGH_BIT_DEPTH=ON \
|
||||||
-DENABLE_HDR10_PLUS=ON -DCMAKE_INSTALL_RPEFIX="$PREFIX" \
|
-DENABLE_HDR10_PLUS=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
|
||||||
-DEXPORT_C_API=ON -DENABLE_SHARED=ON \
|
-DEXPORT_C_API=ON -DENABLE_SHARED=ON \
|
||||||
-DCMAKE_C_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="${LTO_CONFIGURE} -O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
-DCMAKE_CXX_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="${LTO_CONFIGURE} -O${OPT_LVL} ${COMP_FLAGS}" || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
cd "$X265_DIR" || exit
|
cd "$X265_DIR" || exit
|
||||||
# revert git
|
# revert git
|
||||||
mv .no_git .git
|
mv .no_git .git
|
||||||
|
|
||||||
# build gtest
|
# build gtest
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/google/googletest "$GTEST_DIR"
|
||||||
cd "$GTEST_DIR" || exit
|
cd "$GTEST_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
rm -rf build
|
rm -rf build
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build || exit
|
cd build || exit
|
||||||
cmake -DCMAKE_INSTALL_RPEFIX="$PREFIX" ../
|
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../
|
||||||
make -j"$(nproc)"
|
ccache make -j"${THREADS}"
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
# build vpx
|
# build vpx
|
||||||
|
git clone --depth "$GIT_DEPTH" https://chromium.googlesource.com/webm/libvpx.git "$VPX_DIR"
|
||||||
cd "$VPX_DIR" || exit
|
cd "$VPX_DIR" || exit
|
||||||
update_git
|
update_git
|
||||||
if [[ "$ARCH" == "x86_64" ]]; then
|
if [[ "$ARCH" == "x86_64" ]]; then
|
||||||
VP_COMP_FLAGS="$COMP_FLAGS";
|
VP_COMP_FLAGS="${COMP_FLAGS}";
|
||||||
else
|
else
|
||||||
VP_COMP_FLAGS=""
|
VP_COMP_FLAGS=""
|
||||||
fi
|
fi
|
||||||
make clean
|
make clean
|
||||||
./configure --enable-pic --prefix="$PREFIX" \
|
./configure --prefix="${PREFIX}" \
|
||||||
--extra-cflags="-O${OPT_LVL} $VP_COMP_FLAGS" \
|
--extra-cflags="-O${OPT_LVL} $VP_COMP_FLAGS" \
|
||||||
--extra-cxxflags="-O${OPT_LVL} $VP_COMP_FLAGS" \
|
--extra-cxxflags="-O${OPT_LVL} $VP_COMP_FLAGS" \
|
||||||
--disable-examples --disable-docs \
|
--disable-examples --disable-docs \
|
||||||
@@ -406,36 +447,33 @@ if [[ "$BUILD_OTHERS" == "true" ]]; then
|
|||||||
--enable-shared --enable-ccache \
|
--enable-shared --enable-ccache \
|
||||||
--enable-vp8 --enable-vp9 \
|
--enable-vp8 --enable-vp9 \
|
||||||
--enable-vp9-highbitdepth
|
--enable-vp9-highbitdepth
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || { env ; exit ; }
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v ldconfig ; then
|
if command -v ldconfig ; then
|
||||||
# ldconfig for shared libs
|
# ldconfig for shared libs
|
||||||
sudo mkdir /etc/ld.so.conf.d/
|
test -d /etc/ld.so.conf.d/ || sudo mkdir /etc/ld.so.conf.d/
|
||||||
echo -e "${PREFIX}/lib\n${PREFIX}/lib/$(gcc -dumpmachine)" | sudo tee /etc/ld.so.conf.d/ffmpeg.conf || exit 1
|
echo -e "${PREFIX}/lib\n${PREFIX}/lib/$(gcc -dumpmachine)" | sudo tee /etc/ld.so.conf.d/ffmpeg.conf || exit 1
|
||||||
sudo ldconfig
|
sudo ldconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# for MacOs / Darwin
|
|
||||||
test "$(uname)" == "Darwin" && \
|
|
||||||
FFMPEG_CONFIGURE_OPT+="--enable-rpath "
|
|
||||||
|
|
||||||
# build ffmpeg
|
# build ffmpeg
|
||||||
|
git clone --depth "$GIT_DEPTH" https://github.com/FFmpeg/FFmpeg "$FFMPEG_DIR"
|
||||||
cd "$FFMPEG_DIR/" || exit
|
cd "$FFMPEG_DIR/" || exit
|
||||||
update_git
|
update_git
|
||||||
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
make clean
|
make clean
|
||||||
ccache ./configure --enable-libsvtav1 --prefix="$PREFIX" \
|
./configure --enable-libsvtav1 --prefix="${PREFIX}" \
|
||||||
--enable-libdav1d --enable-libopus \
|
--enable-libdav1d --enable-libopus \
|
||||||
$FFMPEG_CONFIGURE_OPT \
|
$FFMPEG_CONFIGURE_OPT \
|
||||||
--arch="$ARCH" --cpu=native \
|
--arch="$ARCH" --cpu=native \
|
||||||
--enable-lto --enable-gpl \
|
--enable-gpl \
|
||||||
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" \
|
--extra-cflags="-O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
--extra-cxxflags="-O${OPT_LVL} $COMP_FLAGS" \
|
--extra-cxxflags="-O${OPT_LVL} ${COMP_FLAGS}" \
|
||||||
--disable-doc --disable-htmlpages \
|
--disable-doc --disable-htmlpages \
|
||||||
--disable-podpages --disable-txtpages || exit
|
--disable-podpages --disable-txtpages || exit
|
||||||
make -j"$(nproc)" || exit
|
ccache make -j"${THREADS}" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
sudo cp ff*_g ${PREFIX}/bin/
|
sudo cp ff*_g ${PREFIX}/bin/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user