aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md39
1 files changed, 32 insertions, 7 deletions
diff --git a/README.md b/README.md
index fb13b92..7b3adf3 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,8 @@ Revision Date: <!-- revision-date -->2026-05-23<!-- /revision-date -->
small shell snippets that supply the ffmpeg arguments. It probes each input
file to detect the video codec and pixel format, skips files whose codec is on
the skip list, selects an appropriate output pixel format automatically, and
-replaces the original atomically on success.
+replaces the original atomically on success, unless `--output-dir` is used to
+write encoded copies elsewhere.
## Features
@@ -34,6 +35,8 @@ replaces the original atomically on success.
video stream is probed for preset helper variables.
- **Backup original** (`--backup-dir DIR`) — copy originals to an existing
backup directory before replacing them.
+- **No-replacement output mode** (`--output-dir DIR`) — write encoded files to
+ a separate existing directory without replacing or moving originals.
- **Nice** — runs ffmpeg at niceness 19 by default to avoid starving other
processes; configurable with `-N`.
- **Respects [NO\_COLOR](https://no-color.org/)**.
@@ -169,6 +172,7 @@ video_stream = "v:0"
[processing]
skip_codecs = ["av1", "hevc"]
backup_dir = "backups"
+output_dir = "encoded"
only_if_smaller = false
verify_output = true
continue = false
@@ -190,6 +194,7 @@ quiet = false
| `[encoding]` | `video_stream` | string | `--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. This setting does not change ffmpeg stream mapping in presets. |
| `[processing]` | `skip_codecs` | array of strings | `-S` / `--skip-codec-override` | Codecs defined here and codecs defined using `--skip-codec` from the CLI are **merged** by default. Use `--skip-codec-override` to ignore configured skip codecs and use only codecs provided through `--skip-codec` for that run. |
| `[processing]` | `backup_dir` | string | `--backup-dir` | Must point to an existing directory. |
+| `[processing]` | `output_dir` | string | `--output-dir` | Must point to an existing directory. Encoded files are written below this directory instead of replacing originals. |
| `[processing]` | `only_if_smaller` | boolean | `--only-if-smaller` / `--no-only-if-smaller` | |
| `[processing]` | `verify_output` | boolean | `--verify-output` / `--no-verify-output` | |
| `[processing]` | `continue` | boolean | `--continue` / `--no-continue` | |
@@ -231,7 +236,8 @@ transcode.sh [OPTION] [--] FILE...
| `--skip-codec-override` | Use only codecs from `--skip-codec`, ignoring `[processing].skip_codecs` from config |
| `-n`, `--dry-run` | Show what would be done; don't run ffmpeg |
| `--backup-dir DIR`, `--backup-dir=DIR` | Copy originals to an existing backup directory before replacing them |
-| `-l`, `--only-if-smaller` | Only replace original if new file is smaller |
+| `--output-dir DIR`, `--output-dir=DIR` | Write encoded files to an existing output directory instead of replacing originals |
+| `-l`, `--only-if-smaller` | Only keep the encoded output if it is smaller than the original |
| `--no-only-if-smaller` | Do replace original even if new file is bigger |
| `--verify-output` | Probe output with ffprobe before replacing original (default) |
| `--no-verify-output` | Skip the post-encode integrity check |
@@ -278,6 +284,9 @@ transcode.sh --dry-run --verbose my_movie.mkv
# Keep originals in an existing backup directory after successful encodes
transcode.sh --backup-dir ~/transcode-backups *.mp4
+# Write encoded copies elsewhere without replacing originals
+transcode.sh --preset av1 --output-dir ./encoded video.mp4
+
# Use a custom preset, only keep result if smaller, skip AV1 inputs
transcode.sh --preset av1_fast --only-if-smaller --skip-codec av1 /media/films/*.mkv
@@ -299,18 +308,34 @@ the source file's absolute path below that directory and existing backup files
are not overwritten; numeric suffixes such as `.1` and `.2` are appended when
needed.
+When `--output-dir` is used, the output directory must already exist. Originals
+are never replaced, moved, or deleted. Output paths preserve the input path below
+the output directory: relative inputs keep their relative path (for example
+`movies/a.mp4` becomes `encoded/movies/a.mp4`), while absolute inputs are stored
+without the leading slash. Existing output files are not overwritten; numeric
+suffixes such as `.1` and `.2` are appended when needed. `--backup-dir` remains
+compatible with `--output-dir`; when both are set, originals are copied to the
+backup directory and encoded files are written to the output directory.
+
+With `--only-if-smaller`, output-dir mode keeps the same size policy: if the
+encoded file is larger than the original, the new output is deleted and no output
+copy is kept.
+
## Size report TSV
When `--size-report` is enabled, the TSV log uses this schema:
```tsv
-status filename original_bytes new_bytes saved_pct
+status input_path output_path original_bytes new_bytes saved_pct
```
-The `status` column is one of `encoded`, `skipped_codec`, `skipped_larger`,
-or `failed`. Failed rows may leave `new_bytes` and `saved_pct` empty when no
-encoded output exists. `skipped_larger` rows record the temporary output size
-and therefore usually have a negative `saved_pct`; the original file is kept.
+The `status` column is one of `encoded`, `skipped_codec`, `skipped_larger`, or
+`failed`. `input_path` is always the original input path. `output_path` is the
+final path for successful encodes. For size-based skips, it records the planned
+encoded path. It may be empty when no encoded output exists. Failed rows may
+leave `new_bytes` and `saved_pct` empty when no encoded output exists.
+`skipped_larger` rows record the temporary output size and therefore usually
+have a negative `saved_pct`; the original file is kept.
For runs with more than one input file, `--size-report` also prints an end
summary with encoded/skipped/failed counts, total bytes saved, and the overall