aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDennis Fink2026-05-16 12:39:15 +0200
committerDennis Fink2026-05-16 12:39:15 +0200
commit054a300fe5b81ed04f84e902e05c4f4efb95a193 (patch)
tree73eacbd9acd751a41ad326a23b29764e1475445f /README.md
parent4bb37025cf1b4516acd2746dc60ec59449e8aab0 (diff)
downloadtranscode.sh-054a300fe5b81ed04f84e902e05c4f4efb95a193.tar.gz
transcode.sh-054a300fe5b81ed04f84e902e05c4f4efb95a193.zip
feat(backup): add original file backups
Add --backup-dir support so successful encodes can copy the original file to an existing backup directory before replacing it. Preserve each source file's absolute path below the backup directory and avoid overwriting existing backups by appending numeric suffixes when needed. Document the new CLI and config option, and add directory completion for the backup path.
Diffstat (limited to '')
-rw-r--r--README.md30
1 files changed, 23 insertions, 7 deletions
diff --git a/README.md b/README.md
index fd40cfe..32f6a0c 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,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.
+- **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
processes; configurable with `-N`.
- **Respects [NO\_COLOR](https://no-color.org/)**.
@@ -140,8 +142,9 @@ unparseable file is a hard error. Requires `tomlq` when the file is present.
```toml
[encoding]
-preset = "av1"
-nice = 10
+preset = "av1"
+nice = 10
+backup_dir = "backups"
[skip]
codecs = ["av1", "hevc"]
@@ -157,15 +160,16 @@ quiet = false
| Section | Key | Type | CLI equivalent |
|---------|-----|------|----------------|
-| `[encoding]` | `preset` | string | `-p` |
+| `[encoding]` | `backup_dir` | string | `--backup-dir` |
+| `[encoding]` | `hwaccel` | string or boolean | `--hwaccel` / `--no-hwaccel` |
| `[encoding]` | `nice` | integer | `-N` |
+| `[encoding]` | `preset` | string | `-p` |
| `[encoding]` | `verify_output` | boolean | `--verify-output` |
-| `[encoding]` | `hwaccel` | string or boolean | `--hwaccel` / `--no-hwaccel` |
-| `[skip]` | `codecs` | array of strings | `-S` (merged with CLI) |
+| `[output]` | `quiet` | boolean | `-q` |
+| `[output]` | `verbose` | boolean | `-v` |
| `[size_report]` | `enabled` | boolean | `-s` / `--no-size-report` |
| `[size_report]` | `file` | string | `--size-report-file` |
-| `[output]` | `verbose` | boolean | `-v` |
-| `[output]` | `quiet` | boolean | `-q` |
+| `[skip]` | `codecs` | array of strings | `-S` (merged with CLI) |
> **Note:** `[skip] codecs` from the config file and `--skip-codec` from the
> CLI are **merged** — both sources contribute to the skip list.
@@ -174,6 +178,9 @@ quiet = false
> or a method string such as `"vaapi"` or `"cuda"`. CLI `--hwaccel`/`--no-hwaccel`
> always takes precedence.
+> **Note:** `[encoding] backup_dir` must point to an existing directory. CLI
+> `--backup-dir` always takes precedence.
+
### Codec skip list (deprecated)
The legacy `skip.conf` file is no longer read. If it still exists, a
@@ -195,6 +202,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 |
+| `--backup-dir DIR`, `--backup-dir=DIR` | Copy originals to an existing backup directory before replacing them |
| `-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) |
@@ -224,6 +232,9 @@ transcode.sh --size-report --encode-file list.txt
# Dry-run with verbose output to inspect detected formats
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
+
# 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
@@ -234,6 +245,11 @@ transcode.sh --nice 10 --continue *.mp4
transcode.sh --config-file ~/profiles/fast.toml input.mp4
```
+When `--backup-dir` is used, the directory must already exist. Backups preserve
+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.
+
## Size report TSV
When `--size-report` is enabled, the TSV log uses this schema: