mirror of
https://github.com/levogevo/ffmpeg-av1-builder.git
synced 2026-01-15 16:56:18 +00:00
init most fixes
This commit is contained in:
100
scripts/build.sh
100
scripts/build.sh
@@ -226,8 +226,9 @@ git clone --depth "$GIT_DEPTH" https://github.com/FFmpeg/FFmpeg "$FFMPEG_DIR"
|
|||||||
|
|
||||||
build_mpp() {
|
build_mpp() {
|
||||||
# build mpp
|
# build mpp
|
||||||
git clone --depth "$GIT_DEPTH" -b jellyfin-mpp https://github.com/nyanmisaka/mpp.git "$RKMPP_DIR" || \
|
git clone --depth "$GIT_DEPTH" -b jellyfin-mpp https://github.com/nyanmisaka/mpp.git "$RKMPP_DIR"
|
||||||
{ cd "$RKMPP_DIR/" && check_for_rebuild && return 0 ; }
|
cd "$RKMPP_DIR/" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
rm -rf mpp_build.user
|
rm -rf mpp_build.user
|
||||||
mkdir mpp_build.user
|
mkdir mpp_build.user
|
||||||
cd mpp_build.user || return 1
|
cd mpp_build.user || return 1
|
||||||
@@ -245,8 +246,9 @@ build_mpp() {
|
|||||||
|
|
||||||
build_rkga() {
|
build_rkga() {
|
||||||
# build rga
|
# build rga
|
||||||
git clone --depth "$GIT_DEPTH" -b jellyfin-rga https://github.com/nyanmisaka/rk-mirrors.git "$RKRGA_DIR" || \
|
git clone --depth "$GIT_DEPTH" -b jellyfin-rga https://github.com/nyanmisaka/rk-mirrors.git "$RKRGA_DIR"
|
||||||
{ cd "$RKRGA_DIR" && check_for_rebuild && return 0 ; }
|
cd "$RKRGA_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
rm -rf rga_build.user
|
rm -rf rga_build.user
|
||||||
mkdir rga_build.user
|
mkdir rga_build.user
|
||||||
meson setup . rga_build.user \
|
meson setup . rga_build.user \
|
||||||
@@ -278,9 +280,9 @@ fi
|
|||||||
|
|
||||||
build_dovi() {
|
build_dovi() {
|
||||||
# build dovi_tool
|
# build dovi_tool
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/dovi_tool "$DOVI_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/dovi_tool "$DOVI_DIR"
|
||||||
{ cd "$DOVI_DIR/" && check_for_rebuild && return 0 ; }
|
cd "$DOVI_DIR" || return 1
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || return 1
|
check_for_rebuild && return 0
|
||||||
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
|
||||||
@@ -295,9 +297,9 @@ build_dovi() {
|
|||||||
|
|
||||||
build_hdr10plus() {
|
build_hdr10plus() {
|
||||||
# build hdr10plus_tool
|
# build hdr10plus_tool
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/hdr10plus_tool "$HDR10_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://github.com/quietvoid/hdr10plus_tool "$HDR10_DIR"
|
||||||
{ cd "$HDR10_DIR/" && check_for_rebuild && return 0 ; }
|
cd "$HDR10_DIR" || return 1
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || return 1
|
check_for_rebuild && return 0
|
||||||
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
|
||||||
@@ -316,23 +318,21 @@ build_svt_av1_psy() {
|
|||||||
# due to histories error
|
# due to histories error
|
||||||
local GIT_REPO_URL='https://github.com/gianni-rosato/svt-av1-psy'
|
local GIT_REPO_URL='https://github.com/gianni-rosato/svt-av1-psy'
|
||||||
local CMAKE_BUILD_DIR="$SVT_PSY_DIR/build_svt.user"
|
local CMAKE_BUILD_DIR="$SVT_PSY_DIR/build_svt.user"
|
||||||
git clone --depth "$GIT_DEPTH" "$GIT_REPO_URL" "$SVT_PSY_DIR" || \
|
REMOTE_HEAD_SHA="$(git ls-remote "$GIT_REPO_URL" HEAD | awk '{ print $1 }')"
|
||||||
{
|
CURR_HEAD_SHA="$(git -C "$SVT_PSY_DIR" rev-parse HEAD)"
|
||||||
cd "$SVT_PSY_DIR/" || return 1
|
if [[ "$REMOTE_HEAD_SHA" != "$CURR_HEAD_SHA" ]]; then
|
||||||
REMOTE_HEAD_SHA="$(git ls-remote "$GIT_REPO_URL" HEAD | awk '{ print $1 }')"
|
# wipe and start over
|
||||||
CURR_HEAD_SHA="$(git rev-parse HEAD)"
|
rm -rf "$SVT_PSY_DIR"
|
||||||
if [[ "$REMOTE_HEAD_SHA" != "$CURR_HEAD_SHA" ]]; then
|
git clone --depth "$GIT_DEPTH" "$GIT_REPO_URL" "$SVT_PSY_DIR"
|
||||||
# wipe and start over
|
fi
|
||||||
rm -rf "$SVT_PSY_DIR"
|
cd "$SVT_PSY_DIR" || return 1
|
||||||
git clone --depth "$GIT_DEPTH" "$GIT_REPO_URL" "$SVT_PSY_DIR"
|
# check for rebuild
|
||||||
else
|
grep -q "$(good_commit_output)" "$GOOD_COMMIT_BUILDS" && \
|
||||||
grep -q "$(good_commit_output)" "$GOOD_COMMIT_BUILDS" && \
|
cd "$CMAKE_BUILD_DIR" && \
|
||||||
cd "$CMAKE_BUILD_DIR" && \
|
sudo make install && \
|
||||||
sudo make install && \
|
set_commit_status && \
|
||||||
set_commit_status && \
|
return 0
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
sudo rm -rf "$CMAKE_BUILD_DIR"
|
sudo rm -rf "$CMAKE_BUILD_DIR"
|
||||||
mkdir "$CMAKE_BUILD_DIR"
|
mkdir "$CMAKE_BUILD_DIR"
|
||||||
cd "$CMAKE_BUILD_DIR" || return 1
|
cd "$CMAKE_BUILD_DIR" || return 1
|
||||||
@@ -359,14 +359,13 @@ build_svt_av1_psy() {
|
|||||||
build_svt_av1() {
|
build_svt_av1() {
|
||||||
# build svt-av1
|
# build svt-av1
|
||||||
local CMAKE_BUILD_DIR="$SVT_DIR/build_svt.user"
|
local CMAKE_BUILD_DIR="$SVT_DIR/build_svt.user"
|
||||||
git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR"
|
||||||
{
|
cd "$SVT_DIR" || return 1
|
||||||
cd "$SVT_DIR/" && check_for_rebuild && \
|
check_for_rebuild && \
|
||||||
cd "$CMAKE_BUILD_DIR" && \
|
cd "$CMAKE_BUILD_DIR" && \
|
||||||
sudo make install && \
|
sudo make install && \
|
||||||
set_commit_status && \
|
set_commit_status && \
|
||||||
return 0 ;
|
return 0
|
||||||
}
|
|
||||||
sudo rm -rf "$CMAKE_BUILD_DIR"
|
sudo rm -rf "$CMAKE_BUILD_DIR"
|
||||||
mkdir "$CMAKE_BUILD_DIR"
|
mkdir "$CMAKE_BUILD_DIR"
|
||||||
cd "$CMAKE_BUILD_DIR" || return 1
|
cd "$CMAKE_BUILD_DIR" || return 1
|
||||||
@@ -398,8 +397,9 @@ fi
|
|||||||
|
|
||||||
build_rav1e() {
|
build_rav1e() {
|
||||||
# build rav1e
|
# build rav1e
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/xiph/rav1e "$RAV1E_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://github.com/xiph/rav1e "$RAV1E_DIR"
|
||||||
{ cd "$RAV1E_DIR/" && check_for_rebuild && return 0 ; }
|
cd "$RAV1E_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || return 1
|
rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || return 1
|
||||||
source "$HOME/.cargo/env" # for good measure
|
source "$HOME/.cargo/env" # for good measure
|
||||||
cargo clean
|
cargo clean
|
||||||
@@ -410,8 +410,9 @@ build_rav1e() {
|
|||||||
|
|
||||||
build_aom_av1() {
|
build_aom_av1() {
|
||||||
# build aom
|
# build aom
|
||||||
git clone --depth "$GIT_DEPTH" https://aomedia.googlesource.com/aom "$AOM_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://aomedia.googlesource.com/aom "$AOM_DIR"
|
||||||
{ cd "$AOM_DIR/" && check_for_rebuild && return 0 ; }
|
cd "$AOM_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
rm -rf build_aom.user
|
rm -rf build_aom.user
|
||||||
mkdir build_aom.user
|
mkdir build_aom.user
|
||||||
cd build_aom.user || return 1
|
cd build_aom.user || return 1
|
||||||
@@ -435,7 +436,8 @@ fi
|
|||||||
build_vmaf() {
|
build_vmaf() {
|
||||||
# build libvmaf
|
# build libvmaf
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/Netflix/vmaf "$VMAF_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://github.com/Netflix/vmaf "$VMAF_DIR" || \
|
||||||
{ cd "$VMAF_DIR/libvmaf" && check_for_rebuild && return 0 ; }
|
cd "$VMAF_DIR/libvmaf" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
python3 -m virtualenv .venv
|
python3 -m virtualenv .venv
|
||||||
(
|
(
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
@@ -462,8 +464,9 @@ fi
|
|||||||
|
|
||||||
build_dav1d() {
|
build_dav1d() {
|
||||||
# build dav1d
|
# build dav1d
|
||||||
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/dav1d.git "$DAV1D_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/dav1d.git "$DAV1D_DIR"
|
||||||
{ cd "$DAV1D_DIR" && check_for_rebuild && return 0 ; }
|
cd "$DAV1D_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
rm -rf build.user
|
rm -rf build.user
|
||||||
mkdir build.user
|
mkdir build.user
|
||||||
meson setup . build.user \
|
meson setup . build.user \
|
||||||
@@ -480,8 +483,9 @@ build_dav1d() {
|
|||||||
|
|
||||||
build_opus() {
|
build_opus() {
|
||||||
# build opus
|
# build opus
|
||||||
git clone --depth "$GIT_DEPTH" https://github.com/xiph/opus.git "$OPUS_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://github.com/xiph/opus.git "$OPUS_DIR"
|
||||||
{ cd "$OPUS_DIR" && check_for_rebuild && return 0 ; }
|
cd "$OPUS_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
./autogen.sh || return 1
|
./autogen.sh || return 1
|
||||||
CFLAGS="-O${OPT_LVL} ${LTO_FLAG} ${COMP_FLAGS}"
|
CFLAGS="-O${OPT_LVL} ${LTO_FLAG} ${COMP_FLAGS}"
|
||||||
export CFLAGS
|
export CFLAGS
|
||||||
@@ -499,8 +503,9 @@ build_opus || exit 1
|
|||||||
|
|
||||||
build_x264() {
|
build_x264() {
|
||||||
# build x264
|
# build x264
|
||||||
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/x264.git "$X264_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://code.videolan.org/videolan/x264.git "$X264_DIR"
|
||||||
{ cd "$X264_DIR" && check_for_rebuild && return 0 ; }
|
cd "$X264_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
make clean
|
make clean
|
||||||
./configure --enable-static \
|
./configure --enable-static \
|
||||||
--enable-pic \
|
--enable-pic \
|
||||||
@@ -545,7 +550,8 @@ build_x265() {
|
|||||||
build_vpx() {
|
build_vpx() {
|
||||||
# build vpx
|
# build vpx
|
||||||
git clone --depth "$GIT_DEPTH" https://chromium.googlesource.com/webm/libvpx.git "$VPX_DIR" || \
|
git clone --depth "$GIT_DEPTH" https://chromium.googlesource.com/webm/libvpx.git "$VPX_DIR" || \
|
||||||
{ cd "$VPX_DIR" && check_for_rebuild && return 0 ; }
|
cd "$VPX_DIR" || return 1
|
||||||
|
check_for_rebuild && return 0
|
||||||
if [[ "$ARCH" == "x86_64" ]]; then
|
if [[ "$ARCH" == "x86_64" ]]; then
|
||||||
VP_COMP_FLAGS="${COMP_FLAGS}";
|
VP_COMP_FLAGS="${COMP_FLAGS}";
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ get_crop() {
|
|||||||
local DURATION="$(get_duration "$INPUT")"
|
local DURATION="$(get_duration "$INPUT")"
|
||||||
local TOTAL_SECONDS="$(echo "$DURATION" | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }')"
|
local TOTAL_SECONDS="$(echo "$DURATION" | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }')"
|
||||||
# get cropdetect value for first 1/5 of input
|
# get cropdetect value for first 1/5 of input
|
||||||
local TIME_ENC="$(echo "$TOTAL_SECONDS / 5" | bc)"
|
local TIME_ENC="$(echo "$TOTAL_SECONDS / 2" | bc)"
|
||||||
ffmpeg -hide_banner -ss 0 -discard 'nokey' -i "$INPUT" -t "$TIME_ENC" \
|
ffmpeg -hide_banner -ss 0 -discard 'nokey' -i "$INPUT" -t "$TIME_ENC" \
|
||||||
-map '0:v:0' -filter:v:0 'cropdetect=limit=64:round=16:skip=2:reset_count=0' \
|
-map '0:v:0' -filter:v:0 'cropdetect=limit=64:round=16:skip=2:reset_count=0' \
|
||||||
-codec:v 'wrapped_avframe' -f 'null' '/dev/null' -y 2>&1 | grep -o crop=.* \
|
-codec:v 'wrapped_avframe' -f 'null' '/dev/null' -y 2>&1 | grep -o crop=.* \
|
||||||
@@ -101,7 +101,7 @@ encode() {
|
|||||||
echo -e '#!/usr/bin/env bash\n' > "$ENCODE_FILE"
|
echo -e '#!/usr/bin/env bash\n' > "$ENCODE_FILE"
|
||||||
echo "export OUTPUT=\"$OUTPUT\"" >> "$ENCODE_FILE"
|
echo "export OUTPUT=\"$OUTPUT\"" >> "$ENCODE_FILE"
|
||||||
|
|
||||||
SVT_PARAMS="${GRAIN}sharpness=3:psy-rd=1:tune=3:enable-overlays=1:scd=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15"
|
SVT_PARAMS="${GRAIN}sharpness=3:spy-rd=1:psy-rd=1:tune=3:enable-overlays=1:scd=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15"
|
||||||
echo "export SVT_PARAMS=\"$SVT_PARAMS\"" >> "$ENCODE_FILE"
|
echo "export SVT_PARAMS=\"$SVT_PARAMS\"" >> "$ENCODE_FILE"
|
||||||
|
|
||||||
UNMAP=$(unmap_streams "$INPUT")
|
UNMAP=$(unmap_streams "$INPUT")
|
||||||
|
|||||||
Reference in New Issue
Block a user