aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-02-25 09:14:53 +0100
committerDennis Fink2026-02-25 09:14:53 +0100
commit48e3265ea845437bce4c4895275470e8a1776073 (patch)
tree80c12639bfc6c47b0b1d7310bd51ee4da69d4fef
parentfa3530b214b63701dda5fd8b53aefeb0f0d776c3 (diff)
downloadtranscode.sh-48e3265ea845437bce4c4895275470e8a1776073.tar.gz
transcode.sh-48e3265ea845437bce4c4895275470e8a1776073.zip
fix(cli): improve output consistency and verbose diagnostics
Replace the full help page on no-args with a short usage hint to stderr, reserving the full help for explicit -h/--help invocations. Print the active codec skip list at startup under --verbose so unexpected skips can be diagnosed without resorting to DEBUG mode. Include the resolved ffmpeg command in dry-run --verbose output, which is useful for preset authors verifying their ffargs expansion. Fix the only-if-smaller message to follow the "label: value" convention used throughout the script.
-rwxr-xr-xtranscode.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/transcode.sh b/transcode.sh
index 2866e97..f3b5a4a 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -399,7 +399,7 @@ load_preset() {
if [[ $# -eq 0 ]]; then
debug "No parameters were specified"
- print_help
+ printf "Usage: %s [OPTION] [--] FILE...\nRun '%s --help' for full usage information.\n" "$SCRIPTNAME" "$SCRIPTNAME" >&2
exit $EXIT_USAGE_ERROR
fi
@@ -579,6 +579,10 @@ if [[ ! "$NICE_VALUE" =~ ^-?[0-9]+$ ]] || ((NICE_VALUE < -20 || NICE_VALUE > 19)
exit $EXIT_USAGE_ERROR
fi
+if [[ ${#SKIP_CODECS[@]} -gt 0 ]]; then
+ verbose "Skipping files with codecs:" "${!SKIP_CODECS[*]}"
+fi
+
# Remove temporary output files created during encoding.
# Registered via trap EXIT so it runs on normal exit and on failures
# shellcheck disable=SC2329
@@ -729,6 +733,7 @@ encode_one() {
verbose "Input codec:" "$input_codec"
verbose "Input pixel format:" "$input_pixel_format"
verbose "Output pixel format:" "$output_pixel_format"
+ verbose "Command:" "${cmd[*]}"
return $EXIT_OK
fi
@@ -743,7 +748,7 @@ encode_one() {
# If requested, keep the original if the new file is larger.
if [[ $ONLY_IF_SMALLER -eq 1 && $new_filesize -gt $original_filesize ]]; then
- msg "Did not replace $file as it was larger than the original."
+ msg "Did not replace (new file is larger):" "$file"
rm -f -- "$tmp"
return $EXIT_OK
fi