mirror of
https://github.com/levogevo/ffmpeg-av1-builder.git
synced 2026-01-15 16:56:18 +00:00
more flags and better filter
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "./scripts/build.sh [-h] [-p] [-o] [r] [-a]"
|
echo "./scripts/build.sh [-h] [-p] [-o] [-r]"
|
||||||
echo -e "\th: display this help output"
|
echo -e "\th: display this help output"
|
||||||
echo -e "\tp: build svt-av1-psy with dovi library"
|
echo -e "\tp: build svt-av1-psy with dovi library"
|
||||||
echo -e "\to: build other encoders x264/5 and vpx"
|
echo -e "\to: build other encoders x264/5 and vpx"
|
||||||
@@ -14,7 +14,8 @@ update_git() {
|
|||||||
git pull
|
git pull
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTS='hpao:'
|
GREP_FILTER="av1"
|
||||||
|
OPTS='hpor'
|
||||||
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
|
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
|
||||||
MIN_OPT=0
|
MIN_OPT=0
|
||||||
# using all
|
# using all
|
||||||
@@ -33,10 +34,12 @@ while getopts "$OPTS" flag; do
|
|||||||
;;
|
;;
|
||||||
o)
|
o)
|
||||||
export BUILD_OTHERS="true"
|
export BUILD_OTHERS="true"
|
||||||
|
GREP_FILTER+="|x26|libvpx"
|
||||||
echo "building other encoders"
|
echo "building other encoders"
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
export BUILD_ROCKCHIP="true"
|
export BUILD_ROCKCHIP="true"
|
||||||
|
GREP_FILTER+="|rkmpp"
|
||||||
echo "building rockchip media platform"
|
echo "building rockchip media platform"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -87,7 +90,7 @@ fi
|
|||||||
echo "COMP_FLAGS: $COMP_FLAGS"
|
echo "COMP_FLAGS: $COMP_FLAGS"
|
||||||
|
|
||||||
# set optimization level
|
# set optimization level
|
||||||
OPT_LVL="3"
|
OPT_LVL="1"
|
||||||
|
|
||||||
# for ccache
|
# for ccache
|
||||||
export PATH="/usr/lib/ccache/:$PATH"
|
export PATH="/usr/lib/ccache/:$PATH"
|
||||||
@@ -128,7 +131,7 @@ then
|
|||||||
cd rga_build.user || exit
|
cd rga_build.user || exit
|
||||||
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 \
|
||||||
--optimization=3 -Dc_args="$COMP_FLAGS" -Dcpp_args="-fpermissive $COMP_FLAGS" || exit
|
--optimization="$OPT_LVL" -Dc_args="$COMP_FLAGS" -Dcpp_args="-fpermissive $COMP_FLAGS" || exit
|
||||||
ninja -vC rga_build.user || exit
|
ninja -vC rga_build.user || exit
|
||||||
sudo ninja -vC rga_build.user install || exit
|
sudo ninja -vC rga_build.user install || exit
|
||||||
fi
|
fi
|
||||||
@@ -164,8 +167,8 @@ then
|
|||||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \
|
||||||
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
-DENABLE_AVX512=ON -DBUILD_TESTING=OFF \
|
||||||
-DCOVERAGE=OFF -DLIBDOVI_FOUND=1 \
|
-DCOVERAGE=OFF -DLIBDOVI_FOUND=1 \
|
||||||
-DCMAKE_C_FLAGS="-O3 $COMP_FLAGS" \
|
-DCMAKE_C_FLAGS="-O${OPT_LVL} $COMP_FLAGS" \
|
||||||
-DCMAKE_CXX_FLAGS="-O3 $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} $COMP_FLAGS" || exit
|
||||||
make -j "$(nproc)" || exit
|
make -j "$(nproc)" || exit
|
||||||
sudo make install
|
sudo make install
|
||||||
else
|
else
|
||||||
@@ -234,7 +237,7 @@ rm -rf build.user
|
|||||||
mkdir build.user
|
mkdir build.user
|
||||||
cd build.user || exit
|
cd build.user || exit
|
||||||
meson setup ../ build.user --buildtype release -Db_lto=true \
|
meson setup ../ build.user --buildtype release -Db_lto=true \
|
||||||
--optimization=3 -Dc_args="$COMP_FLAGS" -Dcpp_args="$COMP_FLAGS" || exit
|
--optimization="$OPT_LVL" -Dc_args="$COMP_FLAGS" -Dcpp_args="$COMP_FLAGS" || exit
|
||||||
ninja -vC build.user || exit
|
ninja -vC build.user || exit
|
||||||
sudo ninja -vC build.user install || exit
|
sudo ninja -vC build.user install || exit
|
||||||
|
|
||||||
@@ -248,51 +251,54 @@ make -j "$(nproc)" || exit
|
|||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
unset CFLAGS
|
unset CFLAGS
|
||||||
|
|
||||||
# build x264
|
if [[ "$BUILD_OTHERS" == "true" ]]; then
|
||||||
cd "$X264_DIR" || exit
|
FFMPEG_OTHERS="--enable-gpl --enable-libx264 --enable-libx265 --enable-libvpx"
|
||||||
git stash && git stash drop
|
|
||||||
git pull
|
# build x264
|
||||||
./configure --enable-static --enable-pic \
|
cd "$X264_DIR" || exit
|
||||||
|
update_git
|
||||||
|
./configure --enable-static --enable-pic \
|
||||||
--enable-shared --enable-lto \
|
--enable-shared --enable-lto \
|
||||||
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" || exit
|
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" || exit
|
||||||
make -j "$(nproc)" || exit
|
make -j "$(nproc)" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
|
|
||||||
# build x265
|
# build x265
|
||||||
cd "$X265_DIR" || exit
|
cd "$X265_DIR" || exit
|
||||||
test -d ".git" && git stash && git stash drop
|
test -d ".git" && git stash && git stash drop
|
||||||
test -d ".git" && git pull
|
test -d ".git" && config pull.rebase false
|
||||||
# x265 is dumb and only generates pkgconfig
|
test -d ".git" && git pull
|
||||||
# if git is not there ("release")
|
# x265 is dumb and only generates pkgconfig
|
||||||
mv .git .no_git
|
# if git is not there ("release")
|
||||||
rm -rf build.user
|
mv .git .no_git
|
||||||
mkdir build.user
|
rm -rf build.user
|
||||||
cd build.user || exit
|
mkdir build.user
|
||||||
cmake ../source -DCMAKE_BUILD_TYPE=Release -DNATIVE_BUILD=ON \
|
cd build.user || exit
|
||||||
|
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 \
|
-DENABLE_HDR10_PLUS=ON \
|
||||||
-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="-flto -O${OPT_LVL} $COMP_FLAGS" \
|
||||||
-DCMAKE_CXX_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" || exit
|
-DCMAKE_CXX_FLAGS="-flto -O${OPT_LVL} $COMP_FLAGS" || exit
|
||||||
make -j "$(nproc)" || exit
|
make -j "$(nproc)" || 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 vpx
|
# build vpx
|
||||||
cd "$VPX_DIR" || exit
|
cd "$VPX_DIR" || exit
|
||||||
git stash && git stash drop
|
update_git
|
||||||
git pull
|
./configure --enable-pic --as=yasm \
|
||||||
./configure --enable-pic --as=yasm \
|
|
||||||
--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-examples --disable-docs \
|
--disable-examples --disable-docs \
|
||||||
--enable-better-hw-compatibility \
|
--enable-better-hw-compatibility \
|
||||||
--enable-vp9-highbitdepth \
|
--enable-vp9-highbitdepth \
|
||||||
--enable-shared
|
--enable-shared
|
||||||
make -j "$(nproc)" || exit
|
make -j "$(nproc)" || exit
|
||||||
sudo make install || exit
|
sudo make install || exit
|
||||||
|
fi
|
||||||
|
|
||||||
# ldconfig for shared libs
|
# ldconfig for shared libs
|
||||||
sudo mkdir /etc/ld.so.conf.d/
|
sudo mkdir /etc/ld.so.conf.d/
|
||||||
@@ -306,8 +312,7 @@ export PKG_CONFIG_PATH+=":$(pkg-config --variable pc_path pkg-config)"
|
|||||||
./configure --enable-libsvtav1 --enable-librav1e \
|
./configure --enable-libsvtav1 --enable-librav1e \
|
||||||
--enable-libaom --enable-libvmaf \
|
--enable-libaom --enable-libvmaf \
|
||||||
--enable-libdav1d --enable-libopus \
|
--enable-libdav1d --enable-libopus \
|
||||||
--enable-gpl --enable-libx264 \
|
$FFMPEG_OTHERS \
|
||||||
--enable-libx265 --enable-libvpx \
|
|
||||||
--arch="$ARCH" --cpu=native \
|
--arch="$ARCH" --cpu=native \
|
||||||
--enable-lto $FFMPEG_ROCKCHIP \
|
--enable-lto $FFMPEG_ROCKCHIP \
|
||||||
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" \
|
--extra-cflags="-O${OPT_LVL} $COMP_FLAGS" \
|
||||||
@@ -321,7 +326,10 @@ sudo cp ff*_g /usr/local/bin/
|
|||||||
# validate encoders
|
# validate encoders
|
||||||
hash -r
|
hash -r
|
||||||
source ~/.profile
|
source ~/.profile
|
||||||
ffmpeg -encoders 2>&1 | grep "av1"
|
echo -e "\n"
|
||||||
ffmpeg -encoders 2>&1 | grep "rkmpp"
|
ffmpeg 2>&1 | grep "configuration"
|
||||||
ffmpeg -decoders 2>&1 | grep "rkmpp"
|
echo -e "\n encoders:"
|
||||||
|
ffmpeg -encoders 2>&1 | grep -E "$GREP_FILTER" | grep -Ev "configuration|wmav1"
|
||||||
|
echo -e "\n decoders:"
|
||||||
|
ffmpeg -decoders 2>&1 | grep -E "$GREP_FILTER" | grep -Ev "configuration|wmav1"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user