From 054a300fe5b81ed04f84e902e05c4f4efb95a193 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 16 May 2026 12:39:15 +0200 Subject: 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. --- transcode.sh.1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'transcode.sh.1') diff --git a/transcode.sh.1 b/transcode.sh.1 index c95f74e..c827336 100644 --- a/transcode.sh.1 +++ b/transcode.sh.1 @@ -86,6 +86,12 @@ Combine with .B \-v to see the detected codec and pixel format information. .TP +.BR \-\-backup\-dir " \fIDIR\fR, " \-\-backup\-dir= \fIDIR\fR +Copy originals to \fIDIR\fR before replacing them after successful encoding. +\fIDIR\fR must already exist; the script exits with a usage error if it does +not. Backups preserve the source file's absolute path below \fIDIR\fR, and +existing backup files are not overwritten. +.TP .BR \-\-hwaccel " [\fIMETHOD\fR], " \-\-hwaccel= \fIMETHOD\fR Pass .BI \-hwaccel " METHOD" @@ -226,6 +232,23 @@ which prints every command as it is executed. .B XDG_CONFIG_HOME Base directory for user configuration. Defaults to .BR $HOME/.config . +.SH BACKUPS +When +.BR \-\-backup\-dir +is used, backups are only created after +.BR ffmpeg (1) +completed successfully and, when enabled, the integrity check passed. Codec +skips, failed encodes, failed integrity checks, dry runs, and +.BR \-\-only\-if\-smaller +size skips leave the original file in place and create no backup. +.PP +The backup directory itself must already exist. Parent directories below it are +created as needed to preserve the input file path. If the intended backup file +already exists, a numeric suffix such as +.B .1 +or +.B .2 +is appended. .SH SIZE REPORT TSV When .BR \-\-size\-report @@ -369,6 +392,12 @@ Boolean. Equivalent to Defaults to .BR true . .TP +.B [encoding] backup_dir +String. Existing directory where originals are copied after successful +encoding and before replacement. Equivalent to +.BR \-\-backup\-dir . +CLI \fB--backup-dir\fR takes precedence. +.TP .B [skip] codecs Array of strings. Merged with any codecs from .BR \-S . -- cgit v1.3.1