Skip to content

fix: improve auto caption runtime setup and generation flow#712

Open
QuentinCrane wants to merge 4 commits into
webadderallorg:mainfrom
QuentinCrane:fix/auto-caption-whisper-resolution
Open

fix: improve auto caption runtime setup and generation flow#712
QuentinCrane wants to merge 4 commits into
webadderallorg:mainfrom
QuentinCrane:fix/auto-caption-whisper-resolution

Conversation

@QuentinCrane

@QuentinCrane QuentinCrane commented Jun 28, 2026

Copy link
Copy Markdown

Summary

  • resolve Whisper CLI from a selected executable or folder, WHISPER_CPP_PATH, common Windows/macOS locations, the bundled runtime, and PATH
  • improve caption setup UI with explicit model, Whisper engine, FFmpeg, audio, and error states
  • add separate folder/file pickers plus Show-in-folder actions for caption dependencies
  • fall back to companion microphone/system-audio files when the main recording has no usable audio track
  • report real Whisper transcription progress and automatically show successfully generated captions
  • preserve the caption timeline/editor and silence-aware segmentation now present on main

Context

Addresses the remaining Windows and runtime-discovery paths reported in #220. The macOS packaging-only path was handled separately in #333. Proxy-aware model downloading from #704 remains a separate network/download concern; this PR provides a clear manual-model path but does not claim to implement proxy transport.

Validation

  • rebased onto current main (360b160); GitHub reports the PR mergeable
  • npx tsc --noEmit
  • npm run lint (passes; existing repository hook warnings remain non-blocking)
  • npx vitest --run electron/ipc/captions src/components/video-editor/captionSetupStatus.test.ts src/components/video-editor/editorPreferences.test.ts (67 tests passed)
  • full npm test: 107 suites / 1006 tests passed; one unrelated exporter suite timed out during parallel import, then passed 5/5 when rerun alone
  • CodeRabbit review feedback addressed in f6d38b9
  • Biome formatting and lint checks on all changed files
  • git diff --check origin/main

Manual verification previously completed

  • local Windows dev app with a recording, ggml-small.bin, and C:\Tools\whisper\whisper-cli.exe

Follow-up direction

A larger caption workflow can build on the merged timeline/editor for translation, proofreading, and burn-in/soft-mux export. This PR stays focused on making Recordly's existing auto-caption generation path reliable and understandable.

Summary by CodeRabbit

  • New Features
    • Added guided caption setup for the Whisper model, transcription engine, and audio extractor.
    • Added caption-generation progress updates across multiple stages.
    • Added engine/model picker options and the ability to reveal the generated caption output in your system folder.
    • Improved auto-caption audio handling with smarter sidecar fallback.
  • Bug Fixes
    • Improved validation and clearer user-facing errors for missing/invalid caption resources.
    • Preserved explicit “cleared” Whisper model/engine selections in saved preferences.
  • Localization
    • Added/expanded caption workflow translations across supported languages.
  • Tests
    • Added coverage for Whisper path resolution, progress parsing, and caption audio fallback behavior.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Whisper caption generation now supports executable and model discovery, FFmpeg status checks, companion-audio fallbacks, streamed progress events, expanded IPC APIs, setup-aware editor controls, determinate progress UI, preference clearing, and localized workflow text.

Changes

Caption generation workflow

