diff options
Diffstat (limited to '')
| -rw-r--r-- | README.md | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -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 |
