log is done

This commit is contained in:
2024-01-12 19:44:09 -06:00
parent 5bf1bb0c17
commit 0523a28e49
3 changed files with 11 additions and 8 deletions

View File

@@ -18,17 +18,16 @@ 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=(40)
CRF=(20 25 30)
ENCODER=('libsvtav1' 'librav1e' 'libaom-av1')
ENCODER=('libsvtav1')
PRESET=(13)
PRESET=(4 8 12)
# Log for results
LOG="$OUTPUT_DIR/results.txt"
VMAF_RESULTS="$OUTPUT_DIR/vmaf.json"
for input in "${INPUT[@]}"
do
# echo "$input"
for encoder in "${ENCODER[@]}"
do
for preset in "${PRESET[@]}"
@@ -38,11 +37,14 @@ do
OUTPUT="$OUTPUT_DIR/${encoder}_preset${preset}_crf${crf}_$input"
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
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
echo -e "\t time taken: $TIME_DIFF seconds" >> "$LOG"
ffmpeg -an -sn -i "$OUTPUT" -i "$INPUT_DIR/$input" -lavfi \
libvmaf=n_threads="$(nproc)":log_path="$VMAF_RESULTS":log_fmt='json' -f 'null' -
echo -e "\t mean vmaf: $(cat "$VMAF_RESULTS" | jq '.pooled_metrics.vmaf.mean')" >> "$LOG" || exit 1
done
done
done