diff options
| author | Dennis Fink | 2026-05-08 19:41:14 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-05-08 19:41:14 +0200 |
| commit | 7e73a76bba167c2a6d5bd9afc145690c5049ebf2 (patch) | |
| tree | e3d6f0596f3d7083c5b9c2141649590a2931a5d3 /transcode.sh.1 | |
| parent | aea6e655e1c572c2a11c5438c57634f15649bf5e (diff) | |
| download | transcode.sh-7e73a76bba167c2a6d5bd9afc145690c5049ebf2.tar.gz transcode.sh-7e73a76bba167c2a6d5bd9afc145690c5049ebf2.zip | |
feat(cli)!: add TOML config file support
Add a structured config file so common defaults can live in one place
instead of being repeated in aliases or shell wrappers. CLI flags keep
precedence, which keeps one-off overrides predictable.
Use tomlq only when a config file is present, and fail early on missing
dependencies or invalid TOML so configuration mistakes do not silently
change encode behavior.
Move the persistent skip-codec list from the legacy skip.conf file to
[skip] codecs in config.toml. Config codecs are merged with --skip-codec
so global defaults and per-run skips can be combined.
Document the new format in the README and man page, update dependency
notes, and extend bash completion for config-file paths and the new
negative boolean flags.
BREAKING CHANGE: skip.conf is no longer read for codec skips. Migrate
its entries to [skip] codecs in config.toml and remove the old file.
BREAKING CHANGE: --encodefile and --encodefile= are replaced by
--encode-file and --encode-file=. Update scripts, aliases, and
completion usage to use the hyphenated option name.
Diffstat (limited to '')
| -rw-r--r-- | transcode.sh.1 | 98 |
1 files changed, 84 insertions, 14 deletions
diff --git a/transcode.sh.1 b/transcode.sh.1 index a22b802..bcbc0fb 100644 --- a/transcode.sh.1 +++ b/transcode.sh.1 @@ -42,7 +42,21 @@ Continue processing the next file even if fails on the current one. Without this flag the script exits immediately on the first failure. .TP -.BR \-f " \fIPATH\fR, " \-\-encodefile " \fIPATH\fR, " \-\-encodefile= \fIPATH\fR +.BR \-\-no\-continue +Do not continue processing next file even if +.BR ffmpeg (1) +fails on the current one. +.TP +.BR \-\-config\-file " \fIPATH\fR, " \-\-config\-file= \fIPATH\fR +Load configuration from \fIPATH\fR instead of the default location +.RI ( ${XDG_CONFIG_HOME:-$HOME/.config}/transcode.sh/config.toml ). +If the specified file does not exist the script exits with a configuration +error. CLI flags always take precedence over values in the config file. +Requires +.BR tomlq (1) +when the file is present. +.TP +.BR \-f " \fIPATH\fR, " \-\-encode-file " \fIPATH\fR, " \-\-encode-file= \fIPATH\fR Read the list of files to encode from \fIPATH\fR (one file per line) instead of taking files from the command line. .TP @@ -78,17 +92,20 @@ in the current working directory. .BR \-S " \fILIST\fR, " \-\-skip\-codec " \fILIST\fR, " \-\-skip\-codec= \fILIST\fR Comma-, space- or colon-separated list of video codec names to skip. Files whose detected input codec appears in this list are left untouched. -The per-user skip list from -.B skip.conf -(see -.BR FILES ) -is always loaded in addition to codecs supplied here. +Codecs specified here are merged with any codecs listed under +.B [skip] codecs +in +.B config.toml +\(em both sources contribute to the skip list. .TP .BR \-l ", " \-\-only\-if\-smaller After encoding, replace the original only when the new file is strictly smaller. If the transcoded file is larger the temporary file is removed and the original is kept unchanged. .TP +.BR \-\-no\-only\-if\-smaller +After encoding, replace the original also if the new file is bigger. +.TP .BR \-p " \fINAME\fR, " \-\-preset " \fINAME\fR, " \-\-preset= \fINAME\fR Load the preset named \fINAME\fR from the preset directory. Defaults to .BR default . @@ -134,6 +151,8 @@ or terminal detection. Set to .B 1 to enable structured debug messages (high-level state reporting). +After configuration loading, a summary of all effective option values +is printed. .TP .B TRACE Set to @@ -207,12 +226,51 @@ ffargs=( \-c:v:0 libsvtav1 \-crf 30 \-preset 6 \-pix_fmt "$output_pixel_format" presets are executed as shell code. Only use presets from trusted sources. .TP +.IR "${XDG_CONFIG_HOME:-$HOME/.config}/transcode.sh/config.toml" +Optional TOML configuration file. Provides defaults for all options. +CLI flags always take precedence. The file must be valid TOML; an +unparseable file is a hard error. Requires +.BR tomlq (1). +Supported sections and keys: +.RS +.TP +.B [encoding] preset +String. Default preset name. Equivalent to +.BR \-p . +.TP +.B [encoding] nice +Integer. Default niceness value. Equivalent to +.BR \-N . +.TP +.B [skip] codecs +Array of strings. Merged with any codecs from +.BR \-S . +.TP +.B [saving] enabled +Boolean. Equivalent to +.BR \-s . +.TP +.B [saving] file +String. Equivalent to +.BR \-\-saving\-file . +.TP +.B [output] verbose +Boolean. Equivalent to +.BR \-v . +.TP +.B [output] quiet +Boolean. Equivalent to +.BR \-q . +.RE +.TP .IR "${XDG_CONFIG_HOME:-$HOME/.config}/transcode.sh/skip.conf" -Optional per-user codec skip list. Each line should contain one codec -name (as reported by -.BR ffprobe (1)). -Files whose input video codec matches an entry are skipped without -encoding. +.B Deprecated. +This file is no longer read. If it exists, a warning is printed. +Migrate its contents to +.B [skip] codecs +in +.B config.toml +and delete the file. .SH EXIT STATUS .TP .B 0 @@ -234,11 +292,14 @@ A required dependency .RB ( ffmpeg , .BR ffprobe , .BR nice , -or .B bc when .B \-\-saving -is active) was not found. +is active, or +.B tomlq +when +.B config.toml +is present) was not found. .SH EXAMPLES Transcode a single file using the default preset: .PP @@ -280,6 +341,14 @@ transcode.sh \-N 10 \-S av1 input.mkv .fi .RE .PP +Load an alternative configuration file: +.PP +.RS +.nf +transcode.sh \-\-config\-file ~/profiles/fast.toml input.mp4 +.fi +.RE +.PP Use .BR ffmpeg (1) installed via Homebrew (macOS): @@ -305,7 +374,8 @@ before invoking .BR ffmpeg (1), .BR ffprobe (1), .BR nice (1), -.BR bc (1) +.BR bc (1), +.BR tomlq (1) .SH AUTHOR Dennis Fink <dennis.fink@c3l.lu> .SH LICENSE |
