add some testing and downloading stuff

This commit is contained in:
Daniel Olsen 2020-07-17 03:04:40 +02:00
parent 26bfac6105
commit 6e2740de44
2 changed files with 22 additions and 7 deletions

View File

@ -16,7 +16,7 @@ stdenv.mkDerivation {
chmod +x $out/bin/triav1c chmod +x $out/bin/triav1c
wrapProgram $out/bin/triav1c \ wrapProgram $out/bin/triav1c \
--prefix PATH : ${lib.makeBinPath [ ffmpeg-full libaom ]} \ --prefix PATH : ${lib.makeBinPath [ ffmpeg-full libaom bc ]} \
--prefix MODEL_PATH : ${libvmaf} --prefix MODEL_PATH : ${libvmaf}
''; '';
} }

View File

@ -5,6 +5,14 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
#################
# $1 - URL #
# $2 - output #
# file - output #
#################
download() {
curl -L "$1" -o "$2"
}
######################### #########################
# $1 - file # # $1 - file #
@ -100,7 +108,7 @@ check_vmaf() {
set +e set +e
ffmpeg -nostats -hide_banner -loglevel warning \ ffmpeg -nostats -hide_banner -loglevel warning \
-r 24 -i "$encode" -r 24 -i "$reference" -filter_complex \ -r 24 -i "$encode" -r 24 -i "$reference" -filter_complex \
"[0:v][1:v]libvmaf=model_path=$MODEL_PATH/share/model/vmaf_v0.6.1.pkl:log_fmt=json:log_path=$encode.vmaf.json" -f null - >/dev/null "[0:v][1:v]libvmaf=model_path=$MODEL_PATH/share/model/vmaf_v0.6.1.pkl:log_fmt=json:log_path=$encode.vmaf.json" -f null - 2>/dev/null >/dev/null
retval=$? retval=$?
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
echo "Error running VMAF scan" >&2 echo "Error running VMAF scan" >&2
@ -140,9 +148,9 @@ find_q() {
break break
fi; fi;
last_q=$q last_q=$q
echo "trying q: $q" > >&2 echo "trying q: $q" >&2
encode_aomenc_single_pass "$input" "-q --passes=1 --end-usage=q --cpu-used=6 --cq-level=$q" "" encode_aomenc_single_pass "$input" "-q --end-usage=q --cpu-used=6 --cq-level=$q" ""
vmaf=`check_vmaf "$input".out.ivf "$input" | jq -r '."VMAF score"'` vmaf=`check_vmaf "$input".out.ivf "$input" | jq -r '."VMAF score"'`
echo "vmaf: $vmaf" >&2 echo "vmaf: $vmaf" >&2
@ -159,4 +167,11 @@ find_q() {
rm "$input".out.ivf rm "$input".out.ivf
} }
find_q "$1" "94" "25" "40" test() {
download "https://pomf.dodsorf.as/f/exfapb.mkv" "test-001.mkv"
q=`find_q "test-001.mkv" "94" "25" "40"`
encode_aomenc_two_pass "test-001.mkv" "-q --end-usage=q --cpu-used=6 --cq-level=$q" ""
rm test-001.mkv
}
test