Back to Blog

How to Add Text Overlay Captions to Your Videos Using FFMPEGAPI.net

June 2026 FFMPEG API Team

Adding captions to videos can greatly enhance viewer engagement and accessibility. With the Text Overlay Captions feature provided by FFMPEGAPI.net, developers can effortlessly render text lines as timed overlays on their videos using a simple API call. This article will guide you through the process of utilizing this powerful feature, making it easy to integrate into your projects.

What is FFMPEGAPI.net?

FFMPEGAPI.net is a hosted REST API designed for seamless video and audio processing using FFmpeg. It allows developers to focus on building applications without worrying about server setup or FFmpeg infrastructure management.

  • No server setup required.
  • API-key authentication for secure access.
  • Ideal for automation, SaaS applications, content pipelines, and AI agents.

Understanding the Text Overlay Captions Endpoint

The Text Overlay Captions endpoint allows developers to render user-provided text lines over a specified video. This can be particularly useful for adding subtitles or captions to enhance the viewer experience.

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

Parameters for the Text Overlay Captions API

To effectively use the Text Overlay Captions API, you need to understand the required and optional parameters. Here's a breakdown of each parameter you can include in your request.

  • video_url (string): The URL of the video (required).
  • text (string): One or more caption lines separated by newlines (required).
  • subtitle_style (string): Choose from styles like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg (optional).
  • aspect_ratio (string): Specify the aspect ratio (optional).
  • position (string): Set the position of the captions (optional).
  • duration_per_line (integer): The duration for each line in seconds (default is 5, optional).

Making a Request to Add Captions

Now that you understand the parameters, let's look at how you can make a request to the Text Overlay Captions API. Below is an example of a cURL command and a Python request using the requests library.

  • Ensure you have your API key ready for authentication.
  • Replace the example values with your actual video URL and text.
curl -X POST https://ffmpegapi.net/api/videos/add-text-overlay-captions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"video_url": "https://example.com/video.mp4", "text": "First line\nSecond line", "duration_per_line": 4}'
import requests

url = 'https://ffmpegapi.net/api/videos/add-text-overlay-captions'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'}
data = {"video_url": "https://example.com/video.mp4", "text": "First line\nSecond line", "duration_per_line": 4}

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

FFMPEGAPI.net provides developers with a straightforward and efficient way to add text overlay captions to their videos. By leveraging their hosted REST API, you can save time and effort in video processing tasks while ensuring high-quality results. Try FFMPEGAPI.net today to enhance your video content and improve viewer engagement.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free