Compare commits

..
33 Commits
Author SHA1 Message Date
me 5f13c6624b pv-test, refactor some and change default recommended codecs. 2026-09-15 15:57:58 -07:00
me 13c542b888 pv-test, fix broken loop variable, change loop guess to be multiplication rather than actual loops, add loop counter to output. 2026-09-15 15:42:15 -07:00
me 694767abd5 pv3, fix indentation. pv-test, fix VBR on AV1 to be more testable while also adding capped CRF as an option (changes not yet fully tested). 2026-09-15 10:08:52 -07:00
me 0a88e173fb pv3, try fixing scale issue. 2026-09-15 08:02:31 -07:00
me 2ee0fd2c31 pv3, change tbr (target bitrate) to 1000k and allow overshoot to still take it to 2000k like doing with h264. 2026-09-15 07:12:39 -07:00
me fd2720eb6c pv3, speed up while also using more compressed crf. 2026-09-15 07:01:43 -07:00
me 6f2e18e2f1 pv3, add comment. 2026-09-14 19:01:41 -07:00
me 8e4919b689 pv3, fix av1 codec and add betteroutput. 2026-09-14 18:59:11 -07:00
me 0f42f92eaf Delete swp file. 2026-09-14 18:51:01 -07:00
me 2b7253ade2 pv3, fix codec flags. 2026-09-14 18:50:23 -07:00
me 224e112340 Add pv3. 2026-09-14 18:47:21 -07:00
me be5251ae3a pv-test, show ffprobe info for reference of source data. 2026-09-14 18:30:06 -07:00
me fa11113b2c pv-test, add date to start message. 2026-09-14 18:01:14 -07:00
me 3ac932e42b pv-test, fix committing final file, fix checking for finished versions, add welcome message. 2026-09-14 17:00:19 -07:00
me 701dfbcc96 pv-test, continuing the usability and output enhancements. Now recognizes if an unfinished version needs re-done, if the finished test already exists, and checks ffmpeg status before committing the file. 2026-09-14 16:42:49 -07:00
me da0be0ab41 pv-test, another large refactor which allows typing custom tests in while keeping some loops as questions, enhanced output and the handling of loop indentation, use more -n checks to avoid whitespace issues. 2026-09-14 15:52:03 -07:00
me 7463e4a9b8 pv-test, fix looped files from going to input folder, like done for pv. 2026-09-14 12:46:02 -07:00
me 8279cb8618 pv-test, better handling of vpresets. 2026-09-14 12:43:01 -07:00
me ea0c329d3b pv-test, reword the final confirmation. 2026-09-14 10:53:24 -07:00
me 4b34fd3fd3 pv-test, minor output changes around the final confirmation. 2026-09-14 10:50:52 -07:00
me c2c04ead5d pv-test, remove deleteme code. 2026-09-14 10:47:59 -07:00
me c8b0684433 pv-test, fixes and small enhancements via web.
pv-test, fix pv and pv2 outfile location if path in filename, test defaults for each option by keeping the skip, fix some spacing issues.
2026-09-14 10:46:23 -07:00
me f0e8125109 pv-test, huge rework to allow much better dynamic testing rather than manually commenting for loops and changing values, added automated tests for pv and pv2. 2026-09-14 10:22:30 -07:00
me 3c01ed7331 pv-test, add the proper bitrate method for av1, fix a few output issues, skip testing other bitrates for now. 2026-09-14 07:44:20 -07:00
me 94415ac734 pv-test, add seconds to filename, fix minute padding. 2026-09-08 17:43:05 -07:00
me 5755261150 pv-test, only provide warning and error output from ffmpeg. 2026-09-08 17:36:20 -07:00
me 0eb5c6ea70 pv-test, mp4 vs mkv is moot, use the open source variant (mkv) since barely changes the file size. 2026-09-08 17:10:02 -07:00
me 4b647d5e09 pv-test, use the correct codec for opus audio (libopus). 2026-09-08 17:06:02 -07:00
me 5e1505ce0a pv-test, fix the filenames missing variables. 2026-09-08 09:16:59 -07:00
me c3afb3fcf8 pv-test, fix bugs to the point of having ffmpeg successfully running now. 2026-09-08 08:45:04 -07:00
me bb08f1ef94 pv-test, finish the function, still needs tested. 2026-09-08 08:24:30 -07:00
me a105916ab5 pv-test, add untested function. 2026-09-07 12:26:09 -07:00
me 753611fb67 git-check, use the main branch for wiki projects. 2026-08-24 16:36:18 -07:00
+397 -2
View File
@@ -771,6 +771,401 @@ alias vta="v2a"
alias pull-audio="v2a" alias pull-audio="v2a"
alias pa="v2a" alias pa="v2a"
# Run all the different codecs, wrappers, bitrates, etc on a file.
function pv-test {
echo -e "Welcome! Let's get your tests set up...\n"
## Input ##
filename_in="$1"
while [[ -z "$filename_in" ]]; do
read -p "Please provide the filename: " filename_in
done
# Existing Functions #
declare -l pv{,2}="n"
typeset -l test_pv{,2}
read -p "Create a test with current 'pv' function? (y/N) " test_pv
if [[ "$test_pv" == "y"* ]]; then
pv="y"
echo " great, will run pv"
else
echo " skipping"
fi
echo " "
read -p "Create a test with current 'pv2' function? (y/N) " test_pv2
if [[ "$test_pv2" == "y"* ]]; then
pv2="y"
echo " great, will run pv2"
else
echo " skipping"
fi
echo " "
# Loop Data #
declare -l {vpreset,crf,vbr,abr,achannel,afreq,over,under}s="default"
echo -e " * * Loop Settings * * \n"
typeset -i size_in
read -p "What display ratio would you like to use? (720) " size_in
if (( $size_in == 0 )); then
size_in=720
fi
echo -e " size: '$size_in'\n"
vcodecs="libx264 libsvtav1"
read -p "Please provide the video codecs to test: [$vcodecs] " test_vcodecs
if [[ -n "$test_vcodecs" ]]; then
vcodecs="$test_vcodecs"
fi
echo -e " video codecs: '$vcodecs'\n"
echo ""
read -p "Test the video codec's slowest, medium, and fastest presets? (y/N) " test_vpresets
if [[ "$test_vpresets" == "y"* ]]; then
vpresets="slw med fst"
fi
echo -e " presets: '$vpresets'\n"
read -p "Please provide any CRFs to test: [default] " test_crfs
if [[ -n "$test_crfs" ]]; then
crfs="$test_crfs"
fi
echo -e " CRFs: '$crfs'\n"
read -p "Please provide any video bitrates to test: [default] " test_vbrs
if [[ -n "$test_vbrs" ]]; then
vbrs="$test_vbrs"
fi
echo -e " video bitrates: '$vbrs'\n"
if [[ "$vcodecs" == *"libsvtav1"* ]]; then
read -p "Please provide any over percentages for libsvtav1: [default] " test_overs
if [[ -n "$test_overs" ]]; then
overs="$test_overs"
fi
echo -e " over percentages: '$overs'\n"
read -p "Please provide any under percentages for libsvtav1: [default] " test_unders
if [[ -n "$test_unders" ]]; then
unders="$test_unders"
fi
echo -e " under percentages: '$unders'\n"
fi
acodecs="libopus"
read -p "Please provide the audio codecs to test: [$acodecs] " test_acodecs
if [[ -n "$test_acodecs" ]]; then
acodecs="$test_acodecs"
fi
echo -e " audio codecs: '$acodecs'\n"
read -p "Please provide any audio bitrates to test: [default] " test_abrs
if [[ -n "$test_abrs" ]]; then
abrs="$test_abrs"
fi
echo -e " audio bitrates: '$abrs'\n"
read -p "Test both mono and stereo audio channels? (y/N) " test_achannels
if [[ "$test_achannels" == "y"* ]]; then
achannels="1 2" # 1 is mono, 2 is stereo
fi
echo -e " audio channels: '$achannels'\n"
read -p "Test both 48 and 44.1 kHz audio frequencies? (y/N) " test_afreqs
if [[ "$test_afreqs" == "y"* ]]; then
afreqs="48000 44100" # 48 typically found in videos, 44.1 in audio.
fi
echo -e " audio frequencies: '$afreqs'\n"
normalize=""
typeset -u normalize_in
read -p "Would you like to normalize the audio? (Y/n) " normalize_in
if [[ $normalize_in != "N"* && $normalize_in != "F"* ]]; then
normalize="-filter:a dynaudnorm=f=33:g=65:p=0.66:m=33.3"
fi
echo -e " normalize: '$normalize'\n"
exts="mkv"
read -p "Please provide the containers to test with: [$exts] " test_exts
if [[ -n "$test_exts" ]]; then
exts="$test_exts"
fi
echo -e " extensions: '$exts'\n"
# Final Check #
echo -e " * * Confirmation * * \n"
ffprobe -i "$filename_in"
echo -e "\n * Testing against '$filename_in' above. * \n"
typeset -u okay
read -p "Does everything look okay? (Y/n) " okay
if [[ "$okay" == "N" || "$okay" == "F"* ]]; then
echo " Not okay, aborting."
return 1
fi
echo -e "Sounds good, here we go!\n"
## Main ##
if [[ "$pv" == "y" ]]; then
echo " * Starting pv... * "
filename_pv="$(basename "${filename_in}-pv.mkv")"
if [[ -e "$filename_pv" ]]; then
mv -v "$filename_pv" ~/TRASH
fi
pv "$filename_in" "$filename_pv"
echo -e " * Testing with 'pv' complete! * \n"
fi
if [[ "$pv2" == "y" ]]; then
echo " * Starting pv2... * "
filename_pv2="$(basename "${filename_in}-pv2.mkv")"
if [[ -e "$filename_pv2" ]]; then
mv -v "$filename_pv2" ~/TRASH
fi
pv "$filename_in" "$filename_pv2"
echo -e " * Testing with 'pv2' complete! * \n"
fi
typeset -i guess
guess=$(( \
`wc -w <<< $vcodecs` * `wc -w <<< $vpresets` * `wc -w <<< $crfs` \
* `wc -w <<< $vbrs` * `wc -w <<< $overs` * `wc -w <<< $unders` \
* `wc -w <<< $acodecs` * `wc -w <<< $abrs` \
* `wc -w <<< $achannels` * `wc -w <<< $afreqs` \
))
if (( $guess > 0 )); then
plural=""
if (( $guess != 1 )); then
plural="s"
fi
echo -e "Expecting ${guess} loop${plural}, please be patient.\n"
else
echo "ERROR: Something went wrong, got 0 loops, exiting."
return 1
fi
typeset -i count
unset vcodec vpreset crf vbr acodec abr ext
for vcodec in $vcodecs; do for vpreset in $vpresets; do for crf in $crfs; do
for vbr in $vbrs; do for over in $overs; do for under in $unders; do
for acodec in $acodecs; do for abr in $abrs;
do for achannel in $achannels; do for afreq in $afreqs; do
for ext in $exts; do
(( count++ ))
preset=""
if [[ "$vpreset" != "default" ]]; then
if [[ "$vcodec" == "libsvtav1" ]]; then
case $vpreset in
slw) preset="0" ;;
med) preset="6" ;;
fst) preset="13" ;;
*) preset="$vpreset" ;;
esac
else
case $vpreset in
slw) preset="veryslow" ;;
med) preset="medium" ;;
fst) preset="ultrafast" ;;
*) preset="$vpreset" ;;
esac
fi
if [[ -n "$preset" ]]; then
preset="-preset $preset"
fi
fi
bitrate=""
if [[ "$crf" != "default" ]]; then
bitrate="-crf $crf"
fi
declare {o,u}fn=""
if [[ "$vbr" != "default" ]]; then
if [[ "$vcodec" == "libsvtav1" ]]; then
#bitrate="$bitrate -svtav1-params rc=1:tbr=$vbr:overshoot-pct=0:undershoot-pct=100"
declare {o,u}=""
if [[ "$over" != "default" ]]; then
o=":overshoot-pct=${over}"
ofn="-o${over}"
fi
if [[ "$under" != "default" ]]; then
u=":undershoot-pct=${under}"
ufn="-u${under}"
fi
if [[ "$crf" == "default" ]]; then
# Variable Bitrate, rate passed should be the TARGET, not the max.
# Can control the params which allow the target to go up and down, but defaults are okay.
# Seems better to not try and force this to imitate "-b:v -minrate -maxrate -bufsize"
# Will definitely want to use a slower preset to ensure the quality stays consistent.
# Can be done like this if not changing over or under.
#bitrate="-b:v $vbr"
# rc=1, over defaults to 25, under defaults to 50
# rc=2, over defaults to 25, under defaults to 25
bitrate="-svtav1-params rc=1:tbr=${vbr}${o}${u}"
else
# Capped CRF, when both a CRF and bitrate are passed.
# Better to use high CRF with low BR than high BR with low CRF (produces artifacts/tearing).
bitrate="-svtav1-params rc=0:crf=${crf}:mbr=${vbr}${o}${u}"
fi
else
bitrate="$bitrate -b:v $vbr -minrate 0 -maxrate $vbr -bufsize $vbr"
fi
fi
fidelity=""
if [[ "$abr" != "default" ]]; then
fidelity="-b:a $abr"
fi
channel=""
if [[ "$achannel" != "default" ]]; then
channel="-ac $achannel"
fi
frequency=""
if [[ "$afreq" != "default" ]]; then
if [[ "$acodec" == "libopus" ]]; then
case $afreq in
48000) ;; 24000) ;; 16000) ;; 12000) ;; 8000) ;;
*) echo -e "ERROR: libopus cannot do this, skipping frequency ${afreq}."
continue
;;
esac
fi
frequency="-ar $afreq"
fi
newfile="_${size_in}p_${vcodec}-${vpreset}-${crf}-${vbr}${ofn}${ufn}_${acodec}-${abr}-${achannel}-${afreq}.${ext}"
echo -e " * [Loop $count/$guess] Parameters for this test: $newfile * \n"
if [[ -e "$newfile" ]]; then
mv -v "$newfile" ~/TRASH/
echo -e "Removed unfinished version of this file.\n"
fi
if [[ `ls *"$newfile" 2>/dev/null` ]]; then
echo -e "Completed version of this file already exists, skipping.\n"
continue
fi
echo "$(date) - Starting run..."
start=$SECONDS
set -x
ffmpeg -nostdin -hide_banner -loglevel level+warning \
-i "$filename_in" \
-filter:v scale=-1:$size_in \
-c:v $vcodec \
$preset \
$bitrate \
-c:a $acodec \
$fidelity \
$channel \
$frequency \
$normalize \
-movflags +faststart \
"$newfile"
status="$?"
set +x
finish=$SECONDS
minutes=$(( (finish - start) / 60 ))
seconds=$(( (finish - start) % 60 ))
printf -v padded_mins "%03d" "$minutes"
printf -v padded_secs "%02d" "$seconds"
if [[ "$status" == 0 && -s "$newfile" ]]; then
mv -v "$newfile" "$(basename "${filename_in}_${padded_mins}m${padded_secs}s${newfile}")"
else
echo "ERROR: ffmpeg exited with status $status, not renaming file."
fi
echo -e "\n * Finished in ${minutes}m${seconds}s! * \n"
done
done done
done done
done done done
done done done
## Finish ##
plural=""
if (( $count != 1 )); then
plural="s"
fi
echo "Completed tests after ${count} loop${plural}! :)"
}
# 20260914 - After playing with pv-test for a while.
function pv3 {
org="$1"
out="$2"
echo "Processing '$org' to '$out' using AV1 and OPUS."
## Versions ##
# v0
scale=-1:720
preset=0 # took 20 minutes where preset 2 was under 2 minutes
crf=18
vbr=2000k # this is creating 2Mbps files, not maxxing at 2.
overshoot=0
undershoot=100
# v1
preset=2 # WAY faster and still great.
crf=28 # much smaller filesize
# v2
# Try to mimic h264 better.
vbr=1000k
overshoot=100
# v3
# Fix weird aspect ratios.
scale="1280:720,setsar=1"
## Main ##
echo -e "\n * Original File * \n"
ffprobe -i "$org"
echo -e "\n * Starting Processing *\n"
date
set -x
ffmpeg -nostdin -hide_banner -loglevel level+warning \
-i "$org" \
-c:v libsvtav1 \
-preset $preset \
-filter:v scale=$scale \
-crf $crf \
-svtav1-params rc=1:tbr=${vbr}:overshoot-pct=${overshoot}:undershoot-pct=${undershoot} \
-c:a libopus \
-filter:a dynaudnorm=f=33:g=65:p=0.66:m=33.3 \
-movflags +faststart \
"$out"
status="$?"
set +x
if [[ "$status" != 0 || ! -s "$out" ]]; then
echo "Failed, deleting output."
mv -v "$out" ~/TRASH/
return $status
fi
echo -e "\n * Success! *"
}
### Web ### ### Web ###
@@ -867,9 +1262,9 @@ function git-check {
if [[ -d .git ]]; then if [[ -d .git ]]; then
git ls-remote --exit-code --heads origin dev git ls-remote --exit-code --heads origin dev
dev_exists="$?" dev_exists="$?"
if [[ "$dev_exists" == 0 ]]; then if [[ "$dev_exists" == 0 && "$dir" != *".wiki" ]]; then
git switch dev git switch dev
elif [[ "$dev_exists" == 2 ]]; then elif [[ "$dev_exists" == 2 || "$dir" == *".wiki" ]]; then
git switch main git switch main
else else
echo "ERROR: Unknown status for dev_exists, '$dev_exists'." echo "ERROR: Unknown status for dev_exists, '$dev_exists'."