Generate subtitles automatically

Set output_type to "srt" or "vtt" and the transcript comes back as a finished caption file: numbered, time-cued, and line-wrapped. You don't need to process word timestamps yourself. This tutorial covers choosing a format, saving the file, and delivering it as a sidecar or burned into the video.

SRT vs VTT

Both are supported values of output_type (alongside txt, json, docx, and pdf). They differ in where you use them:

  • srt (SubRip): the universal default. Almost every video player, editor, and platform accepts it (YouTube, Premiere, VLC). Use it unless you need VTT.
  • vtt (WebVTT): the web format for the HTML5 <track> element. Use it when you serve captions to a browser <video> player.

See the Output formats & subtitles guide for the full list of formats and what each returns.

Generate and save the file

Pass the format as output_type, then call result.save(). It writes the content to disk, appends the correct extension if your path has none, and returns the path it wrote. For example, save("captions") with output_type="srt" writes captions.srt.

from speechrevolutions import SpeechRevolutions

client = SpeechRevolutions()  # reads SPEECHREVOLUTIONS_API_KEY

result = client.transcribe(
    "talk.mp4",              # audio or video: local path, URL, bytes, or file object
    output_type="srt",       # ask Speech Revolutions for SubRip captions (use "vtt" for WebVTT)
)

path = result.save("captions")  # writes captions.srt; returns the path
print(f"Wrote {path}")
Timestamps are already handled

With srt or vtt, the cues are built for you. You don't need to request word_timestamps or assemble cues from .words. Load the file into a player as-is.

What the file looks like

Cues follow standard captioning rules: one speaker per cue, at most two lines of 42 characters, at most 7 seconds, and a break at pauses longer than a second and at sentence ends. With speaker labels on (the default), the first line of each cue starts with the speaker, like SPEAKER_1: ; turn speaker_labels off for captions without it. The full rules are in Output formats.

captions.srt (excerpt)
5
00:00:11,599 --> 00:00:15,820
SPEAKER_1: It is very select and they are not giving
many invitations to clerks.

6
00:00:16,769 --> 00:00:18,769
SPEAKER_1: The whole official world will be there.

7
00:00:19,629 --> 00:00:25,399
SPEAKER_2: She looked at him with an irritated glance
and said impatiently, And what do you wish

8
00:00:25,460 --> 00:00:26,600
SPEAKER_2: me to put on my back?

Sidecar vs burned-in

There are two ways to show captions to a viewer. Choose based on where the video plays.

ApproachWhat it isBest when
SidecarShip the .srt/.vtt as a separate file alongside the video; the player overlays it at playback.You control the player (a web <video>, a streaming platform, VLC). Viewers can toggle captions on/off and you can serve multiple languages.
Burned-inRender the captions permanently into the video's pixels, so they're part of the picture.The destination has no caption support or you can't trust it to — social autoplay clips, embedded GIFs, downloads. Always visible; not toggleable.

Sidecar is the default and needs nothing beyond the saved file. For a browser player, point a <track> at the VTT file:

player.html
<video controls>
  <source src="talk.mp4" type="video/mp4" />
  <track src="captions.vtt" kind="subtitles" srclang="en" label="English" default />
</video>

Burning in happens outside Speech Revolutions: you render the subtitle file into the frames with a video tool. The common choice is ffmpeg, which reads your saved .srt:

burn-in with ffmpeg
# ffmpeg is third-party tooling, not part of Speech Revolutions — shown for completeness.
ffmpeg -i talk.mp4 -vf "subtitles=captions.srt" talk-captioned.mp4

Use sidecar whenever the player supports it. Captions stay accessible, toggleable, translatable, and editable without re-encoding the video. Use burned-in only when the player can't render a separate track.

To generate captions from an upload with a live progress bar, combine this with the meeting-app tutorial; for the full format reference see Output formats & subtitles.