add some testing and downloading stuff
This commit is contained in:
parent
26bfac6105
commit
6e2740de44
@ -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}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
@ -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
|
||||||
@ -120,7 +128,7 @@ check_vmaf() {
|
|||||||
# STDOUT - Q value #
|
# STDOUT - Q value #
|
||||||
####################
|
####################
|
||||||
find_q() {
|
find_q() {
|
||||||
echo "finding q" > &2
|
echo "finding q" >&2
|
||||||
input="$1"
|
input="$1"
|
||||||
target="$2"
|
target="$2"
|
||||||
min_q="$3"
|
min_q="$3"
|
||||||
@ -135,14 +143,14 @@ find_q() {
|
|||||||
echo "$min_q, $max_q" >&2
|
echo "$min_q, $max_q" >&2
|
||||||
q=`echo "($min_q + $max_q)/2" | bc`
|
q=`echo "($min_q + $max_q)/2" | bc`
|
||||||
if [[ $q == $last_q ]]; then
|
if [[ $q == $last_q ]]; then
|
||||||
echo "highest q over target is:" > &2
|
echo "highest q over target is:" >&2
|
||||||
echo $best_q
|
echo $best_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
|
Loading…
Reference in New Issue
Block a user