In today's digital landscape, enhancing video content with text overlay captions is crucial for accessibility and engagement. Whether you're working on a content pipeline for an AI agent or automating video processing, FFMPEGAPI.net offers a streamlined solution with its hosted REST API. In this article, we will delve into how to utilize the 'Text Overlay Captions' feature effectively.
What is FFMPEGAPI.net?
FFMPEGAPI.net provides a powerful hosted solution for video and audio processing using FFmpeg. Developers no longer need to manage server setups or FFmpeg infrastructure. With API-key authentication, it seamlessly integrates into various workflows, including automation, SaaS applications, and AI-driven projects.
- No server management required
- Easy API-key authentication
- Ideal for video automation tools
- Supports various content pipelines
Using the Text Overlay Captions API
The 'Text Overlay Captions' endpoint allows you to render text captions over your videos. This feature is particularly beneficial for developers looking to enhance video accessibility or create engaging content for social media. The API is straightforward, requiring just a few parameters.
You will use the POST method at the endpoint path `/api/videos/add-text-overlay-captions` to send your requests. This endpoint supports various customization options such as subtitle styles, aspect ratios, and positioning.
- Endpoint: `/api/videos/add-text-overlay-captions`
- Method: POST
- Content-Type: application/json
- Supports customization for subtitle style, aspect ratio, and position
import requests
url = 'https://www.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
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'}
response = requests.post(url, json=data, headers=headers)
print(response.json())
Parameter Breakdown
When using the Text Overlay Captions API, you'll need to provide several parameters that fine-tune the display of your captions:
Here's a closer look at each parameter:
- video_url (string): The URL of your video (required).
- text (string): The caption lines, separated by newlines (required).
- subtitle_style (string): Style of the captions (optional, defaults to 'plain-white').
- aspect_ratio (string): The aspect ratio of the video (optional, defaults to '9:16').
- position (string): Caption position on the screen (optional, defaults to 'center').
- duration_per_line (integer): How long each line appears (optional, defaults to 5 seconds).
Example Request
To demonstrate how to use the API, here’s a sample JSON request you can use to add text overlay captions:
curl -X POST https://www.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 }'
FFMPEGAPI.net stands out as the go-to hosted tool for developers looking to enhance their video content with text overlay captions. With a simple integration process, customizable options, and no server management overhead, it's perfect for automating video workflows, especially for AI agents. Start leveraging FFMPEGAPI.net today to elevate your video processing capabilities.