aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* fix(dry-run): join ffmpeg command safelyDennis Fink2026-05-30
| | | | | | | | | Use printf %q to build the verbose dry-run ffmpeg command as a single space-separated string. This makes the command display clearer and more copyable while preserving shell-safe quoting for arguments that contain spaces or special characters.
* feat(output): add no-replacement output modeDennis Fink2026-05-30
| | | | | | | | | | | | | | | | | | | Add --output-dir and [processing].output_dir so encoded files can be written to an existing output directory without replacing, moving, or deleting originals. Preserve input paths below the output directory, avoid overwriting existing outputs with numeric suffixes, and keep --backup-dir compatible with --output-dir. Update finalization, backup, and size-report handling so replacement mode and output-dir mode share the same output path flow. Document the new mode in the README and man page, add bash completion for the new option, and expand the size report schema with input and output paths. Closes #7.
* refactor(utils): use long option namesDennis Fink2026-05-29
| | | | | | Replace short GNU option forms with their long equivalents in utility and cleanup helpers to make option usage more self-documenting while keeping existing BSD/macOS fallbacks unchanged where needed.
* refactor(config): remove skip.conf deprecation pathDennis Fink2026-05-25
| | | | | | | | | | Remove the remaining skip.conf compatibility warning and related constant now that skip.conf is no longer part of the supported configuration flow. Clean up the script header and man page so configuration documentation only describes config.toml and the current [processing].skip_codecs setting.
* refactor(config)!: reorganize processing settingsDennis Fink2026-05-24
| | | | | | | | | | | | | | | | | | | Move processing-related configuration keys out of [encoding] and [skip] into a dedicated [processing] section. Use [processing].skip_codecs, [processing].backup_dir, [processing].only_if_smaller, [processing].verify_output, and [processing].continue so the config structure matches the CLI help sections. Update README, man page, startup warnings, and debug output to use the new configuration layout. BREAKING CHANGE: config.toml keys for skip codecs and processing options moved. Replace [skip].codecs with [processing].skip_codecs, and move [encoding].backup_dir, [encoding].only_if_smaller, [encoding].verify_output, and [encoding].continue to [processing]. Existing config files using the old keys must be updated.
* refactor(skip): inline skip codec parsingDennis Fink2026-05-24
| | | | | | | | | | Fold single-token skip codec handling into parse_skip_codec_parameter so list splitting, normalization, empty-token handling, and duplicate checks live in one place. This removes an extra helper that was only used by the parser while preserving the same comma, space, and colon separated skip-list behavior.
* docs(cli): regroup option documentationDennis Fink2026-05-24
| | | | | | | | | | | | Reorganize CLI options into matching sections across help output, README, man page, and bash completion. Split input, encoding, skip, processing, size report, display, and general options so related flags are easier to find and the documented order matches the parser more closely. Add --no-config to the README and man page while updating bash completion order to follow the new help structure.
* refactor(config): simplify skip codec loadingDennis Fink2026-05-23
| | | | | | | | | | | Load configured skip codecs through the same parser used for CLI values instead of iterating over TOML array entries separately. This keeps skip codec normalization and empty-token handling in one place while preserving the merged config and CLI behavior. Clarify config debug messages with full TOML key names and include the continue setting in the effective configuration output.
* chore(aur): update Arch Linux packaging submoduleDennis Fink2026-05-23
|
* chore(release): prepare 2.1.0v2.1.0Dennis Fink2026-05-23
|
* docs(readme): fix completion install filenameDennis Fink2026-05-22
| | | | | | | | Update the README installation commands to reference the renamed bash completion script with its .sh extension. This keeps the documented install path in sync with the repository filename so copy-paste installation commands work again.
* docs(devscripts): use runtime defaults in help textDennis Fink2026-05-22
| | | | | | | | | Replace hardcoded generate-testfile help defaults with the current variable values so usage output stays accurate when script defaults change. Format long printf argument lists in developer scripts one value per line to make the placeholders easier to review and maintain.
* style(shell): use function keyword consistentlyDennis Fink2026-05-22
| | | | | | | | Add the function keyword to shell function definitions across the main script, developer scripts, and bash completion file. This makes function declarations visually consistent throughout the project and easier to scan without changing behavior.
* fix(completion): complete long option valuesDennis Fink2026-05-22
| | | | | | | | | | | | Initialize bash completion with -n = so --option=value forms keep the equals sign as part of the current word. This fixes completion for long options that take values with equals syntax, where pressing Tab after --option= previously failed to offer value completions. Update the manual sourcing hint to match the renamed .sh completion file.
* chore(completion): add shell extension to completion fileDennis Fink2026-05-22
| | | | | | | | Rename the bash completion script to use a .sh extension so its file type is clearer in editors and tooling. Keep the completion contents unchanged while making the filename consistent with the script-style files in the repository.
* refactor(encoding): reuse metadata loggingDennis Fink2026-05-22
| | | | | | | | | Extract encode_one metadata output into a helper so dry-run and real encoding paths print the same stream information. Use the shared helper before running ffmpeg as well as during dry runs, making verbose output consistent without duplicating the metadata field list.
* docs(help): use runtime defaults in help textDennis Fink2026-05-22
| | | | | | | | Replace hardcoded help text defaults with the current variable values for hardware acceleration, video stream selection, and ffmpeg loglevel. This keeps --help accurate when defaults change in the script and avoids duplicating default values in the formatted usage output.
* refactor(cli): simplify empty value checksDennis Fink2026-05-22
| | | | | | | | Replace indirect non-empty tests with direct -z checks when validating option values during CLI parsing. This keeps the intent clearer and makes all empty-value guards easier to read without changing the validation behavior.
* feat(streams): allow selecting video probe streamDennis Fink2026-05-22
| | | | | | | | | | | | | | | | | | 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.
* fix(color): propagate color mode to ffmpegDennis Fink2026-05-20
| | | | | | | | | | | | | Export ffmpeg/libav color environment variables alongside transcode.sh color detection so subprocess logs follow the same color mode as the wrapper. Set AV_LOG_FORCE_COLOR when colors are forced or stdout is interactive, and set AV_LOG_FORCE_NOCOLOR when NO_COLOR is present or output is non-interactive. Also propagate explicit --color and --no-color choices so later CLI overrides stay consistent with ffmpeg output.
* style: tidy option ordering and help alignmentDennis Fink2026-05-19
| | | | | | | | Keep CLI sentinel variables and bash completion options ordered consistently so related skip-codec settings stay grouped together. Align the --backup-dir help text spacing with neighboring options for cleaner terminal output.
* feat(output): make ffmpeg loglevel configurableDennis Fink2026-05-19
| | | | | | | | | | | Add --ffmpeg-loglevel so users can choose which ffmpeg messages are shown during encoding instead of always using the built-in default. Load the same setting from [output].ffmpeg_loglevel when it is configured and no CLI value was provided. Document the new option in the README and man page, and add shell completion for supported ffmpeg log levels.
* chore(aur): add Arch Linux packaging submoduleDennis Fink2026-05-17
| | | | | | | | | Add contrib/archlinux as a git submodule pointing to the AUR package repository for transcode.sh. Keep AUR-specific generated files, such as .SRCINFO, tracked separately from the main project while still allowing packaging files to live under contrib.
* chore(release): prepare 2.0.0v2.0.0Dennis Fink2026-05-17
|
* docs(readme): add release metadata markersDennis Fink2026-05-17
| | | | | | | | Add release version and revision date markers to the README so release tooling can update visible project metadata automatically. Expose the current packaged version near the top of the README without changing the rest of the documentation structure.
* feat(presets): add contributed video presetsDennis Fink2026-05-17
| | | | | | | | | | | | Add initial contributed presets for AV1/SVT-AV1, H.264/x264, H.265/x265, and VP9/libvpx-vp9. Provide fast, balanced, and high-quality variants where applicable so users can choose between encode speed, compression efficiency, and visual quality. Include preset descriptions and use derived GOP size and pixel format settings where appropriate for consistent behavior with transcode.sh.
* docs(licensing): add SPDX headersDennis Fink2026-05-16
| | | | | | | | | Add SPDX copyright and license markers to repository metadata and documentation files. Use comment styles appropriate for git attributes, gitignore, the commit message template, README, and justfile so license metadata is visible without changing runtime behavior.
* test(testing): add generated media test filesDennis Fink2026-05-16
| | | | | | | | | | | | Add a developer script that uses ffmpeg lavfi sources to create synthetic video test files without storing binary media in the repository. Allow callers to choose codec, resolution, duration, frame rate, source filter, pixel format, output path, and overwrite behavior from the command line. Expose the generator through just and ignore generated testfiles in git.
* refactor(release): align release script sectionsDennis Fink2026-05-16
| | | | | | | | Split the release helper into clearer section headers that match the main script structure. Move terminal color detection into main execution so function definitions stay grouped together before the executable flow.
* feat(skip): allow overriding config skip codecsDennis Fink2026-05-16
| | | | | | | | | | | Add --skip-codec-override so users can ignore configured skip codecs for a single run and use only codecs provided through --skip-codec. Defer CLI skip-codec parsing until after config loading so the final skip list can be resolved independently of option order. Document the new override behavior in the README and man page, and add shell completion for the new flag.
* feat(backup): add original file backupsDennis Fink2026-05-16
| | | | | | | | | | | | 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.
* fix: allow out-of-range nice adjustmentsDennis Fink2026-05-16
| | | | | | | | | | | | Keep nice validation focused on accepting integer values instead of rejecting values outside the standard -20 to 19 range. Avoid failing early for values that nice itself accepts and clamps internally. This gives users behavior that matches the underlying tool instead of turning a non-error into a transcode.sh usage error. Update help text and README wording to describe the option as a nice adjustment, matching the command behavior.
* refactor: improve script structure readabilityDennis Fink2026-05-16
| | | | | | | | | Add a file structure overview and split the script into clearer section headers so related functions are easier to find. Move main execution below all function definitions and add local subsection comments inside encode_one without changing the script behavior.
* refactor(presets): clarify preset variable namesDennis Fink2026-05-16
| | | | | | | | | Rename generic preset path variables to make the preset loading and listing code easier to read. Use explicit names such as preset_file and preset_name so the code better communicates which values refer to files and which refer to display names.
* chore: add release automationDennis Fink2026-05-15
| | | | | | | | | Add a dedicated release helper so version and revision metadata can be prepared consistently before publishing a new release. Use git attributes to keep developer tooling and repository metadata out of generated source archives. Also ignore the dist directory created during the release process.
* docs: polish README formattingDennis Fink2026-05-15
| | | | | | | | Move the preset security note before the preset path so readers see the warning before creating or sourcing preset files. Align the size report schema header with spaces for cleaner rendered documentation.
* refactor(encode): skip excluded codecs before format checksDennis Fink2026-05-14
| | | | | | | | | Move the skip-codec check directly after codec detection, before validating pixel format and frame rate. This lets files with excluded codecs return early without requiring additional probe fields that are irrelevant when the file will not be encoded.
* refactor(probe): read ffprobe fields without sedDennis Fink2026-05-14
| | | | | | | | | | | Replace three separate `printf | sed` pipelines with a single grouped `read` block fed from the existing ffprobe output. This keeps codec, pixel format, and frame-rate parsing together, avoids extra subprocesses, and makes the field order easier to see at the call site. No runtime behavior is intended to change.
* feat(report): improve size summary outputDennis Fink2026-05-14
| | | | | | | | | | | Track the total encoded output size alongside the original and saved byte counts so the batch summary can show original vs. new totals. Improve size report feedback for larger outputs by printing the byte difference as “larger” instead of showing a negative saved value. Rework the final summary format to include colored encoded, skipped, failed, total-size, and average saving lines, with skipped and failed counts broken down by reason.
* style(shell): prefer explicit conditionals for validationDennis Fink2026-05-14
| | | | | | | | | | | | Replace compact `[[ ... ]] || { ... }` guard blocks with explicit `if` statements in config loading, preset loading, CLI argument validation, size report helpers, and encode-file handling. Rename the local preset variable in `load_preset` to `preset_name` for clearer intent, and simplify the nice-value range check and size-report summary default percentage handling. No runtime behavior is intended to change.
* style(comments): reflow and clarify script commentsDennis Fink2026-05-14
| | | | | | | | | Rewrap long comments throughout transcode.sh for more consistent line length and readability. Clarify a few explanatory comments around filesize formatting, preset descriptions, empty input handling, ffprobe probing, temporary output creation, and output verification. No runtime behavior is changed.
* docs: fix option and help text typosDennis Fink2026-05-14
| | | | | | | | Correct the README entry for the long --encode-file=PATH form, which was documented as --encodefile=PATH. Also fix spacing in the generated help text for output_gop_size so the preset variable descriptions remain aligned.
* refactor(output): centralize formatted terminal messagesDennis Fink2026-05-14
| | | | | | | | | | | | | | | Add a shared emit() helper for styled terminal output and route error(), msg(), warn(), verbose(), and debug() through it. This removes duplicated printf formatting across the output helpers while keeping the existing prefixes, colors, quiet/verbose/debug gating, and stderr handling for errors. emit() also joins additional message arguments into a single trailing string, matching the output pattern used by the individual helpers. The output helpers now differ only in their prefix, color, and visibility condition, making future formatting changes easier and less error-prone.
* feat(size-report): replace savings log with status reportsDennis Fink2026-05-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Rename the old savings log feature to size report across the CLI, configuration, documentation, man page, and bash completion. The new `--size-report` option keeps the existing `-s` shorthand, while `--saving`, `--saving-file`, and the `[saving]` config section are replaced by `--size-report`, `--size-report-file`, and `[size_report]`. Extend reporting beyond successful encodes. The TSV log now gains a leading `status` column and records encoded files, codec skips, only-if-larger skips, and failed inputs. Size-report output also prints per-file feedback for encoded and skipped-larger files, including human-readable original/new sizes, bytes saved, and saved percentage. Track batch-level report counters and print an end-of-run summary for multi-file runs with encoded/skipped/failed counts, total bytes saved, and the overall weighted saving percentage across successful encodes. Document the new TSV schema in the README and man page, update examples and config snippets, and adjust bash completion for the renamed options. BREAKING CHANGE: `--saving` is now `--size-report`. `--saving-file` is now `--size-report-file`. `[saving]` in config.toml is now `[size_report]`. The TSV log gains a leading `status` column and may contain skipped and failed rows in addition to successful encodes.
* refactor(script): improve readability of encoding flowDennis Fink2026-05-14
| | | | | | | | | | | | | | Expand compact shell conditionals into explicit if blocks throughout config loading, codec parsing, cleanup, and file-list handling. Rename short local variables in encode_one to more descriptive names, including the input file, temporary output path, command array, and progress counters. Also align preset-list output with the shared msg helper and update colors for preset names. This makes the main transcoding path easier to read and maintain without changing the intended encoding behaviour.
* refactor(core): remove awk and bc dependenciesDennis Fink2026-05-10
| | | | | | | | | | | | | | | Both tools were used for simple arithmetic that bash handles natively. awk: fps rounding (num/den) replaced with round-half-up integer arithmetic: (num + den/2) / den. bc: savings percentage replaced with bash $(( )) arithmetic. bc was a conditional dependency (only required with --saving), which made the dependency story inconsistent. Removing it means the full feature set is available with only ffmpeg, ffprobe, nice, and optionally tomlq. Updated README requirements table, man page --saving description, SEE ALSO section, and exit-code 127 entry accordingly.
* feat(preset): add --list-presets to enumerate available presetsDennis Fink2026-05-10
| | | | | | | | | | | | | | | | | | | | | | Print all *.sh files found in $PRESET_DIR, one per line, with a one-line description extracted from the first line of each file if it matches a `# description: …` comment. Presets without such a comment are listed without a description. Symlinks pointing to another preset inside $PRESET_DIR are shown as "<name> - Symlinked to <target>" rather than duplicating the description. Symlinks pointing outside $PRESET_DIR are followed and treated as regular preset files. Column width for preset names is calculated from the longest name in the directory so descriptions align with minimal padding. Also extracts the repeated readlink/realpath idiom into a dedicated resolve_path() helper and adds a doc comment to filesize(). Exits immediately after printing (same pattern as --version/--help). Honours --quiet/NO_COLOR via the existing msg() and color infrastructure.
* feat(core,cli): add hardware acceleration support via --hwaccelDennis Fink2026-05-09
| | | | | | | | | | | | | | | | | | | | | Add --hwaccel [METHOD] / --no-hwaccel flags to control whether -hwaccel is passed to ffmpeg before the input file. The METHOD argument is optional and defaults to "auto", letting ffmpeg select the best available hardware decoder with automatic software fallback. Hardware acceleration is enabled by default (method: auto). Users on hosts where hwaccel causes compatibility or stability issues can opt out with --no-hwaccel or config.toml [encoding] hwaccel = false. The config key accepts false (disable), true (auto), or a method string such as "vaapi" or "cuda". CLI flags take precedence as usual. Bash completion is extended with a hwaccel_methods word list (auto, cuda, vaapi, dxva2, d3d11va, videotoolbox, qsv) for both the space form (--hwaccel <TAB>) and the equals form (--hwaccel=<TAB>). The completion script is also reformatted from 4-space to 2-space indentation for consistency with transcode.sh itself.
* refactor(core): remove hardcoded PATH resetDennis Fink2026-05-09
| | | | | | | | | | | | | | | PATH='/bin:/usr/bin:/usr/local/bin' was intended as a security measure against PATH injection. For a script invoked manually in the user's own shell the benefit is marginal: if an attacker controls the user's PATH they already have larger problems. The cost is real — tools installed outside these three directories (Homebrew, Nix, ~/.local/bin) silently fail, and the documented workaround of prepending a path at invocation time does not work because the script overwrites PATH immediately on startup. Remove the PATH reset and all associated documentation. The remaining hardening measures (unalias -a, hash -r, strict set -o flags, umask) are retained.
* feat(core): verify output integrity before replacing originalDennis Fink2026-05-09
| | | | | | | | | | | | | | | | | | | | | | | After ffmpeg exits successfully, run ffprobe against the temporary output file to confirm it is a valid, playable media file before replacing the original. If the probe fails the temporary file is removed and the encode is treated as a runtime failure, leaving the original untouched. This guards against cases where ffmpeg exits 0 but has written a truncated or corrupt container (e.g. due to a disk-full condition mid-write, a codec bug, or a preset producing an unreadable stream). The check is enabled by default and can be disabled via --no-verify-output or [encoding] verify_output = false in config.toml for large batch jobs on trusted encoders where the extra ffprobe round-trip is undesirable. The --continue flag is honoured: a failed integrity check counts as a runtime failure for the purposes of deciding whether to proceed to the next file. Docs, man page, bash completion, and README updated accordingly.