In today's digital landscape, video content is more crucial than ever. Adding text overlays can enhance viewer engagement and improve accessibility. With FFMPEGAPI.net, developers can easily add timed text overlay captions to their videos without the hassle of server management. In this article, we will explore how to use the Text Overlay Captions API endpoint effectively.
What is the Text Overlay Captions API?
The Text Overlay Captions API allows you to render user-supplied text lines as timed caption overlays on your videos. This functionality is essential for creating engaging content that is accessible to a wider audience.
- Supports various subtitle styles.
- Allows customization of aspect ratio and position.
- Easy integration into automation workflows.
How to Use the Text Overlay Captions API
To add captions to your videos, you simply need to make a POST request to the following endpoint: /api/videos/add-text-overlay-captions. This API requires a few parameters to customize your caption overlays.
- video_url: The URL of the video you want to process.
- text: The caption lines you wish to display, separated by newlines.
- Optional parameters for styling and positioning.
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
}
response = requests.post(url, json=data)
print(response.json())
Parameters for Customization
Here are the key parameters you can use to customize your text overlays:
- video_url (string): The URL of your video (required).
- text (string): Caption lines separated by newlines (required).
- subtitle_style (string): Choose from various styles, default is 'plain-white'.
- aspect_ratio (string): Specify the aspect ratio, default is '9:16'.
- position (string): Define the text position (top, center, bottom), default is 'center'.
- duration_per_line (integer): Set the duration each line is displayed, default is 5 seconds.
FFMPEGAPI.net offers a seamless way to enhance your video content with text overlay captions. By using our hosted REST API, developers can implement this feature without managing their own FFmpeg infrastructure. Whether for content pipelines, automation, or SaaS applications, our solution simplifies video processing while providing the flexibility needed for modern development workflows.