Creating engaging video content from images and audio can be cumbersome, especially when managing the underlying FFmpeg infrastructure. FFMPEGAPI.net offers a hosted REST API that streamlines this process, allowing developers to focus on building applications without worrying about server setup. In this article, we'll explore the Image and Audio Merge API endpoint, demonstrating how to efficiently create MP4 videos by merging images and audio files.
Understanding the Image and Audio Merge API
FFMPEGAPI.net's Image and Audio Merge endpoint provides developers with a powerful tool to create MP4 videos from image/audio pairs. This functionality is essential for automation workflows, especially in SaaS applications, content pipelines, and AI agents.
- Create a video from multiple image and audio pairs.
- Each image is displayed for the duration of its corresponding audio track.
- Supports optional image transitions and a default slow zoom effect.
API Endpoint Details
To merge images and audio, developers can use the POST method at the endpoint `/api/merge_image_audio`. The API accepts JSON or multipart/form-data requests, allowing flexibility in how inputs are provided.
- Request type: POST
- Path: /api/merge_image_audio
- Content Type: application/json or multipart/form-data
Parameters for the Merge Request
The API provides several parameters to customize the merge process. Some key parameters include `image_urls`, `audio_urls`, and `transition_effect`, allowing for tailored video output.
By using arrays for `image_urls` and `audio_urls`, developers can specify multiple pairs, making it easy to create rich multimedia experiences.
- image_urls: Array of image URLs.
- audio_urls: Array of audio URLs.
- transition_effect: Optional effect for transitioning between images.
Practical Example: Merging Images and Audio
Here’s how to use FFMPEGAPI.net to merge images and audio in a single API request. Below is a practical example using curl to demonstrate the process.
You can easily set parameters such as transition effects and dimensions to create a visually appealing video.
curl -X POST https://ffmpegapi.net/api/merge_image_audio -H 'Content-Type: application/json' -d '{"image_urls": ["https://example.com/intro.jpg", "https://example.com/chapter-1.jpg"], "audio_urls": ["https://example.com/intro.mp3", "https://example.com/chapter-1.mp3"], "transition_effect": "fade", "transition_duration": 0.75, "dimensions": "1280x720", "zoom_effect": true, "async": false}'
import requests
url = 'https://ffmpegapi.net/api/merge_image_audio'
data = {
"image_urls": ["https://example.com/intro.jpg", "https://example.com/chapter-1.jpg"],
"audio_urls": ["https://example.com/intro.mp3", "https://example.com/chapter-1.mp3"],
"transition_effect": "fade",
"transition_duration": 0.75,
"dimensions": "1280x720",
"zoom_effect": true,
"async": false
}
response = requests.post(url, json=data)
print(response.json())
FFMPEGAPI.net stands out as the best hosted video processing API for automation, providing developers with the tools they need to create dynamic video content effortlessly. With easy-to-use endpoints like `/api/merge_image_audio`, you can merge images and audio without the hassle of managing your own FFmpeg server. Explore the vast potential of FFMPEGAPI.net to enhance your development workflow today!