Skip to content

ReShot — copy the shot, not the actors. Video → depth map, OpenPose skeleton or canny lines for Seedance 2.0/2.5 reference video, MiniMax H3 Fun ControlNet and Wan VACE. Apache-2.0. Open-sourced by Maosika 猫斯卡 (www.maosika.com), the AI short-drama production system.

0.3.6: --quality fast is the default (model sees 644x364 for 16:9); resolutions written out in full everywhere; run prints the exact model resolution

wangfeng7f1a472f2ca5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 05525f6..cabcac6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## 0.3.6 — 2026-09-12
+- **`--quality fast` is the default** (the model sees 644×364 for 16:9, 364×644 for 9:16;
+ ~3 GB VRAM, 34 ms/frame on a 3080 Ti). `full` (924×518 / 518×924, ~11 GB) is the user's
+ choice; asking for it on a card under 11.5 GB prints a warning first. `auto` is gone.
+- The run prints and records (`model_input_resolution` in metrics) the exact resolution the
+ model works at; `model_input_resolution()` is public.
+
## 0.3.5 — 2026-09-12
- **`--quality auto|full|fast`** replaces the silent small-GPU fallback of 0.3.4: `full` is 518 px,
`fast` 364 px, `auto` (default) picks by VRAM and says which it chose. `--input-size` stays as
diff --git a/README.md b/README.md
index 37e0f10..a719507 100644
--- a/README.md
+++ b/README.md
@@ -102,13 +102,20 @@ Things we learned making the demo:
| | Runs? | Measured |
|---|---|---|
-| **NVIDIA, 12 GB or more** (RTX 3080 Ti, 4070, 4090 …) | Yes, `--quality full` | 4090: 62 ms/frame, 11 GB VRAM peak · 3080 Ti: 83 ms/frame |
-| **NVIDIA, 8 GB** (RTX 3070, 4060 …) | Yes, `--quality fast` (picked automatically) | 3 GB VRAM, 34 ms/frame on a 3080 Ti |
+| **NVIDIA, 8 GB or more** (RTX 3070, 4060, 4090 …) | Yes | default `--quality fast`: 3 GB VRAM, 34 ms/frame on a 3080 Ti |
+| **NVIDIA, 12 GB or more** | Yes, and `--quality full` fits too | full: 11 GB VRAM, 83 ms/frame on a 3080 Ti, 62 ms/frame on a 4090 |
| **Apple Silicon** | Yes, slower | M2 Max: ~500 ms/frame, a 12 s clip in about 2.5 min |
| **CPU only** | Yes, slow | ~1.8 s/frame |
| **Host RAM** | 16 GB covers clips up to ~27 s at 720p | peak = 2 GB + 224 MB per second of 720p; the tool refuses before starting if a clip won't fit |
-**`--quality`** is yours to choose: `auto` (default) takes `full` on cards with 11.5 GB or more and `fast` below that; pass `full` or `fast` to decide yourself. The difference, measured on the same 294-frame clip: the model sees the frame at 518 px vs 364 px on the short side; large shapes — people, props, who is nearer — come out identical, fine detail is softer at `fast` (a loose strand of hair merges into the cheek). Mean difference 5.3 of 255 grey levels, 95 % of pixels within 15, edge energy −4.5 %. For copying blocking and camera, `fast` is enough; for close-ups where fine silhouettes matter, use `full`. Experts can set the exact size with `--input-size`.
+**`--quality` — the resolution the model works at.** The output video is always the size of your source; this sets the size of the picture the depth model looks at.
+
+| `--quality` | model sees (16:9 · 9:16 · 4:3) | VRAM | speed | detail |
+|---|---|---|---|---|
+| `fast` (default) | 644×364 · 364×644 · 490×364 | ~3 GB | 34 ms/frame on a 3080 Ti | large shapes identical to full; a loose strand of hair merges into the cheek |
+| `full` | 924×518 · 518×924 · 686×518 | ~11 GB | 83 ms/frame on a 3080 Ti | sharper fine silhouettes |
+
+We recommend `fast`: for copying blocking and camera it is all a video model needs — the demo takes were made from a depth map shrunk to 320×176 before it even reached MiniMax H3, far below either setting. Measured full against fast on the same 294-frame clip: mean difference 5.3 of 255 grey levels, 95 % of pixels within 15, edge energy −4.5 %. Use `full` for close-ups where thin silhouettes matter and you have the VRAM. The run prints the exact resolution it uses (`model fast: the model sees 644x364`) and records it in `--metrics`. Experts can set any short side with `--input-size`.
Verified on rented cards on 2026-09-12; the numbers are in the `--metrics` output of those runs.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 4b5294f..fb3f8f0 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -102,13 +102,20 @@ is transferred onto <Subject 1> and <Subject 2>; its grey depth look is not tran
| | 能不能跑 | 实测 |
|---|---|---|
-| **N 卡 12 GB 及以上**(RTX 3080 Ti、4070、4090……) | 能,`--quality full` | 4090:62 ms/帧、显存峰值 11 GB;3080 Ti:83 ms/帧 |
-| **N 卡 8 GB**(RTX 3070、4060……) | 能,`--quality fast`(自动选) | 显存 3 GB、3080 Ti 上 34 ms/帧 |
+| **N 卡 8 GB 及以上**(RTX 3070、4060、4090……) | 能 | 默认 `--quality fast`:显存 3 GB、3080 Ti 上 34 ms/帧 |
+| **N 卡 12 GB 及以上** | 能,`--quality full` 也放得下 | full:显存 11 GB、3080 Ti 上 83 ms/帧、4090 上 62 ms/帧 |
| **Apple 芯片** | 能,慢 | M2 Max 约 500 ms/帧,12 秒的片约 2.5 分钟 |
| **纯 CPU** | 能,很慢 | 约 1.8 秒/帧 |
| **内存** | 16 GB 能跑 720p 约 27 秒 | 峰值 = 2 GB + 每秒 720p 约 224 MB;放不下会在开始之前拒绝 |
-**`--quality` 由你定**:`auto`(默认)在 11.5 GB 以上的卡取 `full`、以下取 `fast`;想自己定就直接传 `full` 或 `fast`。两者的差别(同一段 294 帧的片实测):模型看到的画面短边 518 像素还是 364 像素;大形状——人、道具、谁近谁远——两边一模一样,细的东西 `fast` 会软(脸颊旁一缕头发会糊进脸里)。平均差 5.3 个灰阶(满量程 255),95% 的像素差在 15 以内,边缘锐度低 4.5%。复制走位和运镜,`fast` 够用;特写里在意细轮廓,用 `full`。要精确尺寸用 `--input-size`。
+**`--quality`——模型工作的分辨率。** 输出视频永远和原片一样大;这个选项定的是深度模型看到的那张图有多大。
+
+| `--quality` | 模型看到的画面(16:9 · 9:16 · 4:3) | 显存 | 速度 | 细节 |
+|---|---|---|---|---|
+| `fast`(默认) | 644×364 · 364×644 · 490×364 | 约 3 GB | 3080 Ti 上 34 ms/帧 | 大形状与 full 一模一样;脸颊旁一缕散发会糊进脸里 |
+| `full` | 924×518 · 518×924 · 686×518 | 约 11 GB | 3080 Ti 上 83 ms/帧 | 细轮廓更锐 |
+
+我们推荐 `fast`:复制走位和运镜,视频模型要的它全有——演示里的三段片,深度图交给 MiniMax H3 之前还缩到了 320×176,比这两档都小得多。同一段 294 帧的片上 full 对 fast 实测:平均差 5.3 个灰阶(满量程 255),95% 的像素差在 15 以内,边缘锐度低 4.5%。特写里在意细轮廓、显存又够,再用 `full`。运行时会打印实际用的分辨率(`model fast: the model sees 644x364`),也写进 `--metrics`。要指定任意短边用 `--input-size`。
2026-09-12 在租来的显卡上实测;数字都在那几次运行的 `--metrics` 输出里。
diff --git a/demo/requirements.txt b/demo/requirements.txt
index 549442d..b324591 100644
--- a/demo/requirements.txt
+++ b/demo/requirements.txt
@@ -1,5 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cpu
torch
torchvision
-reshot[ffmpeg] @ git+https://github.com/maosika-ai/[email protected]
+reshot[ffmpeg] @ git+https://github.com/maosika-ai/[email protected]
gradio>=4.0
diff --git a/demo/space/index.html b/demo/space/index.html
index 6de5313..e35f1d5 100644
--- a/demo/space/index.html
+++ b/demo/space/index.html
@@ -82,8 +82,9 @@ reshot reference.mp4 -o depth.mp4 --target seedance</code></pre>
<h2>Measured <span class="zh">/ 实测</span></h2>
<table>
<tr><th>device</th><th>ms / frame</th><th>host RAM</th></tr>
-<tr><td>RTX 4090, fp16</td><td>62 (<code>--quality full</code>, 11 GB VRAM)</td><td>3.9 GB</td></tr>
-<tr><td>RTX 3080 Ti, fp16</td><td>83 full · 34 <code>--quality fast</code> (3 GB VRAM)</td><td>3.5 GB</td></tr>
+<tr><td>RTX 3080 Ti, <code>--quality fast</code> (default, model sees 644×364)</td><td>34 · 3 GB VRAM</td><td>2.3 GB</td></tr>
+<tr><td>RTX 3080 Ti, <code>--quality full</code> (model sees 924×518)</td><td>83 · 11 GB VRAM</td><td>3.5 GB</td></tr>
+<tr><td>RTX 4090, <code>--quality full</code></td><td>62 · 11 GB VRAM</td><td>3.9 GB</td></tr>
<tr><td>Apple M2 Max, fp32</td><td>~500</td><td>~4 GB</td></tr>
</table>
diff --git a/docs/USAGE.md b/docs/USAGE.md
index 08dd74a..ab8539a 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -41,7 +41,7 @@ reshot INPUT -o OUTPUT [options]
|---|---|---|
| `--model small\|base\|large` | `small` | Only `small` is Apache-2.0. `base`/`large` are CC-BY-NC-4.0: allowed for research, a warning is printed. |
| `--device auto\|cuda\|mps\|cpu` | `auto` | fp16 on CUDA, fp32 elsewhere (fp16 on MPS is unusably slow). |
-| `--quality Q` | `auto` | `full` = model sees 518 px on the short side (~11 GB VRAM), `fast` = 364 px (~3 GB, 2× faster, fine detail softer: mean Δ 5.3/255, edges −4.5 %). `auto` = full on ≥ 11.5 GB cards, fast below. |
+| `--quality Q` | `fast` | Resolution the model works at. `fast` = 644×364 for 16:9 / 364×644 for 9:16 (~3 GB VRAM); `full` = 924×518 / 518×924 (~11 GB, 2.5× slower, sharper fine detail: mean Δ 5.3/255, edges −4.5 %). Output size is unaffected. |
| `--input-size N` | — | Expert: exact model short side, multiple of 14; overrides `--quality`. |
| `--checkpoint PATH` | – | Local `.pth`, skips the download. |
@@ -208,8 +208,9 @@ input video ─▶ probe ─▶ plan (sizes, frames, RAM) ─▶ decode at model
- **Model**: [Video Depth Anything](https://github.com/DepthAnything/Video-Depth-Anything)
(CVPR 2025). Its temporal module is what keeps the depth stable across frames; single-image
models flicker. The model code is vendored unmodified (two import lines) under `third_party/`.
-- **Resolution**: the model works on a 518-px short side. Feeding larger frames only inflates the
- float depth kept per frame; reshot decodes at that size and upscales the 8-bit result.
+- **Resolution**: the model works at `--quality` size — 644×364 (fast) or 924×518 (full) for a 16:9
+ clip. Feeding larger frames only inflates the float depth kept per frame; reshot decodes at that
+ size and upscales the 8-bit result to the source size.
- **Normalisation**: `(d − min) / (max − min)` over *all* frames; optional percentile clip.
- **Encoding**: `libx264 -crf 12 -pix_fmt yuv420p -g 2·fps -movflags +faststart`.
diff --git a/docs/USAGE.zh-CN.md b/docs/USAGE.zh-CN.md
index d0b7da1..d0ad35c 100644
--- a/docs/USAGE.zh-CN.md
+++ b/docs/USAGE.zh-CN.md
@@ -40,7 +40,7 @@ reshot 输入 -o 输出 [选项]
|---|---|---|
| `--model small\|base\|large` | `small` | 只有 `small` 是 Apache-2.0。`base`/`large` 是 CC-BY-NC-4.0:研究可用,运行时会警告。 |
| `--device auto\|cuda\|mps\|cpu` | `auto` | CUDA 用 fp16,其余 fp32(MPS 上 fp16 慢到不可用)。 |
-| `--quality Q` | `auto` | `full` = 模型看短边 518 像素(约 11 GB 显存),`fast` = 364 像素(约 3 GB、快一倍、细节略软:平均差 5.3/255、边缘 −4.5%)。`auto` = ≥11.5 GB 的卡取 full、以下取 fast。 |
+| `--quality Q` | `fast` | 模型工作的分辨率。`fast` = 16:9 是 644×364、9:16 是 364×644(约 3 GB 显存);`full` = 924×518 / 518×924(约 11 GB、慢 2.5 倍、细轮廓更锐:平均差 5.3/255、边缘 −4.5%)。不影响输出尺寸。 |
| `--input-size N` | — | 专家用:精确指定模型短边,14 的倍数,覆盖 `--quality`。 |
| `--checkpoint 路径` | – | 本地 `.pth`,跳过下载。 |
@@ -197,7 +197,7 @@ MPS 上 fp16 跑不完,所以强制 fp32。736×1280 约 0.5 秒/帧,12 秒
- **模型**:[Video Depth Anything](https://github.com/DepthAnything/Video-Depth-Anything)(CVPR 2025)。
它的时序模块是深度不闪的原因;单图模型逐帧跑必闪。模型代码原样 vendored 在 `third_party/`(只改两行 import)。
-- **分辨率**:模型工作在短边 518 px。喂更大的帧只会让每帧存的浮点深度变大;reshot 按这个尺寸解码,放大的是 8 位结果。
+- **分辨率**:模型工作在 `--quality` 定的尺寸——16:9 的片 fast 是 644×364、full 是 924×518。喂更大的帧只会让每帧存的浮点深度变大;reshot 按这个尺寸解码,最后把 8 位结果放大回原片尺寸。
- **归一化**:`(d − min) / (max − min)` 对**全部帧**做一次;可选百分位裁剪。
- **编码**:`libx264 -crf 12 -pix_fmt yuv420p -g 2·fps -movflags +faststart`。
diff --git a/reshot/__init__.py b/reshot/__init__.py
index 39bc9ca..149ee07 100644
--- a/reshot/__init__.py
+++ b/reshot/__init__.py
@@ -23,7 +23,7 @@ from ._version import __version__
from .config import RunConfig
from .errors import BackendError, InputError, RamBudgetError, ReshotError, ToolMissingError
from .io import probe_video, read_video, write_gray_video
-from .pipeline import Plan, RunResult, extract, plan, resolve_input_size, run, run_many
+from .pipeline import Plan, RunResult, extract, model_input_resolution, plan, resolve_input_size, run, run_many
from .planning import memory_verdict, processing_max_res
from .postprocess import to_gray, upsample_frames
from .targets import TARGETS, Target, center_crop, fit_dimensions
@@ -44,6 +44,7 @@ __all__ = [
"extract",
"fit_dimensions",
"memory_verdict",
+ "model_input_resolution",
"plan",
"probe_video",
"processing_max_res",
diff --git a/reshot/_version.py b/reshot/_version.py
index a8d4557..d7b30e1 100644
--- a/reshot/_version.py
+++ b/reshot/_version.py
@@ -1 +1 @@
-__version__ = "0.3.5"
+__version__ = "0.3.6"
diff --git a/reshot/cli.py b/reshot/cli.py
index 954f0ff..a030cbf 100644
--- a/reshot/cli.py
+++ b/reshot/cli.py
@@ -49,10 +49,10 @@ def build_parser() -> argparse.ArgumentParser:
g.add_argument("--device", default="auto", help="auto | cuda | mps | cpu")
g.add_argument(
"--quality",
- default="auto",
+ default="fast",
choices=QUALITIES,
- help="full = model sees 518 px (needs ~11 GB VRAM), fast = 364 px (~3 GB, 2× faster, softer fine detail); "
- "auto picks by GPU size (default)",
+ help="what the model sees: fast = 644x364 for 16:9 / 364x644 for 9:16, ~3 GB VRAM (default); "
+ "full = 924x518 / 518x924, ~11 GB VRAM, 2.5x slower, sharper fine detail",
)
g.add_argument(
"--input-size",
diff --git a/reshot/config.py b/reshot/config.py
index e0408fd..345b655 100644
--- a/reshot/config.py
+++ b/reshot/config.py
@@ -11,7 +11,7 @@ from .errors import InputError
from .targets import TARGETS
MODEL_VARIANTS = ("small", "base", "large")
-QUALITIES = ("auto", "full", "fast") # model working size: auto = by VRAM, full = 518, fast = 364
+QUALITIES = ("fast", "full") # model working size: fast = 644×364 for 16:9 (default), full = 924×518
BACKENDS = ("vda", "fake")
@@ -26,7 +26,7 @@ class RunConfig:
fps: float | None = None # None = preset or source
max_res: int = 1280 # cap on the OUTPUT's longer side
max_frames: int | None = None
- quality: str = "auto" # auto | full | fast — see QUALITIES; `input_size` overrides it
+ quality: str = "fast" # fast | full — see QUALITIES; `input_size` overrides it
input_size: int | None = None # model short side (multiple of 14); expert override of `quality`
invert: bool = False
clip_percent: float = 0.0
diff --git a/reshot/pipeline.py b/reshot/pipeline.py
index ef145d0..cac55e3 100644
--- a/reshot/pipeline.py
+++ b/reshot/pipeline.py
@@ -79,7 +79,7 @@ class RunResult:
def _planning_input_size(cfg: RunConfig) -> int:
if cfg.input_size is not None:
return cfg.input_size
- return QUALITY_INPUT_SIZE.get(cfg.quality, QUALITY_INPUT_SIZE["full"])
+ return QUALITY_INPUT_SIZE[cfg.quality]
def plan(cfg: RunConfig) -> Plan:
@@ -105,8 +105,6 @@ def plan(cfg: RunConfig) -> Plan:
# from a thumbnail. The three demo takes were made from full-resolution depth
# downscaled afterwards, which is what this now does.
cap = cfg.max_res if cfg.max_res > 0 else 10**9
- # RAM planning uses the largest size `quality` may resolve to (auto → full), so the
- # estimate is never below what a big card will actually do.
proc_max_res = processing_max_res(src_w, src_h, _planning_input_size(cfg))
scale = min(1.0, proc_max_res / max(src_w, src_h))
proc_w, proc_h = (int(round(src_w * scale / 2) * 2), int(round(src_h * scale / 2) * 2))
@@ -222,6 +220,8 @@ def _run_one(cfg: RunConfig, rep: Reporter, backend, backend_name: str) -> RunRe
f"{backend.info.name}/{backend.info.variant} on {backend.device} ({precision}), licence {backend.info.license}",
)
input_size = resolve_input_size(cfg, backend.device, rep)
+ mw, mh = model_input_resolution(w, h, input_size)
+ rep.step("model", f"{cfg.quality if cfg.input_size is None else 'custom'}: the model sees {mw}x{mh}")
t1 = time.time()
depths = backend.infer(frames, fps, input_size=input_size)
depth_seconds = time.time() - t1
@@ -267,6 +267,7 @@ def _run_one(cfg: RunConfig, rep: Reporter, backend, backend_name: str) -> RunRe
"frames": t,
"fps": fps,
"input_size_used": input_size,
+ "model_input_resolution": [mw, mh],
"depth_seconds": round(depth_seconds, 3),
"ms_per_frame": round(depth_seconds / t * 1000, 1),
"total_seconds": round(total, 2),
@@ -315,14 +316,17 @@ def extract(
return backend.infer(frames, fps, input_size=input_size), fps
-#: Model working size (short side) per quality. Measured 2026-09-12 on an RTX 3080 Ti (12 GB),
-#: 294 frames of 736×1280:
-#: full 518 → 7.4 GiB allocated / 10.9 GiB reserved, 83 ms/frame; OOMs on an 8 GB card
-#: fast 364 → 2.25 / 3.0 GiB, 34 ms/frame; runs on 6 GB
+#: Model working size (short side) per quality. What the model actually sees, for common
+#: clips (long side rounded to a multiple of 14 by the model's own resize):
+#: fast 364 → 644×364 (16:9) · 364×644 (9:16) · 490×364 (4:3) — the default
+#: full 518 → 924×518 (16:9) · 518×924 (9:16) · 686×518 (4:3)
+#: Measured 2026-09-12 on an RTX 3080 Ti (12 GB), 294 frames of 736×1280:
+#: fast → 2.25 GiB allocated / 3.0 GiB reserved, 34 ms/frame; runs on 6 GB
+#: full → 7.4 / 10.9 GiB, 83 ms/frame; OOMs on an 8 GB card
#: Against each other over the whole clip: mean |Δ| 5.3 grey levels, 95th percentile 15,
-#: edge energy −4.5 % — large shapes identical, fine detail (a strand of hair) softer at 364.
-QUALITY_INPUT_SIZE = {"full": 518, "fast": 364}
-VRAM_FULL_SIZE_MIN_BYTES = int(11.5 * 2**30) # below this, `auto` picks fast
+#: edge energy −4.5 % — large shapes identical, fine detail (a strand of hair) softer at fast.
+QUALITY_INPUT_SIZE = {"fast": 364, "full": 518}
+VRAM_FULL_SIZE_MIN_BYTES = int(11.5 * 2**30) # `full` below this gets a warning up front
def _cuda_total_bytes(device: str) -> int:
@@ -337,26 +341,43 @@ def _cuda_total_bytes(device: str) -> int:
return 0
-def resolve_input_size(cfg: RunConfig, device: str, rep: Reporter | None = None) -> int:
- """What the model will actually see, from `quality` / `input_size` / the GPU.
+def model_input_resolution(width: int, height: int, input_size: int) -> tuple[int, int]:
+ """`(w, h)` the model will actually see for a `width×height` frame at `input_size`.
+
+ Same arithmetic as the vendored model's resize (short side → input_size, long side
+ rounded to a multiple of 14, and the model's own trim for clips wider than 16:9), so
+ the number we print is the number that happens."""
+ from .third_party.video_depth_anything.util.transform import Resize
+
+ ratio = max(width, height) / min(width, height)
+ if ratio > 1.78: # mirrors video_depth.py
+ input_size = round(int(input_size * 1.777 / ratio) / 14) * 14
+ r = Resize(
+ width=input_size,
+ height=input_size,
+ resize_target=False,
+ keep_aspect_ratio=True,
+ ensure_multiple_of=14,
+ resize_method="lower_bound",
+ )
+ w, h = r.get_size(width, height)
+ return int(w), int(h)
- Precedence: an explicit `input_size` wins; then `quality` full/fast; `auto` is full on
- a card with ≥ 11.5 GB (or anything that is not CUDA) and fast below that, and says so.
- """
+
+def resolve_input_size(cfg: RunConfig, device: str, rep: Reporter | None = None) -> int:
+ """What the model will work at, from `quality` / `input_size`; warns when `full` is
+ asked of a GPU that is known to be too small for it (the run still proceeds — it is
+ the user's call — but the OOM will not be a surprise)."""
rep = rep or NullReporter()
- if cfg.input_size is not None:
- return cfg.input_size
- if cfg.quality in QUALITY_INPUT_SIZE:
- return QUALITY_INPUT_SIZE[cfg.quality]
+ size = cfg.input_size if cfg.input_size is not None else QUALITY_INPUT_SIZE[cfg.quality]
total = _cuda_total_bytes(device)
- if total and total < VRAM_FULL_SIZE_MIN_BYTES:
+ if total and total < VRAM_FULL_SIZE_MIN_BYTES and size > QUALITY_INPUT_SIZE["fast"]:
rep.step(
- "quality",
- f"auto → fast on a {gib(total)} GPU (full needs ~11 GB; fast ~3 GB, 2× faster, "
- f"softer fine detail). Force it with --quality full.",
+ "warn",
+ f"{gib(total)} GPU: --quality full needs ~11 GB of VRAM and will likely run out; "
+ f"--quality fast (the default) needs ~3 GB",
)
- return QUALITY_INPUT_SIZE["fast"]
- return QUALITY_INPUT_SIZE["full"]
+ return size
def _license_ok(metrics: dict) -> bool:
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index 52d0fe8..00e3a58 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -85,8 +85,10 @@ def test_max_res_caps_output_not_inference(tmp_path):
"""`--max-res` must not shrink what the model sees (0.3.2 regression lock: a 320-px cap
used to feed the model a thumbnail that it upsampled internally)."""
src = _clip(tmp_path / "src.mp4", frames=4, w=1280, h=736)
- p = plan(RunConfig(input=src, output=tmp_path / "o.mp4", backend="fake", target="h3", max_res=320))
+ p = plan(RunConfig(input=src, output=tmp_path / "o.mp4", backend="fake", target="h3", max_res=320, quality="full"))
assert p.proc_h == 518 and p.proc_w == 900 # model resolution
+ p = plan(RunConfig(input=src, output=tmp_path / "o.mp4", backend="fake", target="h3", max_res=320))
+ assert p.proc_h == 364 # default quality is fast
assert (p.out_w, p.out_h) == (320, 160) # output capped, multiple of 32
@@ -127,27 +129,36 @@ def test_cli_batch_loads_model_once_and_skips_bad_clip(tmp_path, monkeypatch):
def test_quality_resolution(tmp_path, monkeypatch):
- """auto: full on a big card, fast on a small one; full/fast are the user's call regardless;
- an explicit --input-size beats everything."""
+ """fast is the default; full is the user's call (with a warning on a small card);
+ an explicit --input-size beats --quality."""
import reshot.pipeline as pl
def cfg(**kw):
return RunConfig(input=tmp_path / "x.mp4", output=tmp_path / "y.mp4", backend="fake", **kw)
- monkeypatch.setattr(pl, "_cuda_total_bytes", lambda device: 8 * 2**30)
steps = []
class Rep:
def step(self, tag, msg):
steps.append(tag)
- assert pl.resolve_input_size(cfg(), "cuda", Rep()) == 364 and steps == ["quality"]
- assert pl.resolve_input_size(cfg(quality="full"), "cuda") == 518 # user insists
- assert pl.resolve_input_size(cfg(quality="fast"), "cuda") == 364
+ monkeypatch.setattr(pl, "_cuda_total_bytes", lambda device: 8 * 2**30)
+ assert pl.resolve_input_size(cfg(), "cuda", Rep()) == 364 and steps == []
+ assert pl.resolve_input_size(cfg(quality="full"), "cuda", Rep()) == 518 and steps == ["warn"]
assert pl.resolve_input_size(cfg(input_size=700), "cuda") == 700
monkeypatch.setattr(pl, "_cuda_total_bytes", lambda device: 24 * 2**30)
- assert pl.resolve_input_size(cfg(), "cuda") == 518
- assert pl.resolve_input_size(cfg(), "cpu") == 518
- assert pl.resolve_input_size(cfg(quality="fast"), "cpu") == 364
+ steps.clear()
+ assert pl.resolve_input_size(cfg(quality="full"), "cuda", Rep()) == 518 and steps == []
+ assert pl.resolve_input_size(cfg(), "cpu") == 364
with pytest.raises(InputError):
- cfg(quality="ultra")
+ cfg(quality="auto")
+
+
+def test_model_input_resolution_matches_the_vendored_resize():
+ """The resolutions printed in the docs are the ones the model really sees."""
+ from reshot.pipeline import model_input_resolution as mir
+
+ assert mir(1280, 720, 364) == (644, 364) and mir(1280, 720, 518) == (924, 518)
+ assert mir(720, 1280, 364) == (364, 644) and mir(720, 1280, 518) == (518, 924)
+ assert mir(1024, 768, 364) == (490, 364) and mir(1024, 768, 518) == (686, 518)
+ assert mir(1080, 1080, 518) == (518, 518)