Repository navigation
Translate: timed subtitles from video files - #19029
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Nov 23, 2026
# Conflicts: # studio/frontend/src/features/translate/translate-subtitles.ts
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.
Related to #18666
Summary
A video file dropped on the Translate page now becomes a timed subtitle file when the Voice settings speech model reports segment timings. The transcript is turned into an SRT, which then goes through the subtitle path from #18992, so every cue keeps its timing and the Download subtitles action appears (
trip.mp4translated into French saves astrip.fr.srt). Audio files and every other flow are unchanged.Backend (opt-in, default byte-identical)
POST /api/inference/audio/transcribe/rawtakes a new optionaltimestampsquery flag (defaultfalse).response_format=verbose_json(plusno_language_probabilities=true, so it does not run a second language detection pass) and the result gainssegments: [{start, end, text}]in seconds. Thetextfield is built exactly as before.segmentson this route today.Frontend
transcribeAudioBlobgets an optionalonSegmentscallback. Only when it is passed does the request carrytimestamps=true, and the callback only fires when the engine actually returned segments.segmentsToSrtbuilds an SRT (dictation dictionary applied per cue) and the page loads it with the file name, so the existing subtitle detection, batching and download take over. With no segments the plain transcript loads, as today.subtitleFileNamealso strips video extensions.Scoped out, and why
pipeline. It callsmodel.generatein a worker subprocess, and the worker sends back{"type": "text", "text", "consumed"}per 30 s window (stt_transformers_worker.pytranscribe_window, decoded withskip_special_tokens=True). Returning segments would mean changing that worker protocol for the subprocess, in-process and MLX engines, which is more than a small opt-in change. These models keep today's plain transcript.ON_REQUEST_TIMESTAMPS). This change does not start that download for a Translate drop.stt_capabilities) still reports whisper.cpp as having no timestamps, so the Transcribe page is unchanged.Tests
tests/test_stt_ggml_sidecar.py: the flag sendsverbose_json+no_language_probabilities, segments are normalised (blank and untimed ones dropped), and the default request sendsjsonand returns the same four keys as before.tests/test_stt_raw_timestamps.py: the route passestimestamps=Trueonly to whisper.cpp; the default response is unchanged for gguf, mtmd, transformers and audiocpp.pytest tests/test_stt_raw_timestamps.py tests/test_stt_ggml_sidecar.py tests/test_stt_context_settings.py tests/test_stt_transcription_cancellation.py tests/test_stt_broken_runtime_falls_back.py tests/test_stt_ggml_request_path.py: 128 passed.segmentsToSrtoutput parses as SRT with the expected cues, timings, rounding past one hour and empty-input handling; video naming; the page asks for timings only for video files. Translate tests 88/88, fullnpm test17057 passed, 0 failed.npm run typecheckclean; eslint on the touched files reports the same findings asmain, nothing new.Not verified here
examples/server/server.cppinunslothai/whisper.cpp(segments carrystart/endin seconds when timestamps are on, which Studio never turns off).Before / after
A 23 second MP4 of speech dropped on Translate in a real Studio (CPU), with Whisper tiny on whisper.cpp as the Voice model, translated into French with Hy-MT2 1.8B. Before, the video becomes one plain paragraph; after, it becomes 8 timed cues, translated with every timing kept, and the result has a Download subtitles action:
Also checked the backend change directly against a real whisper-server with ggml base.en on WAV and MP4 input: the default response is unchanged and
timestamps=trueadds segments with real timings.