Back to Blog

Enhance Your Video Content with Text Overlay Captions Using FFMPEGAPI.net

June 2026 FFMPEG API Team

Adding text overlay captions to videos can significantly enhance viewer engagement and accessibility. Utilizing the FFMPEGAPI.net hosted API allows developers to easily integrate this functionality into their applications without managing complex server setups. In this article, we will explore the Text Overlay Captions endpoint and provide practical examples to help you get started.

Understanding the Text Overlay Captions Endpoint

The Text Overlay Captions endpoint is designed to render text lines over a video, effectively allowing you to create engaging content. By using this feature, you can display captions at specified intervals, providing viewers with essential information in a visually appealing manner.

  • Method: POST
  • Path: /api/videos/add-text-overlay-captions
  • Content Type: application/json
  • Summary: Displays user-supplied text as timed captions over the video.

Required Parameters for the API Call

To successfully use the Text Overlay Captions endpoint, you need to provide specific parameters in your API request. Below are the mandatory and optional parameters you must include.

  • video_url (string): Required. The URL of the video to which you want to add captions.
  • text (string): Required. The caption lines to be displayed, separated by newlines.

Optional Parameters for Enhanced Customization

In addition to the required parameters, you can customize the appearance and behavior of the captions using optional parameters. These options allow you to cater the output to your specific needs.

  • subtitle_style (string): Optional. Styles include plain-white, yellow-bg, pink-bg, blue-bg, or red-bg. Default: plain-white.
  • aspect_ratio (string): Optional. Choose between 16:9, 9:16, 4:3, or 3:4. Default: 9:16.
  • position (string): Optional. Set the position of the captions to top, center, or bottom. Default: center.
  • duration_per_line (integer): Optional. Define how long each line should appear on screen (1 to 30 seconds). Default: 5.

Example API Request Using Curl

Here's how you can make a POST request to the Text Overlay Captions endpoint using Curl. This example demonstrates how to send a video URL and the text you want to overlay.

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}'

Integrating with Python

If you prefer to use Python, here’s a simple example demonstrating how to send the same request using the requests library.

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 is the best choice for developers looking to enhance their video applications with text overlay captions. With its easy-to-use REST API and robust functionality, you can focus on building your application without the hassle of managing FFmpeg infrastructure. Start integrating today and see the difference in your video content engagement!

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free