Adding text overlays to videos is crucial for accessibility and viewer engagement. With FFMPEGAPI.net, developers can easily implement caption overlays using a hosted REST API, eliminating the need for server management. This article will guide you through the process of using the 'Text Overlay Captions' endpoint to enhance your videos.
Understanding the Text Overlay Captions Endpoint
The 'Text Overlay Captions' endpoint allows you to render user-supplied text lines as timed captions on your videos. This feature is essential for creating engaging content that can be easily understood by a wider audience.
- POST method: /api/videos/add-text-overlay-captions
- Supports various parameters like video URL, text, subtitle style, aspect ratio, position, and duration per line.
Parameters for Adding Captions
To effectively use the 'Text Overlay Captions' endpoint, you need to understand the required and optional parameters. Here's a summary of each parameter:
The required parameters include video_url and text, while optional parameters allow customization, such as subtitle style and position.
- video_url: The URL of the video you want to process.
- text: Caption lines separated by newlines.
- subtitle_style: Options include plain-white, yellow-bg, pink-bg, blue-bg, or red-bg (default: plain-white).
- aspect_ratio: Choose from 16:9, 9:16, 4:3, or 3:4 (default: 9:16).
- position: Set to top, center, or bottom (default: center).
- duration_per_line: Control how long each text line appears (default: 5 seconds).
Example Usage of the Endpoint
Let's see how you can call the 'Text Overlay Captions' endpoint using a practical example in both cURL and Python.
curl -X POST https://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://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())
Using FFMPEGAPI.net for adding text overlay captions streamlines the process of programmatic video editing without the hassle of managing servers. With its simple API request and flexible parameters, you can enhance your videos and improve viewer engagement effortlessly. Start today with FFMPEGAPI.net to elevate your video content!