Repository navigation
feat(timeline): captions track with styled, editable captions and burned-in export - #288
Merged
Merged
Conversation
9 tasks
edenreich
marked this pull request as ready for review
September 18, 2026 21:35
…e karaoke tags A captions track fell into the audio bed, so a caption clip with a src became an ffmpeg input. The \k tags also ran back to back from the dialogue start, drifting against the preview, which times every word from its absolute start. The sidecars are now written after the libass check, not before it.
Nothing produced caption clips: the lane, the preset select and the burn-in all existed, but the only way in was hand-editing the JSON. The video-editing skill now documents the captions track, where the text comes from and the ~5 s chunking, a toolbar button asks the agent for captions, and a + on the captions lane inserts one at the playhead. spokenCount no longer counts captions as voice, and media no longer drops on a captions lane.
4 tasks
…tton The marker button dropped a draft clip on whichever audio track happened to hold speech, which read as a timeline marker and behaved like neither. Each audio and captions lane now carries a + that inserts an empty clip at the playhead on that lane, selected and ready to type in. addEmptyClip replaces addMarker: it skips past a clip the playhead sits in so a lane never holds two clips at once, and appends past a full lane like a dropped file does. Also fixes playback: syncMedia only paused media that had fallen outside its range, so Space stopped the playhead while the video and audio under it kept playing.
The four presets differed only in word colouring, so they read as one look. They now carry size, weight, case, outline and colour in one table per side - a broadcast subtitle on a box, a huge uppercase yellow punch line, a green per-word pop and a dim-to-white karaoke fill - and the preview reads that table instead of branching per name. Captions are also placed by dragging the block on the preview: the track gains x/y, the centre of the block as fractions of the frame, which the export burns in as an5 pos() and which win over position. Double-clicking the block clears them.
…e silently Redo sent a fixed "with my cloned voice" prompt, so the sample was whatever the agent had settled on and there was no way to change it - the lane header's sample select only appears once a track already holds speech. The redo prompts now ask for the sample, and the skill gains a Picking the voice section: list the library, ask with AskUserQuestion, one option per sample plus Random plus the recording itself when source_audio is transcribe, and write the pick back into voice_sample.
…he restart Enabling text to speech saves the config and restarts the gateway so AUDIO_ENABLED reaches it, but start_gateway returned early whenever anything answered the gateway URL. With a leaked gateway from an earlier session holding the port, the restart became a no-op: the freshly spawned gateway could not bind, stayed up serving only its metrics port, and every request kept going to the old process with audio off - a 404 from TextToSpeech and no way to tell why. Reuse is now decided by reuse_running_gateway: a plain start still adopts a gateway the desktop does not own, which is how an externally run one is supported, but a force or restart says so instead of pretending to have restarted.
Saving API keys restarts the gateway so the keys reach its env, but the only caller swallowed the failure into console.error, so a restart that could not happen looked like it had.
…ts wav Dragging the right edge of a voice clip outwards pulled it back to where the speech ends, and its left edge would not move outwards at all. trimClip clamps a clip's tail to its source length, which is right for a music or video file but not for a spoken clip: the wav is synthesized to fit a slot and is routinely shorter than it, so the clamp fired on the first pixel of the drag. Spoken clips are now exempt from the source-length clamp on both edges, and a head trim can no longer produce a negative offset.
Clips only carried the track voice, so a lane of speech gave no way to see which sample each clip was cloned from or to change one without the agent asking. A spoken clip now keeps its own voice_sample, wears a stripe in that sample's colour, and the clip editor names it in a dropdown next to Redo voice - picking another drafts the clip and the redo prompt names it instead of asking. The picker is shared with the lane header, whose blank option listed the current sample twice.
Contributor
Author
|
🎉 This PR is included in version 0.44.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #279
Summary
Adds a
captionstrack kind to the<stem>.timeline.jsoncontract: caption clips carrytext,start,endand optional per-wordwords, and the track carries astylepreset plus a placement -position(bottom,center,top) orx/y, the centre of the caption block as fractions of the frame, set by dragging the block on the preview. Four style presets are defined once per side as a table of size, weight, case, outline and colour (TS for the preview, Rust for the export) and rendered identically, in the looks the short-form platforms ship:classica broadcast subtitle on a translucent box,bolda huge uppercase yellow punch line,highlighta green per-word pop that stays,karaokea dim-to-white fill; the desktop draws the active caption over the video in the preview, burns captions into the export through a generated.assfile (subtitles=filter, with\ktiming for the word presets) and writes a sidecar.srtintoexport/.Captions can be created from either end: the toolbar's captions button asks the agent, which follows the new captions rules in the video-editing skill (text from the spoken clips or the whisper transcript, chunked to about 5 s), and
+on the captions lane inserts a caption at the playhead to type in directly. A caption clip can also be voiced with "Speak this", which drafts a spoken audio clip for the existing TTS flow.That
+replaces the old marker button, which dropped a draft clip on whichever audio track happened to hold speech: every audio and captions lane now carries its own, and the clip it inserts never overlaps what is already on the lane.Changes
frontend/lib/timeline.ts:TrackKindgainscaptions; captions tracks carryx/y(clamped to the frame) andmoveCaptionssets or clears them; caption clips parse/serializewords; tracks carrystyle(unknown names fall back to the default preset) andposition;CAPTION_STYLEScatalogue;captionTrackhelper;addEmptyClipreplacesaddMarkerand inserts an empty clip on a named lane, skipping past a clip the playhead sits in and appending past a full lane like a dropped file;speakClipcreates/updates a draft spoken clip from a caption;setClipTextonly marks spoken audio clips draft;spokenCountcounts audio tracks only; captions lanes stack with overlays above the video.frontend/components/TimelineView.tsx: the stage draws the active caption styled by the preset (word-by-word highlight/karaoke in step with the playhead), a preset select and anAdd captionbutton on the captions lane header,Add voice clipon audio lane headers in place of the toolbar's marker button, anAdd captionstoolbar button that asks the agent, one captions track in the add-track row, caption clips are editable/movable/trimmable/deletable like other clips, and the clip editor gains a caption textarea plus a "Speak this" button. Media no longer drops onto a captions lane.syncMedianow pauses the clip under the playhead, so Space stops the video and not just the playhead.CaptionOverlayreads the preset table instead of branching per preset name, and the caption block drags on the stage to place it (double-click puts it back onposition).backend/src/timeline.rs:export_argschainssubtitles=<file>onto the picture label when a captions track exists;caption_sidecarsrenders the track to<stem>.ass(one ASS style per preset,\an5\pos()for a dragged block,\ktiming with a tag of its own for a pause before a word, uppercase forbold, bottom/center/top placement) and writesexport/<stem>.srt; the audio mix no longer pulls in the captions track; the sidecars are written after the libass check; a missingsubtitles(libass) filter in the chosen ffmpeg is reported as an error, not silently skipped; unit tests in the style ofexport_args_delays_and_mixes_every_clip..agents/skills/video-editing/SKILL.md: documents the captions track in the contract, a## Captionssection with the text sources, the ~5 s chunking rules, the presets and thewhisper-cli -ml 1pass for word timing, and the libass prerequisite.Voice sample choice: the redo prompts ask which sample to clone instead of sending a fixed "with my cloned voice", and the skill gains a
## Picking the voicesection - the track'svoice_samplewins when the user set it on the lane header, otherwise list~/.infer/models/tts/samples/and ask withAskUserQuestion, one option per sample plusRandomplusMy voice from the recordingwhensource_audioistranscribe, then write the pick back intovoice_sample. Nothing to choose between means no question.frontend/store.tsx: the content-project guidance routes "add captions" to the skill.e2e/tests/captions.yamlande2e/tests/voice-sample-choice.yaml+e2e/scenarios.yaml: the agent writes a captions track to the timeline, and a redo asks which voice sample to clone before synthesizing.backend/src/gateway.rs+backend/src/process_manager.rs:start_gatewayreturned early whenever anything answered the gateway URL, so aforceorrestartwas a no-op when a leaked gateway from an earlier session held the port - the new gateway could not bind, stayed up on its metrics port only, and requests kept reaching the old process withAUDIO_ENABLEDunset, which is a 404 fromTextToSpeechwith nothing to explain it.reuse_running_gatewaydecides it now: a plain start still adopts a gateway the desktop does not own, a restart reports it.frontend/lib/timeline.ts:trimClipclamped a clip's tail to its source length, which is right for a music or video file but not for a spoken clip - the wav is synthesized to fit a slot and is routinely shorter than it, so dragging a voice clip's right edge outwards snapped it back to the end of the speech, and its left edge would not move outwards at all. Spoken clips are exempt on both edges, and a head trim can no longer produce a negativeoffset.Notes
[DOCS]ticket for the captions contract and preset catalogue: [DOCS] Desktop: captions track and the caption preset catalogue docs#696.