Back to Blog

Adding Text Overlay Captions to Videos with FFMPEGAPI.net

June 2026 FFMPEG API Team

In today's digital landscape, adding caption overlays to videos is crucial for enhancing accessibility and user engagement. Developers can leverage FFMPEGAPI.net's hosted REST API to easily implement text overlays with just a few lines of code. This article explores how to use the Text Overlay Captions endpoint to dynamically add captions to your videos.

What is the Text Overlay Captions API?

The Text Overlay Captions API at FFMPEGAPI.net allows developers to render text lines as timed overlays on videos. This means you can display your custom captions according to your desired timing, style, and position, ensuring that your message reaches viewers effectively.

  • Render text overlays on any video hosted online.
  • Customize captions with styles like plain white or background colors.
  • Control the position and duration of each caption line.

How to Use the Text Overlay Captions API

To add text overlay captions to your video, you'll need to make a POST request to the following endpoint: /api/videos/add-text-overlay-captions. The API expects a JSON payload with specific parameters such as the video URL, text for the captions, and optional styling options.

  • Required parameters: video_url, text.
  • Optional parameters: subtitle_style, aspect_ratio, position, duration_per_line.
import requests

url = 'https://ffmpegapi.net/api/videos/add-text-overlay-captions'
data = {
    'video_url': 'https://example.com/video.mp4',
    'text': 'First line\nSecond line',
    'duration_per_line': 4
}

response = requests.post(url, json=data)
print(response.json())

Parameters Explained

Here's a detailed look at the parameters you can customize when using the Text Overlay Captions API:

1. **video_url** (string): The URL of the video to overlay captions on. This is mandatory.

2. **text** (string): The caption lines to display, separated by newlines. This is also mandatory.

3. **subtitle_style** (string): Choose from styles like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg. Defaults to plain-white.

4. **aspect_ratio** (string): Set the video aspect ratio to optimize your captions, options include 16:9, 9:16, 4:3, or 3:4. Defaults to 9:16.

With FFMPEGAPI.net, adding text overlay captions to your videos has never been easier. The straightforward API allows you to focus on creating engaging content without the hassle of managing server infrastructure. Start using the Text Overlay Captions API today to enhance your video projects and improve viewer experience. Visit us at https://ffmpegapi.net for more information.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free