aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDennis Fink2026-05-22 06:40:27 +0200
committerDennis Fink2026-05-22 06:40:27 +0200
commit3e8c51b898eb9cc888a156cb9678ec4c1478cc8d (patch)
tree1b4dad703aa8016e8a7bd593ae9003224607f709 /README.md
parent7ad58bb0a120c56563f333bce142f9772ed00168 (diff)
downloadtranscode.sh-3e8c51b898eb9cc888a156cb9678ec4c1478cc8d.tar.gz
transcode.sh-3e8c51b898eb9cc888a156cb9678ec4c1478cc8d.zip
feat(streams): allow selecting video probe stream
Add --video-stream and [encoding].video_stream so users can choose which input video stream is probed for preset helper variables. Use the selected stream for codec, pixel format, frame rate, output pixel format, and GOP size metadata while leaving preset stream mapping unchanged. Validate CLI stream selectors strictly and ignore invalid config values with a warning so bad configuration falls back to the default v:0 stream. Document the new option in the README and man page, add verbose dry-run output, and provide bash completion for common video stream selectors. Closes #6.
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 24 insertions, 2 deletions
diff --git a/README.md b/README.md
index 720e0d5..c937595 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,8 @@ replaces the original atomically on success.
- **Size report** (`-s`) — print per-file size feedback, show a batch
summary, and write a status TSV log for encoded, skipped, and failed files.
- **Dry-run** (`-n`) — preview what would happen without touching any files.
+- **Selectable video probe stream** (`--video-stream`) — choose which input
+ video stream is probed for preset helper variables.
- **Backup original** (`--backup-dir DIR`) — copy originals to an existing
backup directory before replacing them.
- **Nice** — runs ffmpeg at niceness 19 by default to avoid starving other
@@ -82,8 +84,10 @@ Presets live in:
${XDG_CONFIG_HOME:-$HOME/.config}/transcode.sh/presets/<name>.sh
```
-Each preset is sourced as Bash and must define an array named `ffargs`.
-The following variables are available to presets at source time:
+Each preset is sourced as Bash and must define an array named `ffargs`. The
+following variables are available to presets at source time. They are derived
+from the selected video probe stream, which defaults to `v:0` and can be
+changed with `--video-stream` or `[encoding] video_stream`:
| Variable | Description |
|----------|-------------|
@@ -104,6 +108,12 @@ these base arguments to `ffmpeg`:
-c copy # default to stream copy for every stream
```
+`--video-stream` only controls which input stream is probed for helper
+variables such as `input_codec`, `input_pixel_format`, `input_frame_rate`,
+`input_fps`, `output_pixel_format`, and `output_gop_size`. It does not rewrite
+the preset's `ffargs`; presets remain responsible for selecting which ffmpeg
+stream to encode.
+
A preset therefore only needs to specify the streams it wishes to
re-encode (typically `-c:v:0`) and any associated encoder options.
All other streams — audio, subtitles, attachments — are passed through
@@ -156,6 +166,7 @@ Requires `tomlq` when the file is present.
preset = "av1"
nice = 10
backup_dir = "backups"
+video_stream = "v:0"
[skip]
codecs = ["av1", "hevc"]
@@ -176,6 +187,7 @@ quiet = false
| `[encoding]` | `nice` | integer | `-N` |
| `[encoding]` | `preset` | string | `-p` |
| `[encoding]` | `verify_output` | boolean | `--verify-output` |
+| `[encoding]` | `video_stream` | string | `--video-stream` |
| `[output]` | `quiet` | boolean | `-q` |
| `[output]` | `verbose` | boolean | `-v` |
| `[output]` | `ffmpeg_loglevel` | string | `--ffmpeg-loglevel` |
@@ -195,6 +207,12 @@ quiet = false
> **Note:** `[encoding] backup_dir` must point to an existing directory. CLI
> `--backup-dir` always takes precedence.
+> **Note:** `[encoding] video_stream` selects the input video stream that is
+> probed for preset helper variables. It defaults to `"v:0"`. Invalid config
+> values are ignored with a warning and the default is used. CLI
+> `--video-stream` always takes precedence. This setting does not change ffmpeg
+> stream mapping in presets.
+
### Codec skip list (deprecated)
The legacy `skip.conf` file is no longer read. If it still exists, a
@@ -228,6 +246,7 @@ transcode.sh [OPTION] [--] FILE...
| `-l`, `--only-if-smaller` | Only replace original if new file is smaller |
| `--no-only-if-smaller` | Do replace original even if new file is bigger |
| `-p NAME`, `--preset NAME`, `--preset=NAME` | Preset to use (default: `default`) |
+| `--video-stream STREAM_SELECTOR`, `--video-stream=STREAM_SELECTOR` | Select the input video stream to probe for preset helper variables, e.g. `v:0` or `v:1` (default: `v:0`) |
| `--ffmpeg-loglevel LEVEL`, `--ffmpeg-loglevel=LEVEL` | Specify the loglevel to pass to ffmpeg (default: `fatal`) |
| `-q`, `--quiet` | Suppress all output (overrides `-v`) |
| `-v`, `--verbose` | More detailed output |
@@ -262,6 +281,9 @@ transcode.sh --nice 10 --continue *.mp4
# Load an alternative config file
transcode.sh --config-file ~/profiles/fast.toml input.mp4
+
+# Probe the second video stream for preset helper variables
+transcode.sh --video-stream v:1 --dry-run --verbose input.mkv
```
When `--backup-dir` is used, the directory must already exist. Backups preserve