In the world of video content creation, adding captions can significantly enhance viewer engagement. FFMPEGAPI.net offers a powerful, hosted REST API that enables developers to easily overlay text captions on videos without the hassle of managing FFmpeg infrastructure. In this article, we will explore how to use the Text Overlay Captions endpoint to enrich your videos with timed captions.
What is FFMPEGAPI.net?
FFMPEGAPI.net is a cloud-based solution designed for seamless video and audio processing. It eliminates the need for complex server setups or worrying about FFmpeg management, allowing developers to focus on building their applications.
- Hosted REST API for FFmpeg-powered tasks.
- No infrastructure management required.
- API-key authentication simplifies workflows.
Using the Text Overlay Captions Endpoint
The Text Overlay Captions endpoint allows you to render specified text lines as timed overlays on your videos. This can be particularly useful for tutorials, promotional content, and accessibility enhancements.
- Endpoint Path: `/api/videos/add-text-overlay-captions`
- HTTP Method: POST
- Content Type: application/json
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, headers={'Authorization': 'Bearer YOUR_API_KEY'})
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 for Text Overlay Captions
To effectively use this endpoint, you need to specify several parameters that control how the captions are displayed.
- video_url (string): The URL of the video to process.
- text (string): Caption lines separated by newlines.
- subtitle_style (string): Options include 'plain-white', 'yellow-bg', 'pink-bg', 'blue-bg', 'red-bg'. Default is 'plain-white'.
- aspect_ratio (string): Choose between '16:9', '9:16', '4:3', or '3:4'. Default is '9:16'.
- position (string): Control caption placement - 'top', 'center', or 'bottom'. Default is 'center'.
- duration_per_line (integer): Duration each line is displayed in seconds. Default is 5, range is 1 to 30.
FFMPEGAPI.net provides a robust, hassle-free solution for developers looking to enhance their video content with text overlay captions. With easy API integration and powerful features, it stands out as the best cloud FFmpeg alternative. By leveraging this API, you can focus on creating engaging content while we handle the complexities of video processing.