From b8f9d6541bbf433c467b16b641c984d47cc236b2 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Mon, 6 Apr 2026 13:16:28 +0200 Subject: [PATCH] docs: resize output design --- docs/plans/2026-04-06-resize-output-design.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/plans/2026-04-06-resize-output-design.md diff --git a/docs/plans/2026-04-06-resize-output-design.md b/docs/plans/2026-04-06-resize-output-design.md new file mode 100644 index 0000000..5abe7dc --- /dev/null +++ b/docs/plans/2026-04-06-resize-output-design.md @@ -0,0 +1,34 @@ +# Resize Output Design + +## Overview + +Add a user-configurable short-side resize to every exported clip. When set, ffmpeg scales the output so the shorter dimension equals the specified pixel value, preserving aspect ratio. When blank, output is native resolution. + +## UI + +A labeled `QLineEdit` ("Short side:") with placeholder `"px (opt.)"` added to the export row, immediately before the Export button. Value is optional — blank means no resize. + +## Persistence + +`QSettings("8cut", "8cut")` stores the value under key `resize_short_side`. The field is pre-filled on startup and saved on every text change. + +## ffmpeg Command Change + +`build_ffmpeg_command` gains an optional `short_side: int | None = None` parameter. When set, it appends: + +``` +-vf scale='if(lt(iw,ih),N,-2)':'if(lt(iw,ih),-2,N)' +``` + +Where `N` is the short-side value. This selects width for portrait videos and height for landscape videos. `-2` maintains aspect ratio with even-pixel rounding (required by libx264). + +No `-vf` flag is added when `short_side` is `None`. + +## Parsing + +`MainWindow._on_export` reads the field, strips whitespace, and attempts `int()` conversion. Any non-positive or non-numeric value is treated as no resize (passes `None` to `build_ffmpeg_command`). + +## Testing + +- `test_ffmpeg_command_no_resize` — existing test, verify no `-vf` in output +- `test_ffmpeg_command_with_resize` — pass `short_side=256`, verify `-vf` and the scale expression appear in the command