Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

fix(engines): Smart Fit speed limits, cheap sidecar ping, accurate GGUF docs

velixio7440b29b2634
diff --git a/CHANGELOG.md b/CHANGELOG.md
index abbe0d4ad..034e86fd3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,9 +15,15 @@ metadata and the backend fallback mirror it.
### Added
- Preview iOS and Android companion apps: drive your own VoiceStudio from your phone (speak, voices and cloning, dubbing, dictation) after pairing by QR code; build from source for now ([guide](docs/mobile.md)) (#2965)
+- Smart Fit speed limits: set the fastest and slowest speed dubbing may apply to a line, from the Timing section (#PRNUM) — thanks @MoonDragon-MD!
+
+### Fixed
+
+- Engine sidecars no longer load PyTorch just to answer the Test Engine ping, and a failed test logs its reason locally (#PRNUM) — thanks @tekay-de!
### Docs
+- OmniVoice GGUF docs state that the installers do not ship its native binary yet (#PRNUM) — thanks @DestinyQJY!
- Contributor guides and the pull request template explain how to sign the CLA before opening a first pull request (#2676)
### CI
diff --git a/backend/api/routers/dub_generate.py b/backend/api/routers/dub_generate.py
index 2f94dca34..2adc768c3 100644
--- a/backend/api/routers/dub_generate.py
+++ b/backend/api/routers/dub_generate.py
@@ -1580,7 +1580,11 @@ async def dub_generate(job_id: str, req: DubRequest):
video_slow_cap=float(getattr(_fo, "video_slow_cap", None) or _fit_defaults.video_slow_cap),
gap_guard_s=float(_fo.gap_guard_s) if _fo is not None and _fo.gap_guard_s is not None else _fit_defaults.gap_guard_s,
allow_video_retime=bool(_fo.allow_video_retime) if _fo is not None and _fo.allow_video_retime is not None else _fit_defaults.allow_video_retime,
- min_audio_rate=_underrun_min_rate(),
+ min_audio_rate=(
+ float(_fo.min_audio_rate)
+ if _fo is not None and _fo.min_audio_rate is not None
+ else _underrun_min_rate()
+ ),
)
fit_plan = plan_fit(
[
@@ -1912,6 +1916,7 @@ async def dub_generate(job_id: str, req: DubRequest):
"video_slow_cap": fit_params.video_slow_cap,
"gap_guard_s": fit_params.gap_guard_s,
"allow_video_retime": fit_params.allow_video_retime,
+ "min_audio_rate": fit_params.min_audio_rate,
}
fit_fp = fit_fingerprint(_fit_params_payload)
job.setdefault("fit_plans", {})[lang_code] = {
diff --git a/backend/engines/confucius4/main.py b/backend/engines/confucius4/main.py
index 20bc5c1e0..8b197abf7 100644
--- a/backend/engines/confucius4/main.py
+++ b/backend/engines/confucius4/main.py
@@ -68,7 +68,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
try:
- import torch
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return round(torch.cuda.memory_allocated() / (1024 ** 2), 1)
except Exception:
diff --git a/backend/engines/cosyvoice_subprocess/main.py b/backend/engines/cosyvoice_subprocess/main.py
index d41e08dec..9c021019e 100644
--- a/backend/engines/cosyvoice_subprocess/main.py
+++ b/backend/engines/cosyvoice_subprocess/main.py
@@ -79,8 +79,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
try:
- import torch # noqa: PLC0415
-
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return float(torch.cuda.memory_allocated()) / (1024 * 1024)
except Exception: # noqa: BLE001 — a probe, never fatal
diff --git a/backend/engines/dots_tts/main.py b/backend/engines/dots_tts/main.py
index 035b69d01..fe7ff3e16 100644
--- a/backend/engines/dots_tts/main.py
+++ b/backend/engines/dots_tts/main.py
@@ -82,7 +82,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
"""This sidecar's own GPU memory in MB (MM2-08). 0 on CPU. Never raises."""
try:
- import torch
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return round(torch.cuda.memory_allocated() / (1024 ** 2), 1)
except Exception:
diff --git a/backend/engines/indextts/main.py b/backend/engines/indextts/main.py
index db07de1c6..2d19cf7dc 100644
--- a/backend/engines/indextts/main.py
+++ b/backend/engines/indextts/main.py
@@ -85,7 +85,11 @@ def _measure_vram_mb() -> float:
(MM2-08). The parent can't see a child's VRAM, so we self-report it in the
pong. Degrades to 0 on CPU / when torch isn't loaded yet — never raises."""
try:
- import torch # already a dep inside the indextts venv
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return round(torch.cuda.memory_allocated() / (1024 ** 2), 1)
mps = getattr(torch.backends, "mps", None)
diff --git a/backend/engines/moss_tts_nano_subprocess/main.py b/backend/engines/moss_tts_nano_subprocess/main.py
index b86199cc3..9a11fc9f4 100644
--- a/backend/engines/moss_tts_nano_subprocess/main.py
+++ b/backend/engines/moss_tts_nano_subprocess/main.py
@@ -71,8 +71,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
try:
- import torch # noqa: PLC0415
-
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return float(torch.cuda.memory_allocated()) / (1024 * 1024)
except Exception: # noqa: BLE001 — a probe, never fatal
diff --git a/backend/engines/moss_tts_v15/main.py b/backend/engines/moss_tts_v15/main.py
index e52bc2b72..6531306c1 100644
--- a/backend/engines/moss_tts_v15/main.py
+++ b/backend/engines/moss_tts_v15/main.py
@@ -122,7 +122,11 @@ def _measure_vram_mb() -> float:
"""This sidecar's own GPU memory in MB (MM2-08). The parent can't see a
child's VRAM, so we self-report it in the pong. 0 on CPU. Never raises."""
try:
- import torch
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return round(torch.cuda.memory_allocated() / (1024 ** 2), 1)
except Exception:
diff --git a/backend/engines/omnivoice_subprocess/main.py b/backend/engines/omnivoice_subprocess/main.py
index 6bb3b45c8..2181584e6 100644
--- a/backend/engines/omnivoice_subprocess/main.py
+++ b/backend/engines/omnivoice_subprocess/main.py
@@ -94,7 +94,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
"""This sidecar's own GPU memory in MB. 0 on CPU. Never raises."""
try:
- import torch
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return round(torch.cuda.memory_allocated() / (1024 ** 2), 1)
mps = getattr(torch.backends, "mps", None)
diff --git a/backend/engines/voxcpm2_subprocess/main.py b/backend/engines/voxcpm2_subprocess/main.py
index 438d8af82..fd20d858a 100644
--- a/backend/engines/voxcpm2_subprocess/main.py
+++ b/backend/engines/voxcpm2_subprocess/main.py
@@ -76,8 +76,11 @@ def _recv(stream):
def _measure_vram_mb() -> float:
try:
- import torch # noqa: PLC0415
-
+ # A ping must stay cheap: importing torch here can take a long time on a cold
+ # start (#2837). Until the model has loaded, nothing is allocated.
+ torch = sys.modules.get("torch")
+ if torch is None:
+ return 0.0
if torch.cuda.is_available():
return float(torch.cuda.memory_allocated()) / (1024 * 1024)
except Exception: # noqa: BLE001 — a probe, never fatal
diff --git a/backend/schemas/requests.py b/backend/schemas/requests.py
index 818abd042..3ddb4df07 100644
--- a/backend/schemas/requests.py
+++ b/backend/schemas/requests.py
@@ -57,6 +57,9 @@ class FitOptions(BaseModel):
audio_rate_cap: Optional[float] = None # default 1.5
video_slow_cap: Optional[float] = None # default 2.0
gap_guard_s: Optional[float] = None # default 0.05
+ # Floor for slowing a short line toward its slot; 1.0 turns the fill off.
+ # Default is the server's OMNIVOICE_UNDERRUN_MIN_RATE (0.85).
+ min_audio_rate: Optional[float] = Field(default=None, ge=0.5, le=1.0)
allow_video_retime: Optional[bool] = None # default True
class DubRequest(BaseModel):
diff --git a/backend/services/incremental.py b/backend/services/incremental.py
index 3a3359c9b..d181dc067 100644
--- a/backend/services/incremental.py
+++ b/backend/services/incremental.py
@@ -123,6 +123,9 @@ _FIT_PARAM_DEFAULTS = {
}
+_MIN_AUDIO_RATE_DEFAULT = 0.85 # mirrors FitParams.min_audio_rate
+
+
def fit_fingerprint(params: dict) -> str:
"""Deterministic hash of the fit configuration for one dub track.
@@ -137,6 +140,11 @@ def fit_fingerprint(params: dict) -> str:
if v is None or v == "":
v = _FIT_PARAM_DEFAULTS[k]
payload[k] = _canon_value(k, v)
+ # Added after tracks were already fingerprinted: hashed only when set to a
+ # non-default value, so existing tracks are not flagged stale by an upgrade.
+ min_rate = params.get("min_audio_rate")
+ if min_rate not in (None, "") and float(min_rate) != _MIN_AUDIO_RATE_DEFAULT:
+ payload["min_audio_rate"] = _canon_value("min_audio_rate", min_rate)
blob = json.dumps(payload, sort_keys=True, ensure_ascii=False)
return hashlib.sha1(blob.encode("utf-8"), usedforsecurity=False).hexdigest()[:16]
diff --git a/backend/services/subprocess_backend.py b/backend/services/subprocess_backend.py
index c49b6946c..b10a1aae4 100644
--- a/backend/services/subprocess_backend.py
+++ b/backend/services/subprocess_backend.py
@@ -776,9 +776,21 @@ class SubprocessBackend(TTSBackend):
except (TypeError, ValueError):
pass
return True, "pong"
- return False, f"unexpected reply: {reply!r}"
+ result = (False, f"unexpected reply: {reply!r}")
except Exception as exc:
- return False, f"{type(exc).__name__}: {exc}"
+ result = (False, f"{type(exc).__name__}: {exc}")
+ self._log_health_failure(result[1])
+ return result
+
+ def _log_health_failure(self, message: str) -> None:
+ """Keep the reason in the local log. The HTTP route withholds engine
+ text from its response and log line, so without this a failed probe
+ could not be told apart from a missing install (#2837)."""
+ from core.scrub import scrub_text
+
+ logger.warning(
+ "[%s] health check failed: %s", self.id, scrub_text(str(message))[:_STDERR_TAIL_CHARS]
+ )
def generate(self, text: str, **kw) -> torch.Tensor:
"""Synthesize one utterance through the sidecar.
diff --git a/bin/README.md b/bin/README.md
index 475909e23..c2cda2bc5 100644
--- a/bin/README.md
+++ b/bin/README.md
@@ -1,7 +1,8 @@
# Bundled binaries
-This directory holds platform-specific binaries that ship inside the
-VoiceStudio installer. Today:
+This directory holds the paths for platform-specific native binaries. The files
+in git are zero-byte placeholders and the desktop installers do not ship real
+binaries yet (#2780); CI builds them as workflow artifacts. Today:
| File | Built from | Purpose |
|------|------------|---------|
diff --git a/docs/electron-dubbing.md b/docs/electron-dubbing.md
index b9691b22e..fa76d9dbb 100644
--- a/docs/electron-dubbing.md
+++ b/docs/electron-dubbing.md
@@ -186,7 +186,15 @@ including zero guidance. Engine-specific audible effects remain unverified.
Saved Smart Fit override values now survive project import and draft recovery and
reach generation only when Smart Fit is selected. Other timing strategies omit
those parameters. Unit tests cover round-trip preservation and request routing;
-there is no new tuning panel (Tauri exposes these as stored preferences).
+the speed limits now have a panel (below).
+
+**Smart Fit speed limits (#2896).** With Smart Fit selected, the Timing section
+shows two sliders: *Fastest speed* (`audio_rate_cap`, 1.0 to 2.0, default 1.5) and
+*Slowest speed* (`min_audio_rate`, 0.5 to 1.0, default 0.85; 1.0 stops short lines
+being slowed to fill their slot). Both are sent as `fit_options`, validated by the
+API (out-of-range values return 422), saved with drafts and projects, and leave
+the defaults untouched until moved. Changing one re-mixes rendered lines without
+re-synthesizing them.
Real export verification: `tests/test_smart_fit_export.py` passes all 43 tests
with the installed app-managed FFmpeg/ffprobe explicitly supplied. Its seven
diff --git a/docs/engines/README.md b/docs/engines/README.md
index 65a309eb9..de0149b39 100644
--- a/docs/engines/README.md
+++ b/docs/engines/README.md
@@ -38,7 +38,7 @@ approval), [Windows](../install/windows.md), [Linux](../install/linux.md),
| GPT-SoVITS | [gpt-sovits](gpt-sovits.md) | external server | ✅ | its own API server |
| Sherpa-ONNX | [sherpa-onnx](sherpa-onnx.md) | CUDA · CPU | — | `pip install sherpa-onnx` + model dir |
| IndexTTS 2.5 | [indextts](indextts.md) | CUDA · CPU | ✅ + emotion | one-click sidecar install |
-| OmniVoice GGUF | [omnivoice-gguf](omnivoice-gguf.md) | CUDA · MPS · CPU | ✅ | bundled binary |
+| OmniVoice GGUF | [omnivoice-gguf](omnivoice-gguf.md) | CUDA · MPS · CPU | ✅ | native binary built from source (not in installers yet) |
| Supertonic-3 | [supertonic3](supertonic3.md) | CPU | — (7 preset voices) | `uv sync --extra supertonic` + license |
| MOSS-TTS-v1.5 (8B) | [moss-tts-v15](moss-tts-v15.md) | CUDA · CPU | ✅ | clone + env var |
| dots.tts (2B) | [dots-tts](dots-tts.md) | CUDA · CPU (not Windows) | ✅ | clone + env var |
diff --git a/docs/engines/omnivoice-gguf.md b/docs/engines/omnivoice-gguf.md
index cc9d8da82..035d4ed36 100644
--- a/docs/engines/omnivoice-gguf.md
+++ b/docs/engines/omnivoice-gguf.md
@@ -1,7 +1,7 @@
# VoiceStudio — OmniVoice GGUF Engine
OmniVoice GGUF runs the same OmniVoice model as the [default
-engine](omnivoice.md), but through a bundled native binary
+engine](omnivoice.md), but through a native binary
(`bin/omnivoice-tts-<platform>`) loading quantized GGUF weights. It is
hardware-adaptive: a probe picks the quantization that fits your machine, so
small GPUs and CPU-only hosts get a working OmniVoice instead of a paging,
@@ -31,15 +31,20 @@ against the same table (an F32 reference quant, ~3.2 GB, is override-only).
## Setup
-Nothing to install: installer and CI builds bundle the binary for your
-platform. Select the engine via **Model Catalogue** (TTS tab → **Use**) or
-`OMNIVOICE_TTS_BACKEND=omnivoice-gguf`. The quant weights download on first
-use (see [downloading-models.md](../downloading-models.md)) — install them
-ahead of time from **Model Catalogue (TTS tab → the engine's Weights)** if you want the first
-generation to be quick; a long first render is the download, not a hang.
+The desktop installers (Windows, macOS, Linux packages) do **not** ship this
+native binary yet, so on an installed app the engine shows *Unavailable* in
+Model Catalogue ([#2780](https://github.com/debpalash/VoiceStudio/issues/2780)).
+Use the default in-process OmniVoice engine, which is the same model, or run
+from a source checkout and build the binary for your platform (below). Once
+`bin/omnivoice-tts-<platform>` exists, select the engine via **Model Catalogue**
+(TTS tab → **Use**) or `OMNIVOICE_TTS_BACKEND=omnivoice-gguf`. The quant weights
+download on first use (see [downloading-models.md](../downloading-models.md)) —
+install them ahead of time from **Model Catalogue (TTS tab → the engine's
+Weights)** if you want the first generation to be quick; a long first render is
+the download, not a hang.
**Source checkouts:** the repo ships zero-byte placeholders in `bin/` — real
-binaries come from CI or the installer. The engine detects a placeholder and
+binaries come from CI (`build-omnivoice-tts`) or a local build. The engine detects a placeholder and
reports unavailable with instructions
([#1172](https://github.com/debpalash/VoiceStudio/issues/1172)) instead of
failing at spawn time; build one with
@@ -82,8 +87,10 @@ Before reporting ready, the engine:
## Troubleshooting
-- "GGUF binary missing": this build doesn't bundle the runtime for your
- platform — use the default engine.
+- "GGUF binary missing": the installer doesn't include the runtime (see
+ Setup) — use the default engine, or build the binary from a source checkout.
+ The log line `Engine health check failed; engine=omnivoice-gguf` withholds the
+ reason by design; a missing binary is the usual cause on an installed app.
- Checksum mismatch or quarantine messages: follow the printed fix, or
reinstall.
- Other issues: [install/troubleshooting.md](../install/troubleshooting.md).
diff --git a/electron/src/renderer/src/features/dub/dub-draft.test.ts b/electron/src/renderer/src/features/dub/dub-draft.test.ts
index 69ac82e01..650535d68 100644
--- a/electron/src/renderer/src/features/dub/dub-draft.test.ts
+++ b/electron/src/renderer/src/features/dub/dub-draft.test.ts
@@ -187,3 +187,14 @@ it('restores the project translation brief without changing its wording', () =>
const result = restoreDubDraft(JSON.stringify({ ...defaults, translationInstructions }), defaults);
expect(result?.translationInstructions).toBe(translationInstructions);
});
+
+it('restores a valid Smart Fit slowest-speed floor and drops out-of-range overrides', () => {
+ const restore = (fitOptions: object) =>
+ restoreDubDraft(JSON.stringify({ ...defaults, fitOptions }), defaults).fitOptions;
+ expect(restore({ min_audio_rate: 0.7, audio_rate_cap: 1.3 })).toEqual({
+ min_audio_rate: 0.7,
+ audio_rate_cap: 1.3,
+ });
+ expect(restore({ min_audio_rate: 0.2 })).toEqual({});
+ expect(restore({ min_audio_rate: 1.4, audio_rate_cap: 0.9 })).toEqual({});
+});
diff --git a/electron/src/renderer/src/features/dub/dub-draft.ts b/electron/src/renderer/src/features/dub/dub-draft.ts
index bc9efe991..18bc31a5e 100644
--- a/electron/src/renderer/src/features/dub/dub-draft.ts
+++ b/electron/src/renderer/src/features/dub/dub-draft.ts
@@ -160,19 +160,14 @@ export function restoreDubDraft(raw: string | null, defaults: DubSession): DubSe
fitOptions:
value.fitOptions && typeof value.fitOptions === 'object' && !Array.isArray(value.fitOptions)
? Object.fromEntries(
- Object.entries(value.fitOptions).filter(([key, item]) =>
- key === 'allow_video_retime'
- ? typeof item === 'boolean'
- : [
- 'max_audio_only_rate',
- 'audio_rate_cap',
- 'video_slow_cap',
- 'gap_guard_s',
- ].includes(key) &&
- typeof item === 'number' &&
- Number.isFinite(item) &&
- item >= (key === 'gap_guard_s' ? 0 : 1),
- ),
+ Object.entries(value.fitOptions).filter(([key, item]) => {
+ if (key === 'allow_video_retime') return typeof item === 'boolean';
+ if (typeof item !== 'number' || !Number.isFinite(item)) return false;
+ if (key === 'gap_guard_s') return item >= 0;
+ if (key === 'min_audio_rate') return item >= 0.5 && item <= 1;
+ return ['max_audio_only_rate', 'audio_rate_cap', 'video_slow_cap'].includes(key)
+ && item >= 1;
+ }),
)
: undefined,
exportOptions: restoreExportPreferences(value.exportOptions),
diff --git a/electron/src/renderer/src/features/dub/dub-page.tsx b/electron/src/renderer/src/features/dub/dub-page.tsx
index 7c36e4ade..a48d6f489 100644
--- a/electron/src/renderer/src/features/dub/dub-page.tsx
+++ b/electron/src/renderer/src/features/dub/dub-page.tsx
@@ -22,7 +22,12 @@ import { CheckpointBanner, type CheckpointStage } from './checkpoint-banner';
import { ConfirmDialog } from '../clone/confirm-dialog';
import { useDubOnsets } from './use-dub-onsets';
import { useDubLivePreview } from './use-dub-live-preview';
-import { setDubQuality, setDubProduction, setDubTranslationOptions } from './dub-session';
+import {
+ setDubFitOptions,
+ setDubQuality,
+ setDubProduction,
+ setDubTranslationOptions,
+} from './dub-session';
import { DEFAULT_REPAIR_AGENT_KEY } from '@/lib/repair-agent-events';
import type { RepairAgentId, RepairAgentInfo } from '../../../../preload/index.d';
import {
@@ -1644,6 +1649,43 @@ export function DubPage() {
{['smart_fit', 'stretch_video'].includes(session.timingStrategy || '') && (
<p className="text-xs text-muted-foreground">{t('exportModal.retime_note')}</p>
)}
+ {session.timingStrategy === 'smart_fit' && (
+ <div className="space-y-2">
+ <p className="text-xs text-muted-foreground">{t('dub.fit_speed_hint')}</p>
+ {(
+ [
+ { key: 'audio_rate_cap', label: 'dub.fit_max_speed', min: 1, max: 2, defaultValue: 1.5 },
+ { key: 'min_audio_rate', label: 'dub.fit_min_speed', min: 0.5, max: 1, defaultValue: 0.85 },
+ ] as const
+ ).map((knob) => {
+ const current = session.fitOptions?.[knob.key] ?? knob.defaultValue;
+ return (
+ <label key={knob.key} className="block space-y-1 text-xs">
+ <span className="flex justify-between">
+ <span>{t(knob.label)}</span>
+ <span className="tabular-nums">{current.toFixed(2)}×</span>
+ </span>
+ <input
+ type="range"
+ className="w-full accent-primary"
+ aria-label={t(knob.label)}
+ min={knob.min}
+ max={knob.max}
+ step={0.05}
+ value={current}
+ disabled={busy || Boolean(session.recovery)}
+ onChange={(event) => {
+ const value = Number(event.target.value);
+ setDubFitOptions({
+ [knob.key]: value === knob.defaultValue ? undefined : value,
+ });
+ }}
+ />
+ </label>
+ );
+ })}
+ </div>
+ )}
<p className="text-xs font-medium text-muted-foreground">{t('dub.voice_match')}</p>
<p className="text-xs text-muted-foreground">{t('dub.voice_match_title')}</p>
<div className="flex flex-wrap gap-1">
diff --git a/electron/src/renderer/src/features/dub/dub-session.test.ts b/electron/src/renderer/src/features/dub/dub-session.test.ts
index c3b604412..3ff92d90c 100644
--- a/electron/src/renderer/src/features/dub/dub-session.test.ts
+++ b/electron/src/renderer/src/features/dub/dub-session.test.ts
@@ -7,6 +7,7 @@ import {
applyDubTranslationRows,
uploadDub,
setDubProduction,
+ setDubFitOptions,
dubSession,
generateDub,
resumeDub,
@@ -605,6 +606,24 @@ it('uses saved Smart Fit overrides only for Smart Fit generation', async () => {
}
});
+it('sets and clears Smart Fit speed limits, keeping the rest of the overrides', () => {
+ dubSession.setState((current) => ({
+ ...current,
+ phase: 'editing',
+ recovery: null,
+ fitOptions: { allow_video_retime: false },
+ }));
+ setDubFitOptions({ min_audio_rate: 0.7 });
+ setDubFitOptions({ audio_rate_cap: 1.3 });
+ expect(dubSession.state.fitOptions).toEqual({
+ allow_video_retime: false,
+ min_audio_rate: 0.7,
+ audio_rate_cap: 1.3,
+ });
+ setDubFitOptions({ min_audio_rate: undefined, audio_rate_cap: undefined });
+ expect(dubSession.state.fitOptions).toEqual({ allow_video_retime: false });
+});
+
it('does not recreate a cleared draft from a pending write or pagehide', async () => {
localStorage.setItem('voicestudio.dub.session.v1', 'old');
dubSession.setState((current) => ({ ...current, speed: 1.1 }));
diff --git a/electron/src/renderer/src/features/dub/dub-session.ts b/electron/src/renderer/src/features/dub/dub-session.ts
index 9e0b9fc91..18361b938 100644
--- a/electron/src/renderer/src/features/dub/dub-session.ts
+++ b/electron/src/renderer/src/features/dub/dub-session.ts
@@ -120,6 +120,7 @@ export interface DubSession {
video_slow_cap?: number;
gap_guard_s?: number;
allow_video_retime?: boolean;
+ min_audio_rate?: number;
};
steps?: number;
guidance?: number;
@@ -309,6 +310,17 @@ export const setDubProduction = (
if (['idle', 'editing', 'done'].includes(dubSession.state.phase) && !dubSession.state.recovery)
patch(value);
};
+/** Smart Fit speed limits. An undefined value restores the server default. */
+export const setDubFitOptions = (
+ value: Partial<Pick<NonNullable<DubSession['fitOptions']>, 'audio_rate_cap' | 'min_audio_rate'>>,
+) => {
+ if (!['idle', 'editing', 'done'].includes(dubSession.state.phase) || dubSession.state.recovery)
+ return;
+ const next = { ...dubSession.state.fitOptions, ...value };
+ for (const key of Object.keys(value) as (keyof typeof value)[])
+ if (value[key] === undefined) delete next[key];
+ patch({ fitOptions: Object.keys(next).length ? next : undefined });
+};
export const setDubExportPreferences = (value: Partial<DubExportPreferences>) => {
if (!controller && !cancelling && !dubSession.state.recovery)
patch({ exportOptions: { ...dubSession.state.exportOptions, ...value } });
diff --git a/electron/src/renderer/src/i18n/locales/ar.json b/electron/src/renderer/src/i18n/locales/ar.json
index 878488ce8..ecca636e0 100644
--- a/electron/src/renderer/src/i18n/locales/ar.json
+++ b/electron/src/renderer/src/i18n/locales/ar.json
@@ -770,6 +770,9 @@
"burn_subs_title": "قم بعرض الترجمات مباشرة في دفق الفيديو MP4 (hardsubs). يستخدم تنسيق الترجمة المزدوجة عند تشغيل الترجمة المزدوجة.",
"timing_smart_fit": "ملاءمة ذكية",
"timing_smart_fit_title": "يوزّع المواءمة: يسرّع الصوت قليلاً (مع الحفاظ على طبقة الصوت، حتى 1.5×) ويبطئ ذلك المقطع من الفيديو قليلاً (حتى 2×) لتتسع الدبلجة بإيقاعها الطبيعي. ما يتجاوز الحدود يُقصّ ويُميّز بعلامة. يعيد التصدير ترميز الفيديو.",
+ "fit_speed_hint": "حدود سرعة الملاءمة الذكية. الحدود الأضيق تُبقي الكلام طبيعيًا، والأوسع تلائم مزيدًا من الأسطر دون اقتطاع. تناسب القيم الافتراضية معظم مقاطع الفيديو.",
+ "fit_max_speed": "أسرع سرعة",
+ "fit_min_speed": "أبطأ سرعة",
"voice_match": "مطابقة الصوت:",
"voice_match_title": "مطابقة الصوت — هل يُستنسخ كل سطر مدبلج من مقطعه المصدر الخاص، أم تتشارك كل أسطر المتحدث مرجعًا واحدًا.",
"voice_match_per_line": "لكل سطر",
diff --git a/electron/src/renderer/src/i18n/locales/de.json b/electron/src/renderer/src/i18n/locales/de.json
index 3a476d101..ea8d81026 100644
--- a/electron/src/renderer/src/i18n/locales/de.json
+++ b/electron/src/renderer/src/i18n/locales/de.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Rendern Sie Untertitel direkt in den MP4-Videostream (Hardsubs). Verwendet das Dual-Untertitelformat, wenn Dual-Untertitel aktiviert ist.",
"timing_smart_fit": "Intelligente Anpassung",
"timing_smart_fit_title": "Teilt die Anpassung auf: Das Audio wird leicht beschleunigt (tonhöhenerhaltend, bis 1,5×) und das Videosegment leicht verlangsamt (bis 2×), damit Sprache in natürlichem Tempo passt. Was darüber hinausgeht, wird gekürzt und markiert. Der Export codiert das Video neu.",
+ "fit_speed_hint": "Tempolimits für Smart Fit. Engere Grenzen halten die Sprache natürlich, weitere passen mehr Zeilen ohne Kürzen ein. Die Standardwerte passen für die meisten Videos.",
+ "fit_max_speed": "Schnellstes Tempo",
+ "fit_min_speed": "Langsamstes Tempo",
"voice_match": "Stimmabgleich:",
"voice_match_title": "Stimmabgleich — ob jede synchronisierte Zeile aus ihrem eigenen Quellclip geklont wird oder alle Zeilen eines Sprechers eine gemeinsame Referenz teilen.",
"voice_match_per_line": "Pro Zeile",
diff --git a/electron/src/renderer/src/i18n/locales/en.json b/electron/src/renderer/src/i18n/locales/en.json
index 73cb05747..ec5306bee 100644
--- a/electron/src/renderer/src/i18n/locales/en.json
+++ b/electron/src/renderer/src/i18n/locales/en.json
@@ -951,6 +951,9 @@
"burn_subs_title": "Render subtitles directly into the MP4 video stream (hardsubs). Uses the dual-subtitle format when Dual subtitles is on.",
"timing_smart_fit": "Smart Fit",
"timing_smart_fit_title": "Splits the difference: slightly speeds up the audio (pitch preserved, up to 1.5×) and slightly slows down that segment of the video (up to 2×) so natural-rate speech fits. Anything beyond the caps is trimmed and flagged. Export re-encodes the video.",
+ "fit_speed_hint": "Smart Fit speed limits. Tighter limits keep speech natural; wider limits fit more lines without trimming. The defaults suit most videos.",
+ "fit_max_speed": "Fastest speed",
+ "fit_min_speed": "Slowest speed",
"voice_match": "Voice match:",
"voice_match_title": "Voice match — whether each dubbed line clones from its own source clip or every line of a speaker shares one reference.",
"voice_match_per_line": "Per line",
diff --git a/electron/src/renderer/src/i18n/locales/es.json b/electron/src/renderer/src/i18n/locales/es.json
index a96464926..46884766b 100644
--- a/electron/src/renderer/src/i18n/locales/es.json
+++ b/electron/src/renderer/src/i18n/locales/es.json
@@ -764,6 +764,9 @@
"burn_subs_title": "Renderice subtítulos directamente en la transmisión de video MP4 (hardsubs). Utiliza el formato de subtítulos duales cuando los subtítulos duales están activados.",
"timing_smart_fit": "Ajuste inteligente",
"timing_smart_fit_title": "Reparte el ajuste: acelera ligeramente el audio (conservando el tono, hasta 1,5×) y ralentiza ligeramente ese segmento del vídeo (hasta 2×) para que la voz a ritmo natural quepa. Lo que supere los límites se recorta y se señala. La exportación recodifica el vídeo.",
+ "fit_speed_hint": "Límites de velocidad de Ajuste inteligente. Límites más estrechos mantienen el habla natural; más amplios encajan más líneas sin recortar. Los valores predeterminados sirven para la mayoría de los vídeos.",
+ "fit_max_speed": "Velocidad máxima",
+ "fit_min_speed": "Velocidad mínima",
"voice_match": "Coincidencia de voz:",
"voice_match_title": "Coincidencia de voz: si cada línea doblada se clona desde su propio clip de origen o todas las líneas de un hablante comparten una sola referencia.",
"voice_match_per_line": "Por línea",
diff --git a/electron/src/renderer/src/i18n/locales/fr.json b/electron/src/renderer/src/i18n/locales/fr.json
index 5463ff265..11a2372d6 100644
--- a/electron/src/renderer/src/i18n/locales/fr.json
+++ b/electron/src/renderer/src/i18n/locales/fr.json
@@ -764,6 +764,9 @@
"burn_subs_title": "Rendu des sous-titres directement dans le flux vidéo MP4 (hardsubs). Utilise le format double sous-titre lorsque les sous-titres doubles sont activés.",
"timing_smart_fit": "Ajustement intelligent",
"timing_smart_fit_title": "Répartit l'effort : accélère légèrement l'audio (hauteur préservée, jusqu'à 1,5×) et ralentit légèrement ce segment de la vidéo (jusqu'à 2×) pour que la voix à débit naturel tienne. Tout dépassement est coupé et signalé. L'export réencode la vidéo.",
+ "fit_speed_hint": "Limites de vitesse d'Ajustement intelligent. Des limites plus serrées gardent une voix naturelle ; des limites plus larges font tenir plus de lignes sans coupe. Les valeurs par défaut conviennent à la plupart des vidéos.",
+ "fit_max_speed": "Vitesse la plus rapide",
+ "fit_min_speed": "Vitesse la plus lente",
"voice_match": "Correspondance de voix :",
"voice_match_title": "Correspondance de voix — chaque ligne doublée est clonée depuis son propre extrait source, ou toutes les lignes d'un locuteur partagent une référence unique.",
"voice_match_per_line": "Par ligne",
diff --git a/electron/src/renderer/src/i18n/locales/hi.json b/electron/src/renderer/src/i18n/locales/hi.json
index 97422a188..6ce394d58 100644
--- a/electron/src/renderer/src/i18n/locales/hi.json
+++ b/electron/src/renderer/src/i18n/locales/hi.json
@@ -762,6 +762,9 @@
"burn_subs_title": "उपशीर्षक को सीधे MP4 वीडियो स्ट्रीम (हार्डसब) में प्रस्तुत करें। दोहरे उपशीर्षक चालू होने पर दोहरे उपशीर्षक प्रारूप का उपयोग करता है।",
"timing_smart_fit": "स्मार्ट फ़िट",
"timing_smart_fit_title": "दोनों में संतुलन: ऑडियो को थोड़ा तेज़ करता है (पिच बरकरार, अधिकतम 1.5×) और वीडियो के उस हिस्से को थोड़ा धीमा करता है (अधिकतम 2×), ताकि स्वाभाविक गति की आवाज़ फिट हो जाए। सीमा से अधिक हिस्सा काटकर चिह्नित किया जाता है। निर्यात में वीडियो फिर से एन्कोड होता है।",
+ "fit_speed_hint": "स्मार्ट फ़िट की गति सीमाएँ। कम सीमाएँ आवाज़ को स्वाभाविक रखती हैं; अधिक सीमाएँ बिना काटे ज़्यादा पंक्तियाँ फ़िट करती हैं। डिफ़ॉल्ट मान ज़्यादातर वीडियो के लिए ठीक हैं।",
+ "fit_max_speed": "सबसे तेज़ गति",
+ "fit_min_speed": "सबसे धीमी गति",
"voice_match": "आवाज़ मिलान:",
"voice_match_title": "आवाज़ मिलान — हर डब लाइन अपनी ही स्रोत क्लिप से क्लोन हो या एक वक्ता की सभी लाइनें एक साझा संदर्भ इस्तेमाल करें।",
"voice_match_per_line": "प्रति पंक्ति",
diff --git a/electron/src/renderer/src/i18n/locales/id.json b/electron/src/renderer/src/i18n/locales/id.json
index 341c510a7..462760423 100644
--- a/electron/src/renderer/src/i18n/locales/id.json
+++ b/electron/src/renderer/src/i18n/locales/id.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Render subtitle langsung ke aliran video MP4 (hardsubs). Menggunakan format subtitle ganda saat Subtitle ganda aktif.",
"timing_smart_fit": "Penyesuaian Cerdas",
"timing_smart_fit_title": "Membagi beban: sedikit mempercepat audio (nada dipertahankan, hingga 1,5×) dan sedikit memperlambat segmen video itu (hingga 2×) agar suara dengan tempo alami muat. Kelebihan di luar batas dipangkas dan ditandai. Ekspor mengenkode ulang video.",
+ "fit_speed_hint": "Batas kecepatan Smart Fit. Batas yang lebih ketat menjaga ucapan tetap alami; batas yang lebih longgar memuat lebih banyak baris tanpa dipangkas. Nilai bawaan cocok untuk sebagian besar video.",
+ "fit_max_speed": "Kecepatan paling cepat",
+ "fit_min_speed": "Kecepatan paling lambat",
"voice_match": "Pencocokan suara:",
"voice_match_title": "Pencocokan suara — apakah setiap baris sulih suara dikloning dari klip sumbernya sendiri atau semua baris satu pembicara memakai satu referensi bersama.",
"voice_match_per_line": "Per baris",
diff --git a/electron/src/renderer/src/i18n/locales/it.json b/electron/src/renderer/src/i18n/locales/it.json
index 6d566614d..97c2559ac 100644
--- a/electron/src/renderer/src/i18n/locales/it.json
+++ b/electron/src/renderer/src/i18n/locales/it.json
@@ -764,6 +764,9 @@
"burn_subs_title": "Rendi i sottotitoli direttamente nel flusso video MP4 (hardsubs). Utilizza il formato doppio sottotitolo quando è attivo il doppio sottotitolo.",
"timing_smart_fit": "Adattamento intelligente",
"timing_smart_fit_title": "Divide il compito: accelera leggermente l'audio (tono preservato, fino a 1,5×) e rallenta leggermente quel segmento del video (fino a 2×) così il parlato a ritmo naturale ci sta. L'eccedenza viene tagliata e segnalata. L'esportazione ricodifica il video.",
+ "fit_speed_hint": "Limiti di velocità di Adattamento intelligente. Limiti più stretti mantengono il parlato naturale; limiti più ampi fanno stare più righe senza tagli. I valori predefiniti vanno bene per la maggior parte dei video.",
+ "fit_max_speed": "Velocità massima",
+ "fit_min_speed": "Velocità minima",
"voice_match": "Corrispondenza voce:",
"voice_match_title": "Corrispondenza voce — se ogni battuta doppiata viene clonata dal proprio clip sorgente o tutte le battute di un parlante condividono un unico riferimento.",
"voice_match_per_line": "Per battuta",
diff --git a/electron/src/renderer/src/i18n/locales/ja.json b/electron/src/renderer/src/i18n/locales/ja.json
index b7591621b..82d7d86c5 100644
--- a/electron/src/renderer/src/i18n/locales/ja.json
+++ b/electron/src/renderer/src/i18n/locales/ja.json
@@ -762,6 +762,9 @@
"burn_subs_title": "字幕を MP4 ビデオ ストリームに直接レンダリングします (ハードサブ)。デュアル字幕がオンの場合は、デュアル字幕形式を使用します。",
"timing_smart_fit": "スマートフィット",
"timing_smart_fit_title": "両方を少しずつ調整します。音声をわずかに速め(ピッチ維持、最大1.5倍)、そのセグメントの映像をわずかに遅くする(最大2倍)ことで、自然な話速のまま収めます。上限を超えた分はトリミングされ、フラグが付きます。書き出し時に映像を再エンコードします。",
+ "fit_speed_hint": "スマートフィットの速度制限です。制限が狭いほど自然な話し方を保ち、広いほどカットせずに多くの行を収められます。既定値はほとんどの動画に適しています。",
+ "fit_max_speed": "最速",
+ "fit_min_speed": "最遅",
"voice_match": "声の一致:",
"voice_match_title": "声の一致 — 各セリフを自身のソースクリップからクローンするか、話者の全セリフで1つの参照を共有するか。",
"voice_match_per_line": "行ごと",
diff --git a/electron/src/renderer/src/i18n/locales/ko.json b/electron/src/renderer/src/i18n/locales/ko.json
index 9d1215b8a..b45d6eb3b 100644
--- a/electron/src/renderer/src/i18n/locales/ko.json
+++ b/electron/src/renderer/src/i18n/locales/ko.json
@@ -760,6 +760,9 @@
"burn_subs_title": "자막을 MP4 비디오 스트림(하드 서브)으로 직접 렌더링합니다. 듀얼 자막이 켜져 있을 때 듀얼 자막 형식을 사용합니다.",
"timing_smart_fit": "스마트 핏",
"timing_smart_fit_title": "양쪽을 조금씩 조정합니다. 오디오를 약간 빠르게(피치 유지, 최대 1.5배) 하고 해당 구간의 영상을 약간 느리게(최대 2배) 하여 자연스러운 속도의 음성을 맞춥니다. 한도를 넘는 부분은 잘리고 표시됩니다. 내보낼 때 영상을 다시 인코딩합니다.",
+ "fit_speed_hint": "스마트 핏 속도 제한입니다. 제한이 좁을수록 음성이 자연스럽고, 넓을수록 잘라내지 않고 더 많은 줄을 맞출 수 있습니다. 기본값은 대부분의 영상에 적합합니다.",
+ "fit_max_speed": "최고 속도",
+ "fit_min_speed": "최저 속도",
"voice_match": "음성 일치:",
"voice_match_title": "음성 일치 — 각 더빙 대사를 자신의 원본 클립에서 복제할지, 한 화자의 모든 대사가 하나의 참조를 공유할지 정합니다.",
"voice_match_per_line": "대사별",
diff --git a/electron/src/renderer/src/i18n/locales/nl.json b/electron/src/renderer/src/i18n/locales/nl.json
index 4b405d9ee..4527fe705 100644
--- a/electron/src/renderer/src/i18n/locales/nl.json
+++ b/electron/src/renderer/src/i18n/locales/nl.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Geef ondertitels rechtstreeks weer in de MP4-videostream (hardsubs). Gebruikt het formaat met dubbele ondertiteling wanneer dubbele ondertiteling is ingeschakeld.",
"timing_smart_fit": "Slimme aanpassing",
"timing_smart_fit_title": "Verdeelt de aanpassing: versnelt de audio licht (toonhoogte behouden, tot 1,5×) en vertraagt dat videosegment licht (tot 2×) zodat spraak op natuurlijk tempo past. Wat daarbuiten valt wordt afgekapt en gemarkeerd. Exporteren hercodeert de video.",
+ "fit_speed_hint": "Snelheidslimieten van Slim passend maken. Strakkere limieten houden spraak natuurlijk; ruimere limieten laten meer regels passen zonder afkappen. De standaardwaarden werken voor de meeste video's.",
+ "fit_max_speed": "Hoogste snelheid",
+ "fit_min_speed": "Laagste snelheid",
"voice_match": "Stemovereenkomst:",
"voice_match_title": "Stemovereenkomst — of elke gedubde regel wordt gekloond uit zijn eigen bronclip of alle regels van een spreker één referentie delen.",
"voice_match_per_line": "Per regel",
diff --git a/electron/src/renderer/src/i18n/locales/pl.json b/electron/src/renderer/src/i18n/locales/pl.json
index 766ae1ac8..ff91fdfc6 100644
--- a/electron/src/renderer/src/i18n/locales/pl.json
+++ b/electron/src/renderer/src/i18n/locales/pl.json
@@ -766,6 +766,9 @@
"burn_subs_title": "Renderuj napisy bezpośrednio do strumienia wideo MP4 (hardsub). Używa formatu podwójnych napisów, gdy opcja Podwójne napisy jest włączona.",
"timing_smart_fit": "Inteligentne dopasowanie",
"timing_smart_fit_title": "Dzieli dopasowanie: lekko przyspiesza dźwięk (z zachowaniem wysokości tonu, do 1,5×) i lekko spowalnia dany fragment wideo (do 2×), aby mowa w naturalnym tempie się zmieściła. Nadmiar jest przycinany i oznaczany. Eksport ponownie koduje wideo.",
+ "fit_speed_hint": "Limity prędkości Inteligentnego dopasowania. Węższe limity zachowują naturalną mowę, szersze mieszczą więcej linii bez przycinania. Wartości domyślne pasują do większości filmów.",
+ "fit_max_speed": "Największa prędkość",
+ "fit_min_speed": "Najmniejsza prędkość",
"voice_match": "Dopasowanie głosu:",
"voice_match_title": "Dopasowanie głosu — czy każda dubbingowana kwestia jest klonowana z własnego klipu źródłowego, czy wszystkie kwestie mówcy dzielą jedno odniesienie.",
"voice_match_per_line": "Na kwestię",
diff --git a/electron/src/renderer/src/i18n/locales/pt.json b/electron/src/renderer/src/i18n/locales/pt.json
index 32dcc75a7..d6c18f0b7 100644
--- a/electron/src/renderer/src/i18n/locales/pt.json
+++ b/electron/src/renderer/src/i18n/locales/pt.json
@@ -764,6 +764,9 @@
"burn_subs_title": "Renderize legendas diretamente no stream de vídeo MP4 (hardsubs). Usa o formato de legenda dupla quando Legendas duplas está ativado.",
"timing_smart_fit": "Ajuste inteligente",
"timing_smart_fit_title": "Divide o ajuste: acelera ligeiramente o áudio (tom preservado, até 1,5×) e desacelera ligeiramente esse trecho do vídeo (até 2×) para que a fala em ritmo natural caiba. O que passar dos limites é cortado e sinalizado. A exportação recodifica o vídeo.",
+ "fit_speed_hint": "Limites de velocidade do Ajuste inteligente. Limites mais estreitos mantêm a fala natural; limites mais amplos encaixam mais linhas sem cortar. Os valores padrão servem para a maioria dos vídeos.",
+ "fit_max_speed": "Velocidade máxima",
+ "fit_min_speed": "Velocidade mínima",
"voice_match": "Correspondência de voz:",
"voice_match_title": "Correspondência de voz — se cada fala dublada é clonada do seu próprio clipe de origem ou todas as falas de um falante compartilham uma única referência.",
"voice_match_per_line": "Por fala",
diff --git a/electron/src/renderer/src/i18n/locales/ru.json b/electron/src/renderer/src/i18n/locales/ru.json
index dde141501..15b013b74 100644
--- a/electron/src/renderer/src/i18n/locales/ru.json
+++ b/electron/src/renderer/src/i18n/locales/ru.json
@@ -766,6 +766,9 @@
"burn_subs_title": "Рендеринг субтитров непосредственно в видеопоток MP4 (жесткие субтитры). Использует формат двойных субтитров, когда двойные субтитры включены.",
"timing_smart_fit": "Умная подгонка",
"timing_smart_fit_title": "Делит подгонку пополам: слегка ускоряет аудио (с сохранением высоты тона, до 1,5×) и слегка замедляет этот фрагмент видео (до 2×), чтобы речь в естественном темпе поместилась. Остаток сверх лимитов обрезается и помечается. Экспорт перекодирует видео.",
+ "fit_speed_hint": "Ограничения скорости умной подгонки. Более узкие пределы сохраняют естественность речи, более широкие позволяют уместить больше реплик без обрезки. Значения по умолчанию подходят для большинства видео.",
+ "fit_max_speed": "Максимальная скорость",
+ "fit_min_speed": "Минимальная скорость",
"voice_match": "Совпадение голоса:",
"voice_match_title": "Совпадение голоса — клонировать каждую реплику из её собственного исходного фрагмента или все реплики одного говорящего используют одну общую референс-запись.",
"voice_match_per_line": "Построчно",
diff --git a/electron/src/renderer/src/i18n/locales/sv.json b/electron/src/renderer/src/i18n/locales/sv.json
index 25efc2956..dbde51897 100644
--- a/electron/src/renderer/src/i18n/locales/sv.json
+++ b/electron/src/renderer/src/i18n/locales/sv.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Återge undertexter direkt i MP4-videoströmmen (hardsubs). Använder formatet med dubbla undertexter när dubbla undertexter är på.",
"timing_smart_fit": "Smart anpassning",
"timing_smart_fit_title": "Delar upp anpassningen: snabbar upp ljudet något (tonhöjd bevaras, upp till 1,5×) och saktar ner det videosegmentet något (upp till 2×) så att tal i naturligt tempo får plats. Det som ändå inte ryms klipps och flaggas. Export omkodar videon.",
+ "fit_speed_hint": "Hastighetsgränser för Smart anpassning. Snävare gränser håller talet naturligt; vidare gränser får in fler rader utan att klippa. Standardvärdena passar de flesta videor.",
+ "fit_max_speed": "Snabbaste tempo",
+ "fit_min_speed": "Långsammaste tempo",
"voice_match": "Röstmatchning:",
"voice_match_title": "Röstmatchning — om varje dubbad rad klonas från sitt eget källklipp eller om alla rader från en talare delar en gemensam referens.",
"voice_match_per_line": "Per rad",
diff --git a/electron/src/renderer/src/i18n/locales/th.json b/electron/src/renderer/src/i18n/locales/th.json
index a1daaace6..1bb1afb1d 100644
--- a/electron/src/renderer/src/i18n/locales/th.json
+++ b/electron/src/renderer/src/i18n/locales/th.json
@@ -762,6 +762,9 @@
"burn_subs_title": "แสดงคำบรรยายโดยตรงในสตรีมวิดีโอ MP4 (hardsubs) ใช้รูปแบบคำบรรยายคู่เมื่อเปิดใช้งานคำบรรยายคู่",
"timing_smart_fit": "ปรับพอดีอัจฉริยะ",
"timing_smart_fit_title": "แบ่งภาระทั้งสองทาง: เร่งเสียงขึ้นเล็กน้อย (คงระดับเสียง สูงสุด 1.5×) และชะลอวิดีโอช่วงนั้นลงเล็กน้อย (สูงสุด 2×) เพื่อให้เสียงพากย์จังหวะธรรมชาติพอดี ส่วนที่เกินขีดจำกัดจะถูกตัดและทำเครื่องหมาย การส่งออกจะเข้ารหัสวิดีโอใหม่",
+ "fit_speed_hint": "ขีดจำกัดความเร็วของ Smart Fit ขีดจำกัดที่แคบช่วยให้เสียงพูดเป็นธรรมชาติ ขีดจำกัดที่กว้างช่วยให้ใส่ได้มากขึ้นโดยไม่ต้องตัด ค่าเริ่มต้นเหมาะกับวิดีโอส่วนใหญ่",
+ "fit_max_speed": "ความเร็วสูงสุด",
+ "fit_min_speed": "ความเร็วต่ำสุด",
"voice_match": "การจับคู่เสียง:",
"voice_match_title": "การจับคู่เสียง — ให้แต่ละบรรทัดพากย์โคลนจากคลิปต้นฉบับของตัวเอง หรือให้ทุกบรรทัดของผู้พูดใช้ข้อมูลอ้างอิงเดียวร่วมกัน",
"voice_match_per_line": "ต่อบรรทัด",
diff --git a/electron/src/renderer/src/i18n/locales/tr.json b/electron/src/renderer/src/i18n/locales/tr.json
index 1a11776d0..7dbfaa941 100644
--- a/electron/src/renderer/src/i18n/locales/tr.json
+++ b/electron/src/renderer/src/i18n/locales/tr.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Altyazıları doğrudan MP4 video akışına (hardsub'lar) aktarın. Çift altyazı açıkken çift altyazı formatını kullanır.",
"timing_smart_fit": "Akıllı Sığdırma",
"timing_smart_fit_title": "Yükü paylaştırır: sesi hafifçe hızlandırır (perde korunur, en fazla 1,5×) ve videonun o bölümünü hafifçe yavaşlatır (en fazla 2×), böylece doğal hızdaki konuşma sığar. Sınırları aşan kısım kırpılır ve işaretlenir. Dışa aktarma videoyu yeniden kodlar.",
+ "fit_speed_hint": "Akıllı Sığdırma hız sınırları. Dar sınırlar konuşmayı doğal tutar; geniş sınırlar daha fazla satırı kırpmadan sığdırır. Varsayılan değerler çoğu video için uygundur.",
+ "fit_max_speed": "En yüksek hız",
+ "fit_min_speed": "En düşük hız",
"voice_match": "Ses eşleşmesi:",
"voice_match_title": "Ses eşleşmesi — her dublaj satırı kendi kaynak klibinden mi klonlansın, yoksa bir konuşmacının tüm satırları tek bir referansı mı paylaşsın.",
"voice_match_per_line": "Satır başına",
diff --git a/electron/src/renderer/src/i18n/locales/uk.json b/electron/src/renderer/src/i18n/locales/uk.json
index 38156c48a..331bf2841 100644
--- a/electron/src/renderer/src/i18n/locales/uk.json
+++ b/electron/src/renderer/src/i18n/locales/uk.json
@@ -766,6 +766,9 @@
"burn_subs_title": "Рендер субтитрів безпосередньо у відеопотік MP4 (хардсуб). Використовує формат подвійних субтитрів, коли ввімкнено подвійні субтитри.",
"timing_smart_fit": "Розумне підлаштування",
"timing_smart_fit_title": "Розподіляє підлаштування: трохи пришвидшує звук (зі збереженням висоти тону, до 1,5×) і трохи сповільнює цей фрагмент відео (до 2×), щоб мовлення в природному темпі вмістилося. Надлишок понад ліміти обрізається й позначається. Експорт перекодовує відео.",
+ "fit_speed_hint": "Обмеження швидкості розумного підлаштування. Вужчі межі зберігають природність мовлення, ширші дозволяють вмістити більше реплік без обрізання. Типові значення підходять для більшості відео.",
+ "fit_max_speed": "Найвища швидкість",
+ "fit_min_speed": "Найнижча швидкість",
"voice_match": "Збіг голосу:",
"voice_match_title": "Збіг голосу — клонувати кожну репліку з її власного вихідного фрагмента чи всі репліки одного мовця використовують один спільний зразок.",
"voice_match_per_line": "Порядково",
diff --git a/electron/src/renderer/src/i18n/locales/vi.json b/electron/src/renderer/src/i18n/locales/vi.json
index c4836bb46..488c4ee74 100644
--- a/electron/src/renderer/src/i18n/locales/vi.json
+++ b/electron/src/renderer/src/i18n/locales/vi.json
@@ -762,6 +762,9 @@
"burn_subs_title": "Hiển thị phụ đề trực tiếp vào luồng video MP4 (hardsub). Sử dụng định dạng phụ đề kép khi phụ đề kép được bật.",
"timing_smart_fit": "Khớp thông minh",
"timing_smart_fit_title": "Chia đôi gánh nặng: tăng nhẹ tốc độ âm thanh (giữ cao độ, tối đa 1,5×) và làm chậm nhẹ đoạn video đó (tối đa 2×) để lời thoại ở nhịp tự nhiên vừa khít. Phần vượt giới hạn sẽ bị cắt và được đánh dấu. Xuất sẽ mã hóa lại video.",
+ "fit_speed_hint": "Giới hạn tốc độ của Smart Fit. Giới hạn hẹp giữ giọng nói tự nhiên; giới hạn rộng giúp vừa nhiều dòng hơn mà không cần cắt. Giá trị mặc định phù hợp với hầu hết video.",
+ "fit_max_speed": "Tốc độ nhanh nhất",
+ "fit_min_speed": "Tốc độ chậm nhất",
"voice_match": "Khớp giọng:",
"voice_match_title": "Khớp giọng — mỗi câu lồng tiếng được nhân bản từ đoạn nguồn của chính nó, hay mọi câu của một người nói dùng chung một tham chiếu.",
"voice_match_per_line": "Theo câu",
diff --git a/electron/src/renderer/src/i18n/locales/zh-CN.json b/electron/src/renderer/src/i18n/locales/zh-CN.json
index 3e13b66f8..8bd2bc368 100644
--- a/electron/src/renderer/src/i18n/locales/zh-CN.json
+++ b/electron/src/renderer/src/i18n/locales/zh-CN.json
@@ -778,6 +778,9 @@
"burn_subs_title": "将字幕直接渲染到 MP4 视频流中。开启双字幕时使用双字幕格式。",
"timing_smart_fit": "智能适配",
"timing_smart_fit_title": "两边各让一步:音频略微加速(保持音高,最高 1.5×),该片段的视频略微放慢(最高 2×),让自然语速的配音刚好放下。超出上限的部分会被裁剪并标记。导出时会重新编码视频。",
+ "fit_speed_hint": "智能适配的速度限制。范围越窄语音越自然,范围越宽越能在不裁剪的情况下容纳更多台词。默认值适合大多数视频。",
+ "fit_max_speed": "最快速度",
+ "fit_min_speed": "最慢速度",
"voice_match": "音色匹配:",
"voice_match_title": "音色匹配 — 每句配音是从自己的源片段克隆,还是同一说话人的所有句子共用一个参考。",
"voice_match_per_line": "逐句",
diff --git a/electron/src/renderer/src/i18n/locales/zh-TW.json b/electron/src/renderer/src/i18n/locales/zh-TW.json
index 6d6927fc8..ee628bcbe 100644
--- a/electron/src/renderer/src/i18n/locales/zh-TW.json
+++ b/electron/src/renderer/src/i18n/locales/zh-TW.json
@@ -762,6 +762,9 @@
"burn_subs_title": "將字幕直接渲染到 MP4 視訊串流中(硬字幕)。當雙字幕開啟時使用雙字幕格式。",
"timing_smart_fit": "智慧適配",
"timing_smart_fit_title": "兩邊各退一步:音訊稍微加速(保持音高,最高 1.5×),該片段的影片稍微放慢(最高 2×),讓自然語速的配音剛好放得下。超出上限的部分會被裁剪並標記。匯出時會重新編碼影片。",
+ "fit_speed_hint": "智慧適配的速度限制。範圍越窄語音越自然,範圍越寬越能在不裁剪的情況下容納更多台詞。預設值適合大多數影片。",
+ "fit_max_speed": "最快速度",
+ "fit_min_speed": "最慢速度",
"voice_match": "音色匹配:",
"voice_match_title": "音色匹配 — 每句配音是從自己的來源片段複製,還是同一說話者的所有句子共用一個參考。",
"voice_match_per_line": "逐句",
diff --git a/mobile/contract/openapi.json b/mobile/contract/openapi.json
index 7ac42dd88..7d07370fa 100644
--- a/mobile/contract/openapi.json
+++ b/mobile/contract/openapi.json
@@ -2257,6 +2257,19 @@
],
"title": "Max Audio Only Rate"
},
+ "min_audio_rate": {
+ "anyOf": [
+ {
+ "maximum": 1.0,
+ "minimum": 0.5,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Min Audio Rate"
+ },
"video_slow_cap": {
"anyOf": [
{
diff --git a/tests/test_fit_planner.py b/tests/test_fit_planner.py
index 389c186e8..35127f594 100644
--- a/tests/test_fit_planner.py
+++ b/tests/test_fit_planner.py
@@ -410,3 +410,11 @@ def test_fit_fingerprint_is_stable():
json.dumps(payload, sort_keys=True, ensure_ascii=False).encode("utf-8")
).hexdigest()[:16]
assert fit_fingerprint({}) == expected
+
+
+def test_fit_fingerprint_min_audio_rate_only_counts_when_not_default():
+ # Tracks fitted before the knob existed must not look stale after upgrade.
+ assert fit_fingerprint({"min_audio_rate": 0.85}) == fit_fingerprint({})
+ assert fit_fingerprint({"min_audio_rate": None}) == fit_fingerprint({})
+ assert fit_fingerprint({"min_audio_rate": 0.6}) != fit_fingerprint({})
+ assert fit_fingerprint({"min_audio_rate": 0.6}) == fit_fingerprint({"min_audio_rate": 0.60})
diff --git a/tests/test_sidecar_ping_stays_cheap.py b/tests/test_sidecar_ping_stays_cheap.py
new file mode 100644
index 000000000..77a974f02
--- /dev/null
+++ b/tests/test_sidecar_ping_stays_cheap.py
@@ -0,0 +1,79 @@
+"""A sidecar's ping must not import torch just to report VRAM (#2837).
+
+``health_check`` spawns the sidecar and pings it under a 60 s deadline. Every
+sidecar answered the ping with ``_measure_vram_mb()``, which imported torch, so
+on a cold start the engine "Test" could time out and report the engine
+unavailable although the model loaded and generated fine moments later. Until
+the model is loaded nothing is allocated, so the answer is 0 without the import.
+"""
+from __future__ import annotations
+
+import importlib.abc
+import importlib.util
+import sys
+from pathlib import Path
+
+import pytest
+
+ENGINES = Path(__file__).resolve().parents[1] / "backend" / "engines"
+SIDECARS = sorted(
+ p for p in ENGINES.glob("*/main.py") if "def _measure_vram_mb" in p.read_text(encoding="utf-8")
+)
+
+
+class _WatchTorch(importlib.abc.MetaPathFinder):
+ """Records torch import attempts (the probes swallow exceptions, so raising
+ here would hide the very regression this test exists to catch)."""
+
+ def __init__(self):
+ self.attempts = []
+
+ def find_spec(self, name, path=None, target=None):
+ if name.split(".")[0] == "torch":
+ self.attempts.append(name)
+ return None
+
+
+def test_sidecars_were_discovered():
+ assert len(SIDECARS) >= 8
+
+
[email protected]("script", SIDECARS, ids=lambda p: p.parent.name)
+def test_ping_vram_probe_does_not_import_torch(script, monkeypatch):
+ spec = importlib.util.spec_from_file_location(f"_ping_{script.parent.name}", script)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ monkeypatch.delitem(sys.modules, "torch", raising=False)
+ watch = _WatchTorch()
+ monkeypatch.setattr(sys, "meta_path", [watch, *sys.meta_path])
+ assert module._measure_vram_mb() == 0.0
+ assert watch.attempts == []
+
+
+def test_failed_health_check_keeps_its_reason_in_the_local_log(monkeypatch, caplog):
+ from services.subprocess_backend import SubprocessBackend
+
+ class Broken(SubprocessBackend):
+ id = "_broken"
+ sample_rate = 24000
+ supported_languages = ["multi"]
+
+ @classmethod
+ def is_available(cls):
+ return True, "ready"
+
+ @classmethod
+ def venv_python(cls):
+ return Path(sys.executable)
+
+ @classmethod
+ def sidecar_script(cls):
+ return Path("missing-sidecar.py")
+
+ backend = Broken()
+ monkeypatch.setattr(backend, "_spawn", lambda: (_ for _ in ()).throw(RuntimeError("boom ready")))
+ with caplog.at_level("WARNING"):
+ ok, message = backend.health_check()
+ assert not ok and "boom ready" in message
+ assert any("[_broken] health check failed" in r.getMessage() and "boom ready" in r.getMessage()
+ for r in caplog.records)
diff --git a/tests/test_smart_fit_generate.py b/tests/test_smart_fit_generate.py
index 6f55c11a3..66bda5ca7 100644
--- a/tests/test_smart_fit_generate.py
+++ b/tests/test_smart_fit_generate.py
@@ -360,6 +360,33 @@ def test_smart_fit_fit_options_override(patched_generate):
assert not (job_dir / "dubbed_es.wav").exists()
+def test_smart_fit_min_audio_rate_override_widens_and_disables_underrun_fill(patched_generate):
+ run, model, job, job_dir = patched_generate
+ # seg0 [0,1] natural 0.5s sits in a ~1.95s slot: the default 0.85 floor
+ # slows it only to 0.85x; a 0.6 floor lets it stretch further, and 1.0
+ # turns the fill off (#2896).
+ segs = [
+ {"start": 0.0, "end": 1.0, "text": "0.5:hola"},
+ {"start": 2.0, "end": 3.0, "text": "2.2:buenos dias"},
+ ]
+ wide = _done(run(_body(segs, timing_strategy="smart_fit",
+ fit_options={"min_audio_rate": 0.6})))
+ assert wide["fit_status"][0]["audio_rate"] == pytest.approx(0.6, abs=1e-3)
+ off = _done(run(_body(segs, timing_strategy="smart_fit",
+ fit_options={"min_audio_rate": 1.0})))
+ assert off["fit_status"][0]["status"] == "fits"
+
+
+def test_smart_fit_rejects_out_of_range_min_audio_rate():
+ from pydantic import ValidationError
+
+ for bad in (0.2, 1.5, float("nan"), float("inf")):
+ with pytest.raises(ValidationError):
+ DubRequest(**_body([{"start": 0.0, "end": 1.0, "text": "x"}],
+ timing_strategy="smart_fit",
+ fit_options={"min_audio_rate": bad}))
+
+
# ── Strategy-transition guard + fit-only re-mix ────────────────────────