Small tweaks

This commit is contained in:
Michael Campagnaro 2026-01-09 12:09:56 -05:00
parent 08ed0a411d
commit 1474e23aea
8 changed files with 33 additions and 21 deletions

View File

@ -230,13 +230,15 @@ if [[ "${platform,,}" == *'ming'* ]]; then
_checksum() { _checksum() {
local algo="$1" local algo="$1"
local file="$2" local file="$2"
certutil -hashfile $file $algo certutil -hashfile "$file" $algo
} }
alias checksum='certutil -hashfile' alias checksum='certutil -hashfile'
alias checksum-md5='_checksum MD5'
alias checksum-sha1='_checksum SHA1' # I use delegating to certutil via _checksum() but these programs are faster.
alias checksum-sha256='_checksum SHA256' alias checksum-md5='md5sum.exe'
alias checksum-sha512='_checksum SHA512' alias checksum-sha1='sha1sum.exe'
alias checksum-sha256='sha256sum.exe'
alias checksum-sha512='sha512sum.exe'
fi fi
check_signature() { check_signature() {
@ -1285,11 +1287,13 @@ alias tv='echo can just do a cv with a time range...' #trim-video-vbr'
function compress_and_normalize_volume() { function compress_and_normalize_volume() {
local final_name="$1" local final_name="$1"
shift 1
local opts="$@"
if [[ $final_name == "" ]]; then if [[ $final_name == "" ]]; then
error "Provide a final file name" error "Provide a final file name and optional args for compress-video"
return return
fi fi
compress-video f.mp4 ff ; normalize-volume ff.mp4 "$final_name" compress-video f.mp4 ff $opts ; normalize-volume ff.mp4 "$final_name"
} }
alias cvn='compress_and_normalize_volume' alias cvn='compress_and_normalize_volume'

View File

@ -2,7 +2,7 @@
# Shows you the status of an object restore job. # Shows you the status of an object restore job.
# #
# e.g. aws-see-restore-status my-deep-glacier-bucket object/path.png # e.g. aws-check-restore-status my-deep-glacier-bucket object/path.png
# #
# You know it's ready when ongoing-request is false and there's a date. If that field is null then the file isn't being restored. # You know it's ready when ongoing-request is false and there's a date. If that field is null then the file isn't being restored.
# #
@ -65,7 +65,7 @@ bucket="$1"
path="$2" path="$2"
if [[ $bucket == "" || $path == "" ]]; then if [[ $bucket == "" || $path == "" ]]; then
error "Usage: aws-see-restore-status <bucket-name> <path-in-bucket>" error "Usage: aws-check-restore-status <bucket-name> <path-in-bucket>"
exit 1 exit 1
fi fi

View File

@ -32,7 +32,7 @@
# #
# (obviously change the bucket and path to suit your needs). # (obviously change the bucket and path to suit your needs).
# #
# Or use the aws-see-restore-status script. # Or use the aws-check-restore-status script.
# You know it's ready when ongoing-request is false and there's a date. If that # You know it's ready when ongoing-request is false and there's a date. If that
# field is null then the file isn't being restored. # field is null then the file isn't being restored.
# #
@ -312,7 +312,7 @@ else
fi fi
printf "(Note: the time it takes to restore an object can be found in the AWS docs - just look for the $restore_tier restore tier, which is what you used.\\\nOnce restored, download the files from the S3 site or better yet use RCloneBrowser.\\\n" printf "(Note: the time it takes to restore an object can be found in the AWS docs - just look for the $restore_tier restore tier, which is what you used.\\\nOnce restored, download the files from the S3 site or better yet use RCloneBrowser.\\\n"
printf "You can check the status of a file using the aws-see-restore-status script)\\\n" printf "You can check the status of a file using the aws-check-restore-status script)\\\n"
exec 3>&- exec 3>&-

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Bigger crf values == bigger compression.
if which tput >/dev/null 2>&1; then if which tput >/dev/null 2>&1; then
ncolors=$(tput colors) ncolors=$(tput colors)
fi fi
@ -24,9 +26,12 @@ else
fi fi
use_gpu=1 use_gpu=1
# Found the following to work best with vids containing text (e.g. programming vids). These give similar bitrates.
cpu_crf=20
gpu_crf=33
if [[ $# < 2 || $# > 5 ]]; then if [[ $# < 2 || $# > 5 ]]; then
printf "${BOLD}${RED}Usage: compress-video <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> <optional: start time HH:MM:SS> <optional: end time HH:MM:SS> ${NORMAL}\n" printf "${BOLD}${RED}Usage: compress-video <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> <optional: start time HH:MM:SS> <optional: end time HH:MM:SS> (NOTE: gpu crf is $gpu_crf and cpu crf is $cpu_crf - change it by calling compress-video-with-crf)${NORMAL}\n"
exit 1 exit 1
fi fi
@ -37,10 +42,9 @@ if [[ $# > 2 ]]; then
use_gpu=$3 use_gpu=$3
fi fi
# Found the following to work best with vids containing text (e.g. programming vid): 21 for CPU encoding and 28 for GPU (similar bitrates). use_crf=$cpu_crf
use_crf=21
if [[ $use_gpu -eq 1 ]]; then if [[ $use_gpu -eq 1 ]]; then
use_crf=33 use_crf=$gpu_crf
fi fi
compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu $4 $5 compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu $4 $5

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Bigger crf values == bigger compression.
if which tput >/dev/null 2>&1; then if which tput >/dev/null 2>&1; then
ncolors=$(tput colors) ncolors=$(tput colors)
fi fi

View File

@ -31,17 +31,17 @@ output="$2"
target_crf="$3" target_crf="$3"
max_bitrate_mb="$4" max_bitrate_mb="$4"
default_crf="20" default_crf="33" # if you want to compress then use the same gpu compression level from compress-video (i.e. 33, but verify it's still set to this)
default_max_bitrate="6" default_max_bitrate="6"
if [[ $filename == "" || $output == "" ]]; then if [[ $filename == "" || $output == "" ]]; then
printf "${BOLD}${RED}Usage: create a text file that lists the input video paths on separate lines using the format: file '/path/to/video'. Then call:\n\njoin-video <list filename> <output name> <optional: crf (quality, w/ lower = more compression) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M><${NORMAL}\n" printf "${BOLD}${RED}Usage: create a text file that lists the input video paths on separate lines using the format: file '/path/to/video'. Then call:\n\njoin-video <list filename> <output name> <optional: crf (quality, value = compression level) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M>${NORMAL}\n"
exit 1 exit 1
fi fi
extension="${output##*.}" extension="${output##*.}"
if [[ $extension == $output ]]; then if [[ $extension == $output ]]; then
printf "${BOLD}${RED}output arg should have an extension!\n\nUsage: join-video <list filename> <output name> <optional: crf (quality, w/ lower = more compression) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M><${NORMAL}\n" printf "${BOLD}${RED}output arg should have an extension!\n\nUsage: join-video <list filename> <output name> <optional: crf (quality, value = compression level) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M>${NORMAL}\n"
exit 1 exit 1
fi fi

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Re-encodes the video using a constrained bitrate/output size. If you want to # Re-encodes the video using a constrained bitrate/output size. If you want to
# To target the visual quality with a variable bitrate, use trim-video-vbr # control the visual quality with a variable bitrate then use trim-video-vbr
if which tput >/dev/null 2>&1; then if which tput >/dev/null 2>&1; then
ncolors=$(tput colors) ncolors=$(tput colors)

View File

@ -4,6 +4,8 @@
# To have a mostly fixed bitrate with no variable quality, use trim-video-target-rate # To have a mostly fixed bitrate with no variable quality, use trim-video-target-rate
# Just note that it'll result in larger files for a similar max bitrate target and the # Just note that it'll result in larger files for a similar max bitrate target and the
# quality won't really be noticeably better. # quality won't really be noticeably better.
#
# The higher the CRF value, the higher the compression.
if which tput >/dev/null 2>&1; then if which tput >/dev/null 2>&1; then
ncolors=$(tput colors) ncolors=$(tput colors)
@ -35,11 +37,11 @@ end_time="$4"
target_crf="$5" target_crf="$5"
max_bitrate_mb="$6" max_bitrate_mb="$6"
default_crf="20" default_crf="33" # if you want to compress then use the same gpu compression level from compress-video (i.e. 33, but verify it's still set to this)
default_max_bitrate="6" default_max_bitrate="6"
if [[ $filename == "" || $output_name == "" || $start_time == "" ]]; then if [[ $filename == "" || $output_name == "" || $start_time == "" ]]; then
printf "${BOLD}${RED}Usage: trim-video <filename> <output name> <start time HH:MM:SS> <optional: end time HH:MM:SS, use empty string or 0 for no value> <optional: crf (quality, w/ lower = more compression) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M>${NORMAL}\n" printf "${BOLD}${RED}Usage: trim-video-vbr <filename> <output name> <start time HH:MM:SS> <optional: end time HH:MM:SS, use empty string or 0 for no value> <optional: crf (quality, value = compression level) - defaults to $default_crf, use 0 for no value> <optional: max bitrate in MB - defaults to ${default_max_bitrate}M>${NORMAL}\n"
exit 1 exit 1
fi fi