Orshot Logo
OrshotDocs
Video Generation

Adding Subtitles

Learn how to add automated subtitles to your generated videos

Orshot allows you to automatically generate and overlay subtitles on your videos from an audio, video, or SRT source. This is perfect for creating social media clips, localized content, or accessible videos.

Basic Usage

To add subtitles, you need to provide a subtitleSource in the videoOptions object when calling the render API.

Single Page Templates

For single-page templates, pass a direct URL string to your source file.

{
  "templateId": "your-template-id",
  "modifications": {
    "text": "Hello World"
  },
  "response": {
    "format": "mp4"
  },
  "videoOptions": {
    "subtitleSource": "https://example.com/audio.mp3",
    "subtitleColor": "#ffffff",
    "subtitleBackground": "rgba(0,0,0,0.5)",
    "subtitleFontSize": "32px",
    "subtitleBottom": "50px"
  }
}

Multi-Page Templates

For multi-page templates (like carousels turned into video slideshows), you can specify different subtitle sources for each page. Each page's video segment will use its corresponding source.

Pass an array of objects, where each object specifies the page number and the url.

{
  "templateId": "your-multipage-template-id",
  "modifications": { ... },
  "response": {
    "format": "mp4",
    "includePages": [1, 2]
  },
  "videoOptions": {
    "subtitleSource": [
      {
        "page": 1,
        "url": "https://example.com/intro-audio.mp3"
      },
      {
        "page": 2,
        "url": "https://example.com/part-2-audio.mp3"
      }
    ],
    // Styling applies globally to all pages
    "subtitleColor": "#ffffff",
    "subtitleBackground": "#000000"
  }
}

If a page number is omitted from the array, that specific page will render without subtitles.

Supported Formats

The subtitleSource URL can point to:

  • Audio Files: .mp3, .wav, .m4a (Automated transcription via OpenAI Whisper)
  • Video Files: .mp4, .mov, .webm (Audio extracted & transcribed)
  • Subtitle Files: .srt (Used directly without transcription)

Styling Options

You can customize the appearance of the subtitles using the following videoOptions properties:

PropertyTypeDefaultDescription
subtitleColorstring"white"Text color (hex, rgb, or name)
subtitleBackgroundstring"transparent"Background color of the text box
subtitleFontSizestring"30px"CSS font size value
subtitleFontFamilystring"Arial, sans-serif"Font family (Supports Google Fonts automatically)
subtitleBottomstring"50px"Distance from the bottom of the video

Font Support

You can use any Google Font by simply specifying its name in subtitleFontFamily. The system will automatically fetch and load it.

"videoOptions": {
  "subtitleFontFamily": "Inter, sans-serif"
}

On this page