Skip to content

feat(desktop-gpui): download captions as SRT or WebVTT - #4247

Open
richiemcilroy wants to merge 5 commits into
mainfrom
feat/gpui-export-captions
Open

richiemcilroy wants to merge 5 commits into
mainfrom
feat/gpui-export-captions

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Download the captions as a subtitle file: the download button in the Transcript tab offers SubRip (.srt) and WebVTT (.vtt), timed to the edited video.

Screenshots

Linux under Xvfb at 1600x1000, debug build of #4245, #4246 and #4247 combined, on a 52 s recording with a word-timed transcript. The real editor is driven with xdotool and recorded with ffmpeg (probe run). Screen recordings: light, dark.

Light Dark
Download menu in the Transcript header Download menu, light Download menu, dark
After SubRip (.srt): Captions saved Captions saved, light

Files the run saved through the file chooser: captions.srt, captions.vtt. They carry the corrected word ("misheard.") and the two hand-added captions (cues 4 and 5). Cue ends sit about 0.15 s after each caption's end, the fade-out this PR includes.

macOS still (the download button (SRT / WebVTT) in the Transcript header):

Transcript tab, light, macOS

How it works

flowchart LR
  A[timeline.caption_segments<br/>projected through cuts, speed,<br/>transitions, fullscreen holds] --> B[caption_display_segment<br/>hide fillers like the renderer]
  B --> C[drawn range, then fade-out tail]
  C --> D[track order decides who is on screen]
  D --> E[SRT or WebVTT text]
  E --> F[save panel, named after the recording]
Loading
  • The 0.6.0 editor had SRT and VTT buttons in its captions panel (TranscriptPage.tsx, captions-export.ts). The GPUI editor had no way to get captions out except burned into the video.
  • cues (src/caption_export.rs) reads the caption track the renderer draws, which is already projected through cuts, clip speeds, transitions and fullscreen holds, and shapes it the way find_active_caption_segment (crates/rendering/src/layers/captions.rs) shows it:
    • fillers the captions hide (English captions with "Show filler words" off) are left out, and a caption that is only a filler is dropped
    • a caption is drawn until at most MAX_CAPTION_WORD_DURATION after its last word starts, then fades out for its fade duration; the cue runs until the fade ends unless another caption takes over first
    • where captions overlap, the first in track order that is drawn at that moment is on screen, exactly as find_active_caption_segment picks it. A caption interrupted by another becomes two cues, and one that is never on screen is left out
  • Cue text keeps every line, with control characters dropped and whitespace collapsed, so a cue can never end early on a blank line. Unicode, right-to-left text, CJK and emoji are written as typed, in UTF-8.
  • WebVTT escapes &, < and > (which also covers -->). SubRip has no escaping and is written as is.
1
00:00:00,111 --> 00:00:00,445
hello

2
01:02:03,004 --> 01:02:05,000
Cap <b> & fast --> captions
WEBVTT

1
00:00:00.111 --> 00:00:00.445
hello

2
01:02:03.004 --> 01:02:05.000
Cap &lt;b&gt; &amp; fast --&gt; captions
  • The button uses the editor's existing toolbar menu (ToolbarMenu::CaptionDownload, src/editor_window.rs) and the same save panel and file naming as video export (export_file_name, now pub(crate)). It is enabled whenever the caption track has captions, with or without a transcript. The file is written off the main thread, and the result shows as an editor notice.

Callers checked

  • export_file_name: only its visibility changed; video export still calls it the same way.
  • ToolbarMenu: every match (toolbar_menu_items, choose_toolbar_menu, render_toolbar_menu) handles the new variant. Aspect ratio and preview speed are unchanged.

What could regress

  • Nothing existing changes behaviour: the export only reads the project.
  • Projects saved by 0.6.0 and 0.6.1 to 0.6.3 export the same way, because the caption track is derived on load for both.

Tests added

  • src/caption_export.rs
    • srt_and_vtt_are_written_to_spec
    • cue_text_never_breaks_a_cue_and_keeps_unicode
    • overlapping_captions_keep_the_one_on_screen
    • the_earlier_caption_in_the_track_wins_even_when_it_shows_later
    • a_fade_out_lasts_until_the_next_caption_or_its_own_length
    • hidden_fillers_and_word_lingers_match_the_renderer
    • timings_follow_cuts_speed_and_holds_of_the_edited_video
    • two_hours_of_captions_export_quickly_with_long_timestamps
  • src/i18n/editor_shell_surface_tests.rs: the new strings

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Adds SRT and WebVTT downloads from the Transcript tab, timed to the edited video.

  • The Transcript tab saves captions as SRT or WebVTT files.

Reviews (13) · Last reviewed commit: "docs(desktop-gpui): drop the caption exp..." · Reviewed by Greptile

@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Ignored Ignored Preview Nov 16, 2026 8:55pm UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status November 14, 2026 05:05 Inactive
@sandchest-com

sandchest-com Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Sandchest

Sandchest reviewed 6ddbfdc: nothing exploitable found in this change.

Sandchest reviews every change for vulnerabilities an attacker could use · 1 credit · Review details

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Capy found 1 potential issue (1 medium).

View 1 other finding in Capy.

Open in Capy

Comment thread apps/desktop-gpui/src/caption_export.rs Resolved
Comment thread apps/desktop-gpui/src/caption_export.rs Resolved
Comment thread apps/desktop-gpui/src/editor_window.rs Resolved
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

Comment thread apps/desktop-gpui/src/caption_export.rs Resolved
@vercel
vercel Bot temporarily deployed to Preview – cap-status November 16, 2026 10:11 Inactive
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

# Conflicts:
#	apps/desktop-gpui/locales/de.toml
#	apps/desktop-gpui/locales/en.toml
#	apps/desktop-gpui/locales/es.toml
#	apps/desktop-gpui/locales/fr.toml
#	apps/desktop-gpui/locales/hi.toml
#	apps/desktop-gpui/locales/ja.toml
#	apps/desktop-gpui/locales/zh-CN.toml
#	apps/desktop-gpui/src/i18n/editor_shell_surface_tests.rs
#	apps/desktop-gpui/src/transcript/view.rs

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

This branch was successfully deployed

1 active and 1 inactive (outdated) deployments
Preview – cap-web — 6ddbfdc4 Deployed Nov 16, 2026 by vercel[bot]
Preview – cap-status — 19db9acc Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant