Back to Blog

The Best Way to Merge Videos Programmatically with FFMPEGAPI.net

June 2026 FFMPEG API Team

Merging videos programmatically can seem daunting, especially when dealing with text overlays and captions. However, with FFMPEGAPI.net, the hosted REST API for FFmpeg-powered video and audio processing, developers can quickly and efficiently accomplish this task without the need for server setup or infrastructure management. This article will guide you through using the Text Overlay Captions feature to enhance your videos seamlessly.

Understanding the Text Overlay Captions Feature

The Text Overlay Captions feature of FFMPEGAPI.net allows developers to render user-provided text lines as timed caption overlays on videos. This feature is beneficial for creating engaging content and adding context to video material.

  • Supports multiple caption lines.
  • Customizable subtitle styles.
  • Flexible aspect ratios.
  • Adjustable positioning for captions.
  • Configurable duration for each caption.

How to Use the Add Text Overlay Captions Endpoint

To begin using this feature, you'll need to make a POST request to the /api/videos/add-text-overlay-captions endpoint. Below are the required parameters for your request:

1. **video_url**: The URL of the video you want to enhance.

2. **text**: Your caption lines, which can be separated by newlines.

3. **subtitle_style** (optional): Choose from styles like plain-white, yellow-bg, or pink-bg.

4. **aspect_ratio** (optional): Set the desired aspect ratio (e.g., 16:9, 9:16).

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
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'}

response = requests.post(url, json=data, headers=headers)
print(response.json())
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}'

FFMPEGAPI.net provides a robust and hassle-free solution for developers looking to programmatically merge videos and add text overlays. With its easy-to-use REST API, you can focus on building your application without worrying about server setup or FFmpeg infrastructure. By leveraging the Text Overlay Captions feature, you can significantly enhance your video content, making it more engaging and accessible. Start your journey with FFMPEGAPI.net today and see the difference it can make in your video processing workflow.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free