generated from me/template-mit
pv-test, add untested function.
This commit is contained in:
@@ -771,6 +771,67 @@ alias vta="v2a"
|
||||
alias pull-audio="v2a"
|
||||
alias pa="v2a"
|
||||
|
||||
# Run all the different codecs, wrappers, bitrates, etc on a file.
|
||||
function pv-test {
|
||||
filename_in="$1"
|
||||
while [[ -z "$filename_in" ]]; do
|
||||
read -p "Please provide the filename: " filename_in
|
||||
done
|
||||
|
||||
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
|
||||
|
||||
typeset -i size_in
|
||||
size_in="$3"
|
||||
if [[ -z $size_in ]]; then
|
||||
echo "Size not set, assuming 720."
|
||||
size_in=720
|
||||
fi
|
||||
size="-filter:v scale=-1:$size_in"
|
||||
|
||||
typeset -u okay
|
||||
echo " Testing with '$filename_in'"
|
||||
echo " Normalize set to '$normalize'"
|
||||
echo " Size set to '$size'"
|
||||
read -p "Look okay? (Y/n) " okay
|
||||
if [[ "$okay" == "N" || "$okay" == "F"* ]]; then
|
||||
echo "Not okay, aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "libx264 libsvtav1 libx265" | while read vcodec; do
|
||||
echo "3 4 5" | while read vpreset; do
|
||||
echo "25 28 32" | while read crf; do
|
||||
echo "aac opus" | while read acodec; do
|
||||
echo "192k 128k" | while read abr; do
|
||||
echo "mp4 mkv" | while read ext; do
|
||||
newfile="_$vcodec-p$vpreset-$crf_$acodec-$abr.$ext"
|
||||
start=$SECONDS
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-i "$filename_in" \
|
||||
$size \
|
||||
-c:v $vcodec -preset $vpreset -crf $crf \
|
||||
-c:a $audio -b:a $abr \
|
||||
$normalize \
|
||||
-movflags +faststart \
|
||||
"$newfile"
|
||||
|
||||
finish=$SECONDS
|
||||
minutes=$(( (finish - start) / 60 ))
|
||||
printf -v padded_mins "%03d" "$minutes"
|
||||
mv $newfile "`fn`_${minutes}m$newfile"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
### Web ###
|
||||
|
||||
|
||||
Reference in New Issue
Block a user