In the world of digital content, accessibility is key. Adding captions to videos not only makes them more inclusive but also enhances viewer engagement. With FFMPEGAPI.net, you can easily add text overlay captions to your videos using our powerful REST API. This guide will walk you through how to utilize the Text Overlay Captions feature to enrich your video content effortlessly.
Understanding the Text Overlay Captions Endpoint
FFMPEGAPI.net offers a dedicated endpoint for adding text overlay captions to your videos. This functionality is perfect for developers looking to implement automated captioning in SaaS applications or other content management workflows.
- Endpoint: POST /api/videos/add-text-overlay-captions
- Allows text lines to be displayed over a video at specified intervals.
- Supports customization of subtitle styles, aspect ratios, and positions.
Key Features and Parameters
To make the best use of the Text Overlay Captions endpoint, understanding the required and optional parameters is essential. Below we outline what you need to provide when making your API request.
- video_url (string): The URL of the video you want to process. This parameter is required.
- text (string): The caption lines you want to overlay, separated by newlines. This is also a required parameter.
- subtitle_style (string): Choose from styles like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg, with a default of plain-white.
- aspect_ratio (string): Options include 16:9, 9:16, 4:3, or 3:4, defaulting to 9:16.
- position (string): Control where the captions are placed (top, center, bottom) with the default set to center.
- duration_per_line (integer): Specify how long each line remains on screen (1 to 30 seconds), defaulting to 5 seconds.
Making Your First API Call
Once you have your video URL and captions ready, making an API call is straightforward. Below, you'll find an example of how to send a request to our Text Overlay Captions endpoint using 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())
Adding captions to your videos has never been easier with the FFMPEGAPI.net Text Overlay Captions feature. By leveraging our hosted REST API, you can streamline your video processing workflows without the hassle of managing FFmpeg infrastructure. Whether you're developing a SaaS application, an automation tool, or enhancing your content pipelines, FFMPEGAPI.net provides a reliable and efficient solution for all your video processing needs.