In the world of video content creation, adding captions can significantly enhance viewer engagement and accessibility. With FFMPEGAPI.net's powerful REST API, developers can easily implement timed text overlay captions to their videos without the hassle of server setup or managing FFmpeg infrastructure. This article will guide you through using the '/api/videos/add-text-overlay-captions' endpoint to enrich your video projects.
What is the Text Overlay Captions Endpoint?
The Text Overlay Captions endpoint allows you to render user-supplied text lines as timed caption overlays on a video. This is especially useful for applications requiring accessibility features or for emphasizing key messages in video content.
Using this feature, developers can incorporate captions at specified intervals, ensuring that each line of text appears at the right moment for the viewer.
- Supports multiple caption lines.
- Customizable subtitle styles.
- Flexible aspect ratio options.
- Adjustable duration for each caption line.
How to Use the Endpoint
To get started, you will need to make a POST request to the endpoint '/api/videos/add-text-overlay-captions'. Here's a breakdown of the required and optional parameters:
- Required: video_url (string) - The URL of the video.
- Required: text (string) - One or more caption lines separated by newlines.
- Optional: subtitle_style (string) - Choose from styles like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg.
- Optional: aspect_ratio (string) - Specify as 16:9, 9:16, 4:3, or 3:4.
- Optional: position (string) - Position the captions as top, center, or bottom.
- Optional: duration_per_line (integer) - Set seconds per text line (1 to 30), default is 5.
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}'
import requests
url = 'https://www.ffmpegapi.net/api/videos/add-text-overlay-captions'
headers = {'Content-Type': 'application/json'}
data = {
'video_url': 'https://example.com/video.mp4',
'text': 'First line\nSecond line',
'duration_per_line': 4
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
Using FFMPEGAPI.net for adding text overlay captions simplifies the video enhancement process significantly. With its hosted REST API, developers can focus on building innovative applications without the need to manage server infrastructure or complex FFmpeg setups. Whether you're working on a content pipeline, creating a SaaS application, or integrating features for AI agents, FFMPEGAPI.net is the ideal solution for seamless video processing.