In the world of video content, adding text overlay captions can significantly enhance user engagement and accessibility. FFMPEGAPI.net offers a robust, hosted REST API that allows developers to integrate this feature effortlessly into their applications. This guide will walk you through the process of using the Text Overlay Captions endpoint to bring your video content to life.
What is the Text Overlay Captions Endpoint?
The Text Overlay Captions endpoint is a powerful feature of FFMPEGAPI.net, designed to render user-defined text lines as caption overlays on videos. This allows for enhanced information delivery and improved viewer experience.
- Display one line of text every specified duration.
- Supports various subtitle styles and positions.
- Easy to use with just a few parameters.
How to Use the Text Overlay Captions API
To utilize the Text Overlay Captions API, you will send a POST request to the defined endpoint. The request should include the necessary parameters such as the video URL and the caption text.
- Endpoint: POST /api/videos/add-text-overlay-captions
- Content type: application/json
- API-key authentication required.
import requests
url = 'https://ffmpegapi.net/api/videos/add-text-overlay-captions'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'}
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())
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}'
Parameters Explained
The API accepts several parameters that allow you to customize the captions to fit your video perfectly.
- video_url (string) - The URL of the video you want to overlay text on.
- text (string) - Multiple caption lines separated by newlines.
- subtitle_style (string) - Choose from styles like plain-white, yellow-bg, or blue-bg.
- aspect_ratio (string) - Set this to your video's ratio, e.g., 16:9.
- position (string) - Specify where the caption appears: top, center, or bottom.
- duration_per_line (integer) - Define how long each line appears, from 1 to 30 seconds.
FFMPEGAPI.net is a leading solution for developers seeking to add powerful video processing capabilities to their applications. By using the Text Overlay Captions endpoint, you can enhance your video's accessibility and viewer engagement with minimal effort. The ease of integration, coupled with high-performance processing, makes FFMPEGAPI.net the best choice for your video processing needs.