diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index 29339c1..d84a0a2 100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -18,9 +18,13 @@ test -f "$INPUT_DIR/${INPUT[2]}" || wget -O "$INPUT_DIR/${INPUT[2]}" 'https://ww rm -rf "$OUTPUT_DIR" && mkdir -p "$OUTPUT_DIR" # Different variables to test -CRF=(25 30) -ENCODER=('libaom-av1' 'libsvtav1' 'librav1e') -PRESET=(4 8) +CRF=(40) +ENCODER=('libsvtav1' 'librav1e' 'libaom-av1') +ENCODER=('libsvtav1') +PRESET=(13) + +# Log for results +LOG="$OUTPUT_DIR/results.txt" for input in "${INPUT[@]}" do @@ -32,8 +36,13 @@ do for crf in "${CRF[@]}" do OUTPUT="$OUTPUT_DIR/${encoder}_preset${preset}_crf${crf}_$input" - echo "output: $OUTPUT" - ffmpeg -i "$INPUT_DIR/$input" -c:a copy -c:v "$encoder" -preset "$preset" -crf "$crf" "$OUTPUT" + echo "output: $OUTPUT" >> "$LOG" + TIME_BEFORE=$(date +%s) + ffmpeg -i "$INPUT_DIR/$input" -c:a copy -c:v "$encoder" -preset "$preset" -crf "$crf" "$OUTPUT" 2> /dev/null || exit 1 + TIME_AFTER=$(date +%s) + TIME_DIFF=$((TIME_AFTER - TIME_BEFORE)) + echo -e "\t time taken: $TIME_DIFF" >> "$LOG" + ffmpeg -i "$OUTPUT" -i "$INPUT_DIR/$input" -lavfi libvmaf=n_threads="$(nproc)" -f 'null' - | grep "VMAF score:" >> "$LOG" || exit 1 done done done diff --git a/scripts/build.sh b/scripts/build.sh index c73efce..a0e86f3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,12 +5,14 @@ SVT_DIR="$BASE_DIR/svt" RAV1E_DIR="$BASE_DIR/rav1e" FFMPEG_DIR="$BASE_DIR/ffmpeg" AOM_DIR="$BASE_DIR/aom" +VMAF_DIR="$BASE_DIR/vmaf" # clone git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR" --depth 1 git clone https://github.com/xiph/rav1e "$RAV1E_DIR" --depth 1 git clone https://git.ffmpeg.org/ffmpeg.git "$FFMPEG_DIR" --depth 1 git clone https://aomedia.googlesource.com/aom "$AOM_DIR" --depth 1 +git clone https://github.com/Netflix/vmaf "$VMAF_DIR" --depth 1 # build svt-av1 cd "$SVT_DIR/" || exit @@ -46,6 +48,16 @@ cmake .. -DCMAKE_BUILD_TYPE=Release make -j "$(nproc)" sudo make install +# build libvmaf +cd "$VMAF_DIR/libvmaf" || exit +git pull +python3 -m virtualenv .venv +source .venv/bin/activate +pip install meson +meson setup build --buildtype release +ninja -vC build +sudo ninja -vC build install + # ldconfig for shared libs echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/ffmpeg.conf sudo ldconfig @@ -55,7 +67,8 @@ cd "$FFMPEG_DIR/" || exit git pull export PKG_CONFIG_PATH+=":/usr/local/lib/pkgconfig" make clean -./configure --enable-libsvtav1 --enable-librav1e --enable-libaom +./configure --enable-libsvtav1 --enable-librav1e \ + --enable-libaom --enable-libvmaf || exit make -j "$(nproc)" sudo make install diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index af563c4..fc5945b 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -5,8 +5,11 @@ sudo apt-get update sudo apt-get install autoconf automake build-essential cmake git-core \ libass-dev libfreetype6-dev libsdl2-dev libtool libva-dev libvdpau-dev \ libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config \ - texinfo wget zlib1g-dev nasm yasm libssl-dev -y + texinfo wget zlib1g-dev nasm yasm libssl-dev time python3 meson ninja-build\ + doxygen xxd -y || exit 1 curl https://sh.rustup.rs -sSf | sh -s -- -y source "$HOME/.cargo/env" -cargo install cargo-c \ No newline at end of file +cargo install cargo-c + +python3 -m pip install virtualenv