Back to Blog

How to Add Text Overlay Captions to Videos with FFMPEGAPI.net

June 2026 FFMPEG API Team

In the world of video content, captions play a crucial role in accessibility and viewer engagement. FFMPEGAPI.net provides a powerful hosted REST API to easily add text overlay captions to your videos, making it an ideal cloud-based FFmpeg alternative for developers. In this article, we will explore how to use the Text Overlay Captions endpoint to enhance your videos with dynamic captions.

Understanding the Text Overlay Captions Endpoint

FFMPEGAPI.net's Text Overlay Captions endpoint allows developers to render user-supplied text as timed captions over a video. This feature is particularly useful in making video content more accessible and engaging.

  • Endpoint Path: /api/videos/add-text-overlay-captions
  • HTTP Method: POST
  • Content Type: application/json

Required Parameters

To successfully use the Text Overlay Captions endpoint, you need to provide several parameters in your API request.

  • video_url (string) - The URL of the video you want to overlay captions on.
  • text (string) - The caption lines separated by newlines.

Optional Parameters

In addition to the required parameters, you have several optional parameters that can enhance the caption display.

  • subtitle_style (string) - Choose from styles like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg. Default is 'plain-white'.
  • aspect_ratio (string) - Set the video aspect ratio, options include 16:9, 9:16, 4:3, or 3:4. Default is '9:16'.
  • position (string) - Define the position of the captions: top, center, or bottom. Default is 'center'.
  • duration_per_line (integer) - Set how long each text line appears, ranging from 1 to 30 seconds. Default is 5.

Making Your API Request

Here’s how you can make a POST request to the Text Overlay Captions endpoint using curl and Python.

curl -X POST https://www.ffmpegapi.net/api/videos/add-text-overlay-captions \ 
-H 'Content-Type: application/json' \ 
-d '{"video_url": "https://example.com/video.mp4", "text": "First line\nSecond line", "duration_per_line": 4}'
import requests

url = 'https://www.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())

FFMPEGAPI.net provides a simple yet powerful solution for developers looking to add text overlay captions to their videos without the hassle of managing FFmpeg infrastructure. With an easy-to-use REST API and flexible parameters, you can enhance your video content, making it more accessible and engaging. Try out the Text Overlay Captions feature today and experience the benefits of a cloud FFmpeg alternative tailored for developers.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free