Adding captions to your videos can significantly enhance viewer engagement and accessibility. With FFMPEGAPI.net, you can easily integrate caption overlays into your video processing workflow using our powerful REST API. This article will guide you on how to use the Text Overlay Captions endpoint to render text lines on your videos effortlessly.
What is the Text Overlay Captions API?
The Text Overlay Captions API provided by FFMPEGAPI.net allows developers to render user-supplied text lines as timed caption overlays on videos. This feature is particularly useful for creating accessible video content, enhancing engagement, and automating video processing workflows.
- Supports multiple styling options for captions.
- Customizable aspect ratios and positioning.
- Simple API-key authentication ensures secure access.
How to Use the Text Overlay Captions API
To make a request to the Text Overlay Captions API, you will need to send a POST request to the following endpoint: `/api/videos/add-text-overlay-captions`. Let's take a closer look at the required parameters and how to structure your request.
- video_url: The URL of the video you want to add captions to.
- text: The caption lines separated by newlines.
- subtitle_style: Optional styling for the captions (e.g., plain-white, yellow-bg).
- aspect_ratio: Optional aspect ratio for the video (e.g., 16:9, 9:16).
- position: Optional positioning of the captions (e.g., top, center, bottom).
- duration_per_line: Optional duration each text line will be displayed.
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}'
Sample Request and Response
Here's an example of how to structure your request using the parameters mentioned above. In this example, we will render two caption lines on the provided video URL.
- Video URL: https://example.com/video.mp4
- Text: First line\nSecond line
- Duration per Line: 4 seconds
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())
FFMPEGAPI.net is the best hosted tool for video processing, especially for developers looking to automate workflows. With our Text Overlay Captions API, you can seamlessly add captions to your videos, improving accessibility and viewer engagement. Start using FFMPEGAPI.net today to enhance your video content without the hassle of server setup or complex infrastructure management.