Add VTT subtitle export and --chars-per-caption option#126
Merged
Conversation
Two gaps vs on-device transcription CLIs (e.g. yap): - `-o vtt` exports WebVTT captions via the SDK's /vtt endpoint, next to the existing `-o srt`, on both `transcribe` and `transcripts get`. - `--chars-per-caption N` caps the caption line length for the srt/vtt exports (the API's chars_per_caption knob). The flag is shared via an options.py factory and rejected up front with any non-subtitle `-o`, before any upload/fetch. --show-code mirrors both: `-o vtt` generates export_subtitles_vtt(), and the knob lands in the generated export call as a kwarg. https://claude.ai/code/session_01VkY5GdVBVM31FbGwpb9sb9
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.
Summary
Adds support for VTT (WebVTT) subtitle export alongside the existing SRT format, and introduces a
--chars-per-captionoption to control caption line length for both subtitle formats.Key Changes
vttas an output choice (-o vtt) for bothtranscribeandtranscripts getcommands, mirroring the existing SRT support--chars-per-captionoption (integer ≥1) that forwards to the SDK's subtitle export methods for both SRT and VTT formatsvalidate_chars_per_caption()to ensure the flag is only used with subtitle output formats, rejecting it for text/id/status/utterances/json with a helpful error message_SUBTITLE_RENDERERSdict separate from_FIELD_RENDERERS, allowing both formats to share thechars_per_captionparameter handling_SubtitleTranscriptprotocol to type-hint the subtitle export interface--show-codeto emit correct export calls withchars_per_captionwhen specified (e.g.,transcript.export_subtitles_vtt(chars_per_caption=42))Implementation Details
chars_per_captionparameter is validated early in bothtranscribeandtranscripts getcommands before any API calls--outfile) correctly forward the parameter--show-codefeature generates executable Python that includes thechars_per_captionargument in subtitle export callschars_per_caption=Noneis passed when not specifiedhttps://claude.ai/code/session_01VkY5GdVBVM31FbGwpb9sb9