Creating engaging videos by merging images and audio is now easier than ever with the hosted REST API from FFMPEGAPI.net. This article will guide you through the process of using the '/api/merge_image_audio' endpoint to effortlessly generate MP4 videos from your media files, making it an essential tool for developers, automation, and content pipelines.
Understanding the Merge Image Audio Endpoint
The '/api/merge_image_audio' endpoint allows developers to combine one or more image/audio pairs into a cohesive MP4 video. Each image can be displayed for the duration of its matching audio file, allowing for a seamless transition between visuals and audio.
This API is particularly useful for developers looking to automate video creation for multimedia content, enabling them to enhance their applications with minimal infrastructure management.
- Create videos from multiple image/audio pairs effortlessly.
- Supports various transition effects and slow zoom for dynamic presentations.
- JSON requests for batch processing of media files.
Key Parameters for the API Request
When using the '/api/merge_image_audio' endpoint, several parameters can be tailored to meet your specific needs. The primary parameters include:
For multi-pair videos, you must provide arrays of image URLs and audio URLs that match in length.
Additionally, you can specify optional parameters such as transition effects and output dimensions for a polished final product.
- image_urls: Array of image URLs for the video.
- audio_urls: Array of audio URLs corresponding to each image.
- transition_effect: Optional effects such as fade or slide.
- zoom_effect: Option to enable a slow zoom on images.
Making a Request with Curl
To get started, you can make a simple POST request using curl to merge your images and audio into a video. Below is an example command that demonstrates how to utilize the API effectively.
curl -X POST https://www.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}'
Example Request in Python
For those who prefer Python, here's how you can make the same request using the requests library. This is a great way to integrate the functionality directly into your applications.
import requests
url = 'https://www.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 video processing API for automation, providing developers with the tools they need to create videos quickly and efficiently. With its user-friendly REST API, comprehensive documentation, and a variety of features like image transitions and zoom effects, it simplifies the video creation process. Start building your next project with FFMPEGAPI.net and experience the ease of merging images and audio with just a few lines of code.