Back to Blog

Effortlessly Add Text Overlays to Videos with FFMPEGAPI.net

June 2026 FFMPEG API Team

In today's digital landscape, video content is king. Whether you're developing automation tools for AI agents or enhancing content pipelines for your SaaS applications, adding text overlays to videos can elevate your projects. FFMPEGAPI.net offers a powerful hosted REST API that simplifies this process, allowing developers to focus on building amazing applications without the hassle of managing server infrastructure. In this article, we'll explore how to use the Text Overlay Captions endpoint to enrich your videos with captions effortlessly.

What is the Text Overlay Captions Endpoint?

The Text Overlay Captions endpoint is designed to render user-supplied text lines as timed caption overlays on videos. This functionality is crucial for enhancing accessibility and improving viewer engagement.

By using this endpoint, you can display captions over your video, with each caption appearing for a specified duration. It's a simple yet effective way to convey important messages or provide context to your audience.

  • Supports various subtitle styles: plain-white, yellow-bg, pink-bg, blue-bg, or red-bg.
  • Customizable aspect ratios: 16:9, 9:16, 4:3, or 3:4.
  • Flexible positioning options: top, center, or bottom of the video.

How to Use the Text Overlay Captions API Endpoint

To add text overlays to your videos, you'll need to make a POST request to the following endpoint: /api/videos/add-text-overlay-captions. The API requires a JSON payload that includes the video URL and the text you want to overlay.

Here's a breakdown of the parameters you'll need to include in your request:

  • video_url: The URL of the video you want to process (required).
  • text: The caption lines you want to display (required). Use newlines to separate multiple lines.
  • subtitle_style: Optional style for the subtitles (default: plain-white).
  • aspect_ratio: Optional aspect ratio for the video (default: 9:16).
  • position: Optional positioning for captions (default: center).
  • duration_per_line: Optional duration for each text line (default: 5 seconds).
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())

Practical Example: Adding Captions to Your Videos

Let’s say you have a video that you want to add captions to. Below is a practical example of how to structure your API call. You can customize the parameters to fit your needs.

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": "Hello World!\nThis is a caption.", \
    "duration_per_line": 5 \
}'

FFMPEGAPI.net makes video processing accessible and efficient for developers, especially those working on automation and AI projects. With its easy-to-use Text Overlay Captions endpoint, you can enhance your videos in just a few lines of code. Say goodbye to complex FFmpeg setups and hello to a streamlined development experience. Start using FFMPEGAPI.net today and see how it can transform your video content workflows.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free