From e0996abbca0e0ba60022f7070e4524da759cf829 Mon Sep 17 00:00:00 2001 From: Levon Date: Sat, 20 Apr 2024 22:32:46 -0500 Subject: [PATCH 01/16] building --- .gitignore | 3 +- scripts/build.sh | 73 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index b2af0ae..7d23da5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ ffmpeg rav1e -svt +svt* +dovi aom vmaf dav1d diff --git a/scripts/build.sh b/scripts/build.sh index eed0f16..288f45c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -10,9 +10,16 @@ DAV1D_DIR="$BASE_DIR/dav1d" OPUS_DIR="$BASE_DIR/opus" RKMPP_DIR="$BASE_DIR/rkmpp" RKRGA_DIR="$BASE_DIR/rkrga" +DOVI_DIR="$BASE_DIR/dovi" +SVT_PSY_DIR="$BASE_DIR/svt-psy" + +# build svt-psy + dovi_tool +BUILD_PSY="true" # clone git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR" +git clone --depth 1 https://github.com/quietvoid/dovi_tool "$DOVI_DIR" +git clone --depth 1 https://github.com/gianni-rosato/svt-av1-psy "$SVT_PSY_DIR" git clone --depth 1 https://github.com/xiph/rav1e "$RAV1E_DIR" git clone --depth 1 https://aomedia.googlesource.com/aom "$AOM_DIR" git clone --depth 1 https://github.com/Netflix/vmaf "$VMAF_DIR" @@ -79,20 +86,58 @@ then sudo ninja -vC rga_build.user install || exit fi -# build svt-av1 -cd "$SVT_DIR/" || exit -git pull -rm -rf build_svt.user -mkdir build_svt.user -cd build_svt.user || exit -make clean -cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \ - -DENABLE_AVX512=ON -DBUILD_TESTING=OFF \ - -DCOVERAGE=OFF \ - -DCMAKE_C_FLAGS="-O3 $COMP_FLAGS" \ - -DCMAKE_CXX_FLAGS="-O3 $COMP_FLAGS" || exit -make -j "$(nproc)" || exit -sudo make install || exit +if [[ "$BUILD_PSY" == "true" ]]; +then + # build dovi_tool + cd "$DOVI_DIR/" || exit + git stash && git stash drop + git pull + rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit + source "$HOME/.cargo/env" # for good measure + cargo clean + RUSTFLAGS="-C target-cpu=native" cargo build --release + sudo cp target/release/dovi_tool /usr/local/bin/ || exit + + # build libdovi + cd dolby_vision || exit + RUSTFLAGS="-C target-cpu=native" cargo cinstall --release \ + --prefix="$DOVI_DIR/ffmpeg_build.user" \ + --libdir="$DOVI_DIR/ffmpeg_build.user"/lib \ + --includedir="$DOVI_DIR/ffmpeg_build.user"/include + cd ffmpeg_build.user || exit + sudo cp ./lib/* /usr/local/lib/ -r || exit + sudo cp ./include/* /usr/local/include/ -r + + # build svt-avt-psy + cd "$SVT_PSY_DIR/" || exit + git pull + rm -rf build_svt.user + mkdir build_svt.user + cd build_svt.user || exit + make clean + cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \ + -DENABLE_AVX512=ON -DBUILD_TESTING=OFF \ + -DCOVERAGE=OFF -DLIBDOVI_FOUND=1 \ + -DCMAKE_C_FLAGS="-O3 $COMP_FLAGS" \ + -DCMAKE_CXX_FLAGS="-O3 $COMP_FLAGS" || exit + make -j "$(nproc)" || exit + sudo make install +else + # build svt-av1 + cd "$SVT_DIR/" || exit + git pull + rm -rf build_svt.user + mkdir build_svt.user + cd build_svt.user || exit + make clean + cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \ + -DENABLE_AVX512=ON -DBUILD_TESTING=OFF \ + -DCOVERAGE=OFF \ + -DCMAKE_C_FLAGS="-O3 $COMP_FLAGS" \ + -DCMAKE_CXX_FLAGS="-O3 $COMP_FLAGS" || exit + make -j "$(nproc)" || exit + sudo make install || exit +fi # build rav1e cd "$RAV1E_DIR/" || exit From d3184dad14b9105eaf67e1a59732d9bc8af7ae7b Mon Sep 17 00:00:00 2001 From: Levon Date: Thu, 25 Apr 2024 08:37:39 -0500 Subject: [PATCH 02/16] new recc encode --- scripts/recc_encode.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index 40ff717..f96b35d 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -15,8 +15,8 @@ encode() { echo ffmpeg -i \""$INPUT"\" -map 0 $(unmap_streams "$INPUT") \ -af '"aformat=channel_layouts=7.1|5.1|stereo|mono"' -c:a libopus $(get_bitrate_audio "$INPUT") \ - -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240 \ - -svtav1-params \"tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1\" \ + -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240 -dolbyvision 1 -svtav1-params \ + \"tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15\" \ \""$OUTPUT"\" "&& mkvpropedit \"$OUTPUT\" --add-track-statistics-tags " > "$ENCODE_FILE" if [[ "$PRINT_OUT" == "true" ]]; From b4037d27ed6a038236752edad95700e5508b1dbb Mon Sep 17 00:00:00 2001 From: Levon Date: Thu, 25 Apr 2024 20:11:26 -0500 Subject: [PATCH 03/16] dv no --- scripts/recc_encode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index f96b35d..cc34f01 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -15,7 +15,7 @@ encode() { echo ffmpeg -i \""$INPUT"\" -map 0 $(unmap_streams "$INPUT") \ -af '"aformat=channel_layouts=7.1|5.1|stereo|mono"' -c:a libopus $(get_bitrate_audio "$INPUT") \ - -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240 -dolbyvision 1 -svtav1-params \ + -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240 -svtav1-params \ \"tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15\" \ \""$OUTPUT"\" "&& mkvpropedit \"$OUTPUT\" --add-track-statistics-tags " > "$ENCODE_FILE" From 7653256293cd203d765e7780633f9d693932697a Mon Sep 17 00:00:00 2001 From: Levon Date: Fri, 26 Apr 2024 08:07:26 -0500 Subject: [PATCH 04/16] dv ok --- scripts/recc_encode.sh | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index cc34f01..661077f 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -12,19 +12,29 @@ usage() { encode() { ENCODE_FILE="/tmp/encode.sh" + SVT_PARAMS="tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" + UNMAP=$(unmap_streams "$INPUT") + AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono"' + AUDIO_BITRATE=$(get_bitrate_audio "$INPUT") + FFMPEG_PARAMS='-y -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240' - echo ffmpeg -i \""$INPUT"\" -map 0 $(unmap_streams "$INPUT") \ - -af '"aformat=channel_layouts=7.1|5.1|stereo|mono"' -c:a libopus $(get_bitrate_audio "$INPUT") \ - -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240 -svtav1-params \ - \"tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15\" \ - \""$OUTPUT"\" "&& mkvpropedit \"$OUTPUT\" --add-track-statistics-tags " > "$ENCODE_FILE" + echo ffmpeg -i \""$INPUT"\" -map 0 $UNMAP \ + $AUDIO_FORMAT -c:a libopus $AUDIO_BITRATE \ + "$FFMPEG_PARAMS" -dolbyvision 1 -svtav1-params \ + "\"$SVT_PARAMS\" \"$OUTPUT\" ||" \ + ffmpeg -i \""$INPUT"\" -map 0 $UNMAP \ + $AUDIO_FORMAT -c:a libopus $AUDIO_BITRATE \ + "$FFMPEG_PARAMS" -svtav1-params \ + "\"$SVT_PARAMS\" \"$OUTPUT\"" > "$ENCODE_FILE" - if [[ "$PRINT_OUT" == "true" ]]; - then - cat "$ENCODE_FILE" - else - bash "$ENCODE_FILE" - fi + echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" + + if [[ "$PRINT_OUT" == "true" ]]; + then + cat "$ENCODE_FILE" + else + bash "$ENCODE_FILE" + fi } unmap_streams(){ From f055520ceb41b3bfaab8ad690af78899e1709398 Mon Sep 17 00:00:00 2001 From: Levon Date: Fri, 26 Apr 2024 08:27:22 -0500 Subject: [PATCH 05/16] clearer --- scripts/recc_encode.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index 661077f..e0bd417 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -14,18 +14,20 @@ encode() { ENCODE_FILE="/tmp/encode.sh" SVT_PARAMS="tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" UNMAP=$(unmap_streams "$INPUT") - AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono"' + AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono" -c:a libopus' AUDIO_BITRATE=$(get_bitrate_audio "$INPUT") FFMPEG_PARAMS='-y -c:s copy -c:V libsvtav1 -pix_fmt yuv420p10le -crf 25 -preset 3 -g 240' + NL=' \\\n\t' - echo ffmpeg -i \""$INPUT"\" -map 0 $UNMAP \ - $AUDIO_FORMAT -c:a libopus $AUDIO_BITRATE \ + echo '#!/bin/bash' > "$ENCODE_FILE" + echo -e ffmpeg -i \""$INPUT"\" -map 0 $UNMAP \ + $AUDIO_FORMAT $NL $AUDIO_BITRATE \ "$FFMPEG_PARAMS" -dolbyvision 1 -svtav1-params \ - "\"$SVT_PARAMS\" \"$OUTPUT\" ||" \ + $NL "\"$SVT_PARAMS\" \"$OUTPUT\" ||" $NL \ ffmpeg -i \""$INPUT"\" -map 0 $UNMAP \ - $AUDIO_FORMAT -c:a libopus $AUDIO_BITRATE \ + $AUDIO_FORMAT $NL $AUDIO_BITRATE \ "$FFMPEG_PARAMS" -svtav1-params \ - "\"$SVT_PARAMS\" \"$OUTPUT\"" > "$ENCODE_FILE" + $NL "\"$SVT_PARAMS\" \"$OUTPUT\"" >> "$ENCODE_FILE" echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" From 35300a65b9de8910297d189438b85e5a3212ab50 Mon Sep 17 00:00:00 2001 From: Levon Gevorgyan Date: Mon, 29 Apr 2024 17:38:03 -0700 Subject: [PATCH 06/16] install ff*_g --- scripts/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build.sh b/scripts/build.sh index eed0f16..af9e209 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -184,6 +184,7 @@ make clean --disable-podpages --disable-txtpages || exit make -j "$(nproc)" || exit sudo make install || exit +sudo cp ff*_g /usr/local/bin/ # validate encoders hash -r From 27e1951da61d884d30772098cf371a9f2638783e Mon Sep 17 00:00:00 2001 From: Levon Gevorgyan Date: Wed, 8 May 2024 16:21:42 -0500 Subject: [PATCH 07/16] remove title --- scripts/recc_encode.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index e0bd417..e9c46b4 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -30,6 +30,7 @@ encode() { $NL "\"$SVT_PARAMS\" \"$OUTPUT\"" >> "$ENCODE_FILE" echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" + echo "mkvpropedit \"$OUTPUT\" --edit info --set \"title=\"" >> "$ENCODE_FILE" if [[ "$PRINT_OUT" == "true" ]]; then From 3c94224653f56bd1eb7510f5144fa6ded4b88471 Mon Sep 17 00:00:00 2001 From: Levon Date: Fri, 10 May 2024 18:13:26 -0500 Subject: [PATCH 08/16] add grain arg --- scripts/recc_encode.sh | 47 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index e0bd417..dfce7d8 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -4,15 +4,15 @@ # do not take this as a holy grail. usage() { - echo "unrecognized arguments, please retry" - echo "encode -i input_file [-p] output_file" - echo -e "\t-p print the command instead of executing [optional]" + echo "encode -i input_file [-p true/false] [-g NUM] output_file" + echo -e "\t-p print the command instead of executing it [optional]" + echo -e "\t-g set film grain for encode [optional]" return 0 } encode() { ENCODE_FILE="/tmp/encode.sh" - SVT_PARAMS="tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" + SVT_PARAMS="${GRAIN}tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" UNMAP=$(unmap_streams "$INPUT") AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono" -c:a libopus' AUDIO_BITRATE=$(get_bitrate_audio "$INPUT") @@ -62,22 +62,39 @@ get_bitrate_audio() { } -OPTS='i:p' +OPTS='i:p:g:' NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l) PRINT_OUT="false" +GRAIN="" +# only using -i MIN_OPT=2 -MAX_OPT=4 -test "$#" -lt $MIN_OPT && usage && exit 1 -test "$#" -gt $MAX_OPT && usage && exit 1 +# using all + output name +MAX_OPT=$(( NUM_OPTS * 2 - 1 )) +test "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1 +test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1 while getopts "$OPTS" flag; do case "${flag}" in i) INPUT="${OPTARG}" ;; p) - PRINT_OUT="true" + PRINT_OUT="${OPTARG}" + if [[ "$PRINT_OUT" != "false" && "$PRINT_OUT" != "true" ]]; then + echo "unrecognized argument for -p: $PRINT_OUT" + usage + exit 1 + fi + ;; + g) + if [[ ${OPTARG} != ?(-)+([[:digit:]]) || ${OPTARG} -lt 0 ]]; then + echo "${OPTARG} is not a positive integer" + usage + exit 1 + fi + GRAIN="film-grain=${OPTARG}:" ;; *) + echo "wrong flags given" usage exit 1 ;; @@ -87,19 +104,11 @@ done # allow optional output filename if [[ "$#" -eq $MAX_OPT ]]; then OUTPUT="${@: -1}" -elif [[ - ("$PRINT_OUT" == "true") && - ( "$#" -eq 3) - ]]; then - OUTPUT="${HOME}/av1_${INPUT}" -elif [[ "$#" -eq 2 ]]; then - OUTPUT="${HOME}/av1_${INPUT}" else - OUTPUT="${@: -1}" + OUTPUT="${HOME}/av1_${INPUT}" fi echo -echo "INPUT: $INPUT, PRINT_OUT: $PRINT_OUT, OUTPUT: $OUTPUT" +echo "INPUT: $INPUT, PRINT_OUT: $PRINT_OUT, GRAIN: $GRAIN, OUTPUT: $OUTPUT" echo - encode From 9541d12a1fdc83958bb5d1f2d47f7846b60769ae Mon Sep 17 00:00:00 2001 From: Levon Date: Sun, 12 May 2024 11:51:41 -0500 Subject: [PATCH 09/16] fix wrong output --- scripts/recc_encode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index 76bcd6d..4e3ace1 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -103,7 +103,7 @@ while getopts "$OPTS" flag; do done # allow optional output filename -if [[ "$#" -eq $MAX_OPT ]]; then +if [[ $(($# % 2)) != 0 ]]; then OUTPUT="${@: -1}" else OUTPUT="${HOME}/av1_${INPUT}" From e2da935f48ada713e919a1945f2a8992f7d8b018 Mon Sep 17 00:00:00 2001 From: Levon Date: Sun, 12 May 2024 12:08:13 -0500 Subject: [PATCH 10/16] always use same container for output --- scripts/recc_encode.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index 4e3ace1..bd966c7 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -109,6 +109,12 @@ else OUTPUT="${HOME}/av1_${INPUT}" fi +# always use same container for output +INP_FILENAME=$(basename -- "$INPUT") +EXT="${INP_FILENAME##*.}" +OUTPUT="${OUTPUT%.*}" +OUTPUT+=".${EXT}" + echo echo "INPUT: $INPUT, PRINT_OUT: $PRINT_OUT, GRAIN: $GRAIN, OUTPUT: $OUTPUT" echo From 0ef7d02b40713db72286d548a602258685668b01 Mon Sep 17 00:00:00 2001 From: Levon Date: Mon, 13 May 2024 19:59:55 -0500 Subject: [PATCH 11/16] denoise = 1 --- scripts/recc_encode.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index bd966c7..b1a8643 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -12,7 +12,7 @@ usage() { encode() { ENCODE_FILE="/tmp/encode.sh" - SVT_PARAMS="${GRAIN}tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" + SVT_PARAMS="${GRAIN}tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm`-`min=0:qm-max=15" UNMAP=$(unmap_streams "$INPUT") AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono" -c:a libopus' AUDIO_BITRATE=$(get_bitrate_audio "$INPUT") @@ -92,7 +92,7 @@ while getopts "$OPTS" flag; do usage exit 1 fi - GRAIN="film-grain=${OPTARG}:" + GRAIN="film-grain=${OPTARG}::film-grain-denoise=1" ;; *) echo "wrong flags given" From 74dbf68bcc0752609ac9df717d09badbb6d50b8e Mon Sep 17 00:00:00 2001 From: Levon Date: Mon, 13 May 2024 20:03:52 -0500 Subject: [PATCH 12/16] refresh build --- scripts/refresh_build.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 scripts/refresh_build.sh diff --git a/scripts/refresh_build.sh b/scripts/refresh_build.sh new file mode 100755 index 0000000..eb1895f --- /dev/null +++ b/scripts/refresh_build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +git pull +bash ./scripts/install_deps.sh || exit 1 +bash ./scripts/build.sh || exit 1 From 7968c4c2873c92c310c23625b7ac690df03e619b Mon Sep 17 00:00:00 2001 From: Levon Date: Mon, 13 May 2024 20:08:00 -0500 Subject: [PATCH 13/16] only propedit mkv --- scripts/recc_encode.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index b1a8643..b53fa37 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -29,9 +29,11 @@ encode() { "$FFMPEG_PARAMS" -svtav1-params \ $NL "\"$SVT_PARAMS\" \"$OUTPUT\"" >> "$ENCODE_FILE" - echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" - echo "mkvpropedit \"$OUTPUT\" --edit info --set \"title=\"" >> "$ENCODE_FILE" - + if [[ "$EXT" == "mkv" ]]; then + echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" + echo "mkvpropedit \"$OUTPUT\" --edit info --set \"title=\"" >> "$ENCODE_FILE" + fi + if [[ "$PRINT_OUT" == "true" ]]; then cat "$ENCODE_FILE" From 6279acd057595576db8e502f965456caf902b8ea Mon Sep 17 00:00:00 2001 From: Levon Date: Mon, 13 May 2024 20:15:23 -0500 Subject: [PATCH 14/16] typo --- scripts/recc_encode.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index b53fa37..ae97801 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -33,7 +33,7 @@ encode() { echo "mkvpropedit \"$OUTPUT\" --add-track-statistics-tags" >> "$ENCODE_FILE" echo "mkvpropedit \"$OUTPUT\" --edit info --set \"title=\"" >> "$ENCODE_FILE" fi - + if [[ "$PRINT_OUT" == "true" ]]; then cat "$ENCODE_FILE" @@ -94,7 +94,7 @@ while getopts "$OPTS" flag; do usage exit 1 fi - GRAIN="film-grain=${OPTARG}::film-grain-denoise=1" + GRAIN="film-grain=${OPTARG}:film-grain-denoise=1:" ;; *) echo "wrong flags given" From f89cdc175454e62683ec998901ba7b032329dcb7 Mon Sep 17 00:00:00 2001 From: Levon Date: Mon, 13 May 2024 20:16:04 -0500 Subject: [PATCH 15/16] more typos --- scripts/recc_encode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/recc_encode.sh b/scripts/recc_encode.sh index ae97801..f17c327 100755 --- a/scripts/recc_encode.sh +++ b/scripts/recc_encode.sh @@ -12,7 +12,7 @@ usage() { encode() { ENCODE_FILE="/tmp/encode.sh" - SVT_PARAMS="${GRAIN}tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm`-`min=0:qm-max=15" + SVT_PARAMS="${GRAIN}tune=0:enable-overlays=1:scd=1:enable-hdr=1:fast-decode=1:enable-variance-boost=1:enable-qm=1:qm-min=0:qm-max=15" UNMAP=$(unmap_streams "$INPUT") AUDIO_FORMAT='-af "aformat=channel_layouts=7.1|5.1|stereo|mono" -c:a libopus' AUDIO_BITRATE=$(get_bitrate_audio "$INPUT") From 79d8a7c189a874c262913a4ff399a4516f3dca12 Mon Sep 17 00:00:00 2001 From: Levon Date: Thu, 16 May 2024 19:44:21 -0500 Subject: [PATCH 16/16] flags for rockchip and svt --- scripts/build.sh | 86 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 885a71e..dfc7167 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,5 +1,50 @@ #!/bin/bash +usage() { + echo "./scripts/build.sh [-h] [-p] [-o] [r] [-a]" + echo -e "\th: display this help output" + echo -e "\tp: build svt-av1-psy with dovi library" + echo -e "\to: build other encoders x264/5 and vpx" + echo -e "\tr: build rockchip media libraries" +} + +update_git() { + git config pull.rebase false + git stash && git stash drop + git pull +} + +OPTS='hpao:' +NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l) +MIN_OPT=0 +# using all +MAX_OPT=$(( NUM_OPTS )) +test "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1 +test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1 +while getopts "$OPTS" flag; do + case "${flag}" in + h) + usage + exit 0 + ;; + p) + export BUILD_PSY="true" + echo "building psy" + ;; + o) + export BUILD_OTHERS="true" + echo "building other encoders" + ;; + r) + export BUILD_ROCKCHIP="true" + echo "building rockchip media platform" + ;; + *) + echo "building default" + ;; + esac +done + BASE_DIR=$(pwd) SVT_DIR="$BASE_DIR/svt" RAV1E_DIR="$BASE_DIR/rav1e" @@ -13,9 +58,6 @@ RKRGA_DIR="$BASE_DIR/rkrga" DOVI_DIR="$BASE_DIR/dovi" SVT_PSY_DIR="$BASE_DIR/svt-psy" -# build svt-psy + dovi_tool -BUILD_PSY="true" - # clone git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR" git clone --depth 1 https://github.com/quietvoid/dovi_tool "$DOVI_DIR" @@ -43,10 +85,8 @@ export PATH="/usr/lib/ccache/:$PATH" # rockchip ffmpeg libs FFMPEG_ROCKCHIP="" -IS_ROCKCHIP=$(uname -r | grep "rockchip" > /dev/null && echo "yes" || echo "no") -# disabling due to decode errors -IS_ROCKCHIP="no" -if [[ "$IS_ROCKCHIP" == "yes" ]] +# IS_ROCKCHIP=$(uname -r | grep "rockchip" > /dev/null && echo "yes" || echo "no") +if [[ "$BUILD_ROCKCHIP" == "true" ]] then FFMPEG_ROCKCHIP="--enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga" FFMPEG_DIR="$BASE_DIR/ffmpeg-rkmpp" @@ -58,8 +98,7 @@ then # build mpp cd "$RKMPP_DIR/" || exit - git stash && git stash drop - git pull + update_git rm -rf mpp_build.user mkdir mpp_build.user cd mpp_build.user || exit @@ -74,8 +113,7 @@ then # build rga cd "$RKRGA_DIR" || exit - git stash && git stash drop - git pull + update_git rm -rf rga_build.user mkdir rga_build.user cd rga_build.user || exit @@ -90,8 +128,7 @@ if [[ "$BUILD_PSY" == "true" ]]; then # build dovi_tool cd "$DOVI_DIR/" || exit - git stash && git stash drop - git pull + update_git rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit source "$HOME/.cargo/env" # for good measure cargo clean @@ -110,7 +147,7 @@ then # build svt-avt-psy cd "$SVT_PSY_DIR/" || exit - git pull + update_git rm -rf build_svt.user mkdir build_svt.user cd build_svt.user || exit @@ -125,7 +162,7 @@ then else # build svt-av1 cd "$SVT_DIR/" || exit - git pull + update_git rm -rf build_svt.user mkdir build_svt.user cd build_svt.user || exit @@ -141,8 +178,7 @@ fi # build rav1e cd "$RAV1E_DIR/" || exit -git stash && git stash drop -git pull +update_git rm -rf ffmpeg_build.user && mkdir ffmpeg_build.user || exit source "$HOME/.cargo/env" # for good measure cargo clean @@ -156,8 +192,7 @@ sudo cp ./include/* /usr/local/include/ -r || exit # build aom cd "$AOM_DIR/" || exit -git stash && git stash drop -git pull +update_git rm -rf build_aom.user mkdir build_aom.user cd build_aom.user || exit @@ -171,8 +206,7 @@ sudo make install || exit # build libvmaf cd "$VMAF_DIR/libvmaf" || exit -git stash && git stash drop -git pull +update_git python3 -m virtualenv .venv source .venv/bin/activate rm -rf build.user @@ -186,8 +220,7 @@ sudo ninja -vC build.user install || exit # build dav1d cd "$DAV1D_DIR" || exit -git stash && git stash drop -git pull +update_git rm -rf build.user mkdir build.user cd build.user || exit @@ -198,8 +231,7 @@ sudo ninja -vC build.user install || exit # build opus cd "$OPUS_DIR" || exit -git stash && git stash drop -git pull +update_git ./autogen.sh || exit export CFLAGS="-O3 -flto $COMP_FLAGS" ./configure || exit @@ -214,8 +246,7 @@ sudo ldconfig # build ffmpeg cd "$FFMPEG_DIR/" || exit -git stash && git stash drop -git pull +update_git export PKG_CONFIG_PATH+=":/usr/local/lib/pkgconfig" make clean ./configure --enable-libsvtav1 --enable-librav1e \ @@ -237,3 +268,4 @@ source ~/.profile ffmpeg -encoders 2>&1 | grep "av1" ffmpeg -encoders 2>&1 | grep "rkmpp" ffmpeg -decoders 2>&1 | grep "rkmpp" +exit 0