From 4bb37025cf1b4516acd2746dc60ec59449e8aab0 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 16 May 2026 08:42:23 +0200 Subject: fix: allow out-of-range nice adjustments Keep nice validation focused on accepting integer values instead of rejecting values outside the standard -20 to 19 range. Avoid failing early for values that nice itself accepts and clamps internally. This gives users behavior that matches the underlying tool instead of turning a non-error into a transcode.sh usage error. Update help text and README wording to describe the option as a nice adjustment, matching the command behavior. --- README.md | 2 +- transcode.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ce9e96..fd40cfe 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ transcode.sh [OPTION] [--] FILE... | `--config-file FILE`, `--config-file=FILE` | Load configuration from FILE instead of the default path | | `-f PATH`, `--encode-file PATH`, `--encode-file=PATH` | Read file list from PATH (one per line) | | `-n`, `--dry-run` | Show what would be done; don't run ffmpeg | -| `-N VALUE`, `--nice VALUE`, `--nice=VALUE` | Niceness value for ffmpeg (default: 19) | +| `-N VALUE`, `--nice VALUE`, `--nice=VALUE` | Nice adjustment for ffmpeg (default: 19) | | `--hwaccel [METHOD]`, `--hwaccel=METHOD` | Enable hardware acceleration; METHOD defaults to `auto` if omitted (e.g. `cuda`, `vaapi`, `videotoolbox`); enabled by default | | `--no-hwaccel` | Disable hardware acceleration (omit `-hwaccel` from ffmpeg invocation) | | `-s`, `--size-report` | Print per-file size feedback and write a status TSV log | diff --git a/transcode.sh b/transcode.sh index 33794bf..b88c9d8 100755 --- a/transcode.sh +++ b/transcode.sh @@ -279,7 +279,7 @@ Long options that take a value also accept ${BOLD}${YELLOW}--option${ALL_OFF}${B ${BOLD}${BLUE}Encoding options:${ALL_OFF} ${BOLD}${YELLOW}-p, --preset${ALL_OFF} ${BOLD}${GREEN}NAME${ALL_OFF} load ffmpeg arguments from a preset (default: ${BOLD}${RED}%s${ALL_OFF}) - ${BOLD}${YELLOW}-N, --nice${ALL_OFF} ${BOLD}${GREEN}VALUE${ALL_OFF} nice value for ffmpeg (default: ${BOLD}${RED}%d${ALL_OFF}) + ${BOLD}${YELLOW}-N, --nice${ALL_OFF} ${BOLD}${GREEN}VALUE${ALL_OFF} nice adjustment for ffmpeg (default: ${BOLD}${RED}%d${ALL_OFF}) ${BOLD}${YELLOW}-n, --dry-run${ALL_OFF} show what would be done, do not run ffmpeg ${BOLD}${YELLOW} --hwaccel${ALL_OFF} ${BOLD}${GREEN}[METHOD]${ALL_OFF} enable hardware acceleration; METHOD defaults to ${BOLD}${RED}auto${ALL_OFF} if omitted @@ -1527,8 +1527,8 @@ if [[ $_CLI_SIZE_REPORT_FILE -eq 1 && $SIZE_REPORT -eq 0 ]]; then warn "--size-report-file has no effect without --size-report" fi -if [[ ! "$NICE_VALUE" =~ ^-?[0-9]+$ || $NICE_VALUE -lt -20 || $NICE_VALUE -gt 19 ]]; then - error "Invalid nice value (must be an integer between -20 and 19):" "$NICE_VALUE" +if [[ ! "$NICE_VALUE" =~ ^-?[0-9]+$ ]]; then + error "Invalid nice value (must be an integer):" "$NICE_VALUE" exit $EXIT_USAGE_ERROR fi -- cgit v1.3.1