In today's content-driven world, adding captions to videos is essential for accessibility and engagement. FFMPEGAPI.net provides a powerful hosted REST API that allows developers to effortlessly add timed text overlay captions to videos. This guide will help you understand how to use the API for your video processing needs, especially for AI agents and automation workflows.
What is the Text Overlay Captions Endpoint?
The Text Overlay Captions endpoint of FFMPEGAPI.net lets you render user-supplied text lines as timed captions over a specified video. This API endpoint simplifies the process of making your videos more engaging and accessible.
- POST Method: Send your request using the POST method.
- Endpoint Path: /api/videos/add-text-overlay-captions
- Content-Type: application/json
Parameters for Adding Text Overlay Captions
To use the Text Overlay Captions API effectively, you'll need to provide several parameters. Below are the required and optional parameters:
Each parameter contributes to how the captions will appear on the video, allowing for customization based on your preferences.
- video_url (string, required): The URL of the video you want to overlay text on.
- text (string, required): The caption lines you want to display, separated by newlines.
- subtitle_style (string, optional): Choose from styles like 'plain-white', 'yellow-bg', etc.
- aspect_ratio (string, optional): Specify the aspect ratio, e.g., '16:9'.
- position (string, optional): Choose the position of the text, like 'top', 'center', or 'bottom'.
- duration_per_line (integer, optional): Set the duration for each text line (default is 5 seconds).
Practical Example of Using the API
Here is a practical example of how to use the Text Overlay Captions API with cURL. This example demonstrates how to add text overlays to your video hosted online.
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 Your Applications
Integrating the Text Overlay Captions API into your existing applications can streamline workflows and enhance user experience. Whether you're building a SaaS solution, automation tool, or developing for AI clients, this API provides the flexibility you need.
- No server setup required: Focus on development without managing FFmpeg infrastructure.
- API-key authentication: Secure and easy access for your workflows.
- Compatible with various content pipelines: Use it for video editing, social media content, or AI-driven applications.
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 harness the power of video automation tools, especially when adding text overlay captions. The hosted nature of the API eliminates the need for server management, allowing developers to focus on building innovative applications. With robust features and ease of use, FFMPEGAPI.net stands out as the premier solution for video processing needs.