Layer / File(s) Summary
Whisper execution, discovery, and audio fallback
electron/ipc/captions/generate.ts, electron/ipc/captions/generate.test.ts
Whisper execution streams progress with timeout and output parsing, validates runtime files, broadens executable discovery, and falls back to companion audio tracks.
IPC and renderer bridge
electron/ipc/register/captions.ts, electron/preload.ts, electron/electron-env.d.ts, electron/ipc/captions/whisper.ts
Caption IPC supports picker options, runtime and FFmpeg status queries, folder reveal actions, normalized errors, and progress events exposed through the renderer bridge.
Editor setup state and caption controls
src/components/video-editor/captionSetupStatus.ts, src/components/video-editor/VideoEditor.tsx, src/components/video-editor/SettingsPanel.tsx, src/components/video-editor/editorPreferences.ts
The editor tracks caption prerequisites, errors, progress, and explicit cleared paths; centralized setup status drives controls, readiness states, folder actions, and determinate progress.
Caption workflow localization and validation
src/i18n/locales/*/settings.json, src/components/video-editor/captionSetupStatus.test.ts, src/components/video-editor/editorPreferences.test.ts
Caption workflow strings are expanded across locales, with tests covering setup status and cleared Whisper preferences.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VideoEditor
  participant CaptionIPC
  participant CaptionGenerator
  participant WhisperProcess
  VideoEditor->>CaptionIPC: request caption generation
  CaptionIPC->>CaptionGenerator: generate with progress callback
  CaptionGenerator->>WhisperProcess: spawn Whisper command
  WhisperProcess-->>CaptionGenerator: stream transcription progress
  CaptionGenerator-->>CaptionIPC: emit caption progress
  CaptionIPC-->>VideoEditor: deliver progress event
Loading

Possibly related PRs

Suggested reviewers: webadderall, extrabinoss

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the PR’s main focus on improving auto-caption runtime setup and generation flow.
Description check ✅ Passed The description covers the change summary, context, validation, and manual verification, though some template sections are left blank.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@QuentinCrane
QuentinCrane force-pushed the fix/auto-caption-whisper-resolution branch from acd7bf5 to 2591889 Compare July 18, 2026 03:15
@QuentinCrane
QuentinCrane marked this pull request as ready for review July 18, 2026 03:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/video-editor/SettingsPanel.tsx (1)

3016-3024: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not expose “Delete Model” for manually selected models.

This button appears for every whisperModelPath, but its handler deletes only the bundled small model. Track whether the selected path is the downloaded model; otherwise provide a non-destructive “Clear selection” action.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/video-editor/SettingsPanel.tsx` around lines 3016 - 3024,
Update the whisper model action in the SettingsPanel component so “Delete Model”
is shown only when the selected whisperModelPath refers to the bundled
downloaded small model. For manually selected paths, provide a non-destructive
“Clear selection” action that removes the selection without deleting files,
using the existing selection state or handler mechanisms.
src/i18n/locales/es/settings.json (1)

133-198: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Restore diacritics across the new Latin-language caption translations.

The new strings were ASCII-transliterated, producing visibly incorrect localized UI.

  • src/i18n/locales/es/settings.json#L133-L198: restore Spanish accents such as subtítulo, ningún, encontró, and configuración.
  • src/i18n/locales/fr/settings.json#L134-L198: restore French accents such as mis à jour, modèle, sélectionné, and générés.
  • src/i18n/locales/it/settings.json#L182-L218: restore Italian forms such as è and può.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/i18n/locales/es/settings.json` around lines 133 - 198, Restore the
missing language-specific diacritics in the caption translation strings: update
the affected Spanish entries in src/i18n/locales/es/settings.json (lines
133-198), French entries in src/i18n/locales/fr/settings.json (lines 134-198),
and Italian entries in src/i18n/locales/it/settings.json (lines 182-218),
including forms such as “subtítulo”, “ningún”, “encontró”, “configuración”, “mis
à jour”, “modèle”, “sélectionné”, “générés”, “è”, and “può”, without changing
the translation meanings or keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@electron/ipc/captions/generate.ts`:
- Around line 57-63: Update the timeout handling around the Whisper child
process so the timeout callback only signals termination, then reject from the
child’s close handler after Whisper has exited. Add a short grace period after
child.kill() and forcefully kill the process if it remains alive, while
preserving the existing timeout error and cleanup flow.

In `@electron/ipc/register/captions.ts`:
- Around line 212-215: Update the Windows extension filter near
runWhisperCommand usage to allow only executable files by removing cmd and bat
extensions, unless runWhisperCommand is also changed to launch scripts through
cmd.exe. Preserve the wildcard filter for non-Windows platforms.

In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 2989-3000: Update the success-toast logic near
setAutoCaptionSettings in VideoEditor so empty result.cues do not claim captions
were enabled. Show the existing “generated and turned on” message only when
cues.length is greater than zero, and use an appropriate separate success
message for zero cues or skip the toast.
- Around line 2763-2782: Update the asynchronous runtime-status checks in the
VideoEditor initialization flow to catch rejected getWhisperRuntimeStatus and
getCaptionFfmpegStatus IPC calls, clearing the corresponding executable path and
setting its error/status state instead of leaving it checking. Also clear stale
persisted Whisper and FFmpeg paths when results are unsuccessful, while
preserving the existing successful-path updates.

In `@src/i18n/locales/pt-BR/settings.json`:
- Around line 153-198: Restore Brazilian Portuguese diacritics throughout the
added translation block, including accents for words such as contém, não, áudio,
vídeo, configuração, and exibição. Proofread every value from engineHelp through
generatedToast and correct all comparable missing accents without changing the
translation meaning or keys.

---

Outside diff comments:
In `@src/components/video-editor/SettingsPanel.tsx`:
- Around line 3016-3024: Update the whisper model action in the SettingsPanel
component so “Delete Model” is shown only when the selected whisperModelPath
refers to the bundled downloaded small model. For manually selected paths,
provide a non-destructive “Clear selection” action that removes the selection
without deleting files, using the existing selection state or handler
mechanisms.

In `@src/i18n/locales/es/settings.json`:
- Around line 133-198: Restore the missing language-specific diacritics in the
caption translation strings: update the affected Spanish entries in
src/i18n/locales/es/settings.json (lines 133-198), French entries in
src/i18n/locales/fr/settings.json (lines 134-198), and Italian entries in
src/i18n/locales/it/settings.json (lines 182-218), including forms such as
“subtítulo”, “ningún”, “encontró”, “configuración”, “mis à jour”, “modèle”,
“sélectionné”, “générés”, “è”, and “può”, without changing the translation
meanings or keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aabbefe0-6e0c-4311-afdd-c045b58284af

📥 Commits

Reviewing files that changed from the base of the PR and between 360b160 and 2591889.

📒 Files selected for processing (20)
  • electron/electron-env.d.ts
  • electron/ipc/captions/generate.test.ts
  • electron/ipc/captions/generate.ts
  • electron/ipc/captions/whisper.ts
  • electron/ipc/register/captions.ts
  • electron/preload.ts
  • src/components/video-editor/SettingsPanel.tsx
  • src/components/video-editor/VideoEditor.tsx
  • src/components/video-editor/captionSetupStatus.test.ts
  • src/components/video-editor/captionSetupStatus.ts
  • src/i18n/locales/en/settings.json
  • src/i18n/locales/es/settings.json
  • src/i18n/locales/fr/settings.json
  • src/i18n/locales/it/settings.json
  • src/i18n/locales/ko/settings.json
  • src/i18n/locales/nl/settings.json
  • src/i18n/locales/pt-BR/settings.json
  • src/i18n/locales/ru/settings.json
  • src/i18n/locales/zh-CN/settings.json
  • src/i18n/locales/zh-TW/settings.json

Comment thread electron/ipc/captions/generate.ts
Comment thread electron/ipc/register/captions.ts Outdated
Comment thread src/components/video-editor/VideoEditor.tsx
Comment thread src/components/video-editor/VideoEditor.tsx Outdated
Comment thread src/i18n/locales/pt-BR/settings.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant