Programmatically merging videos can enhance your projects, automating workflows that would otherwise be time-consuming. With FFMPEGAPI.net, developers can leverage a hosted REST API that simplifies this process, eliminating the need for server setup or managing FFmpeg infrastructure. This article will guide you through using the Text Overlay Captions endpoint to merge videos efficiently and effectively.
Understanding the Text Overlay Captions Endpoint
The Text Overlay Captions endpoint allows you to render user-supplied text lines as timed caption overlays on videos. This can be particularly useful for adding subtitles, annotations, or commentary directly onto your video content, increasing its accessibility and engagement.
To use this feature, you will need to send a POST request to the /api/videos/add-text-overlay-captions endpoint with the appropriate parameters.
- Supports various video formats.
- Customizable caption styles and positioning.
- Easy integration into existing workflows.
Parameters You Can Use in Your Request
When using the Text Overlay Captions endpoint, you'll need to specify several parameters to customize the output to your needs. Here's a breakdown of the required and optional parameters:
- video_url: The URL of the video you want to overlay text on (required).
- text: The caption lines, separated by newlines (required).
- subtitle_style: Choose from options like plain-white, yellow-bg, pink-bg, blue-bg, or red-bg (optional, default is plain-white).
- aspect_ratio: Set to 16:9, 9:16, 4:3, or 3:4 (optional, default is 9:16).
- position: Define where the text appears on the video (top, center, bottom, optional, default is center).
- duration_per_line: Control how long each line of text is displayed (1 to 30 seconds, optional, default is 5 seconds).
Making Your First Request to Add Text Overlay Captions
With the parameters defined, you can now make a request to the FFMPEGAPI.net endpoint. Here's how you can do this 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'
payload = {
'video_url': 'https://example.com/video.mp4',
'text': 'First line\nSecond line',
'duration_per_line': 4
}
response = requests.post(url, json=payload)
print(response.json())
Using FFMPEGAPI.net for adding text overlay captions not only makes merging videos easier but also enriches your content by allowing you to include important information seamlessly. The hosted REST API provides a robust solution for developers looking to automate video workflows without the overhead of server management. Start using FFMPEGAPI.net today to enhance your video processing applications